# defender-security/5.8.1/vendor/gettext/languages/src/Exporter/Ruby.php

Defender Security – Malware Scanner, Login Security &amp; Firewall, version 5.8.1. 61 lines.

- Page: https://pluginprobe.com/plugins/defender-security/5.8.1/code/vendor/gettext/languages/src/Exporter/Ruby.php
- Raw: https://pluginprobe.com/plugins/defender-security/5.8.1/raw/vendor/gettext/languages/src/Exporter/Ruby.php
- Modified: 2025-06-12T15:59:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/defender-security/5.8.1/code/vendor/gettext/languages/src/Exporter/Ruby.php#L10-L20`.

```php
<?php

namespace Gettext\Languages\Exporter;

class Ruby extends Exporter
{
    /**
     * {@inheritdoc}
     *
     * @see \Gettext\Languages\Exporter\Exporter::getDescription()
     */
    public static function getDescription()
    {
        return 'Build a Ruby hash';
    }

    /**
     * {@inheritdoc}
     *
     * @see \Gettext\Languages\Exporter\Exporter::toStringDoWithOptions()
     */
    protected static function toStringDoWithOptions($languages, array $options)
    {
        $lines = array();
        $lines[] = 'PLURAL_RULES = {';
        foreach ($languages as $lc) {
            $lines[] = '  \'' . $lc->id . '\' => {';
            $lines[] = '    \'name\' => \'' . addslashes($lc->name) . '\',';
            if (isset($lc->supersededBy)) {
                $lines[] = '    \'supersededBy\' => \'' . $lc->supersededBy . '\',';
            }
            if (isset($lc->script)) {
                $lines[] = '    \'script\' => \'' . addslashes($lc->script) . '\',';
            }
            if (isset($lc->territory)) {
                $lines[] = '    \'territory\' => \'' . addslashes($lc->territory) . '\',';
            }
            if (isset($lc->baseLanguage)) {
                $lines[] = '    \'baseLanguage\' => \'' . addslashes($lc->baseLanguage) . '\',';
            }
            $lines[] = '    \'formula\' => \'' . $lc->formula . '\',';
            $lines[] = '    \'plurals\' => ' . count($lc->categories) . ',';
            $catNames = array();
            foreach ($lc->categories as $c) {
                $catNames[] = "'{$c->id}'";
            }
            $lines[] = '    \'cases\' => [' . implode(', ', $catNames) . '],';
            $lines[] = '    \'examples\' => {';
            foreach ($lc->categories as $c) {
                $lines[] = '      \'' . $c->id . '\' => \'' . $c->examples . '\',';
            }
            $lines[] = '    },';
            $lines[] = '  },';
        }
        $lines[] = '}';
        $lines[] = '';

        return implode("\n", $lines);
    }
}

```
