Class: Naming::Meta
- Inherits:
-
StructX
- Object
- StructX
- Naming::Meta
- Defined in:
- lib/naming/meta.rb
Overview
Meta is a container of name and value. This is super class of all naming classes.
Class Method Summary collapse
-
.name ⇒ Symbol
Return the name as symbol.
-
.others(array) ⇒ Object
Collect objects from the array excluding named objects which have the same name.
-
.values(array) ⇒ Object
Extract values which have the same name from the array.
Class Method Details
.name ⇒ Symbol
Return the name as symbol. It is just name, doesn’t include module path.
50 51 52 |
# File 'lib/naming/meta.rb', line 50 def name self.to_s.split("::").last.to_sym end |
.others(array) ⇒ Object
Collect objects from the array excluding named objects which have the same name.
39 40 41 |
# File 'lib/naming/meta.rb', line 39 def others(array) array.select{|elt| not(elt.kind_of?(self))} end |
.values(array) ⇒ Object
Extract values which have the same name from the array.
20 21 22 |
# File 'lib/naming/meta.rb', line 20 def values(array) array.select{|elt| elt.kind_of?(self)}.map{|elt| elt.value} end |