Class: Onoma::Relation
- Inherits:
-
Array
- Object
- Array
- Onoma::Relation
- Defined in:
- lib/onoma/relation.rb
Instance Attribute Summary collapse
-
#nomenclature ⇒ Object
readonly
Returns the value of attribute nomenclature.
Instance Method Summary collapse
-
#initialize(nomenclature, *args) ⇒ Relation
constructor
A new instance of Relation.
- #selection(sorted = true) ⇒ Object
Constructor Details
#initialize(nomenclature, *args) ⇒ Relation
Returns a new instance of Relation.
7 8 9 10 |
# File 'lib/onoma/relation.rb', line 7 def initialize(nomenclature, *args) super(*args) @nomenclature = nomenclature end |
Instance Attribute Details
#nomenclature ⇒ Object (readonly)
Returns the value of attribute nomenclature.
3 4 5 |
# File 'lib/onoma/relation.rb', line 3 def nomenclature @nomenclature end |
Instance Method Details
#selection(sorted = true) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/onoma/relation.rb', line 18 def selection(sorted = true) unit_selec = collect do |item| [item.human_name, item.name.to_s] end if sorted unit_selec.sort! do |a, b| a.first.lower_ascii <=> b.first.lower_ascii end end unit_selec end |