Class: Alfabet
- Inherits:
-
Object
- Object
- Alfabet
- Defined in:
- lib/freshmind/alfabet.rb
Constant Summary collapse
- LETTERS =
{ ru: ('А'..'Я').to_a - %w[Ъ Ь] + %w[Ё], en: ('A'..'Z').to_a }
Instance Attribute Summary collapse
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Alfabet
constructor
A new instance of Alfabet.
- #list ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Alfabet
Returns a new instance of Alfabet.
8 9 10 11 |
# File 'lib/freshmind/alfabet.rb', line 8 def initialize( = {}) @lang = .fetch(:lang) { :en } @order = .fetch(:order){ :ordered } end |
Instance Attribute Details
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
2 3 4 |
# File 'lib/freshmind/alfabet.rb', line 2 def lang @lang end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
2 3 4 |
# File 'lib/freshmind/alfabet.rb', line 2 def order @order end |
Instance Method Details
#list ⇒ Object
13 14 15 16 17 |
# File 'lib/freshmind/alfabet.rb', line 13 def list res = (LETTERS[lang] * 2)[0, 40] res = res.sample(res.size) if order.to_sym == :random res end |