Class: Towsta::Kinds::MultipleKind
- Defined in:
- lib/towsta/kinds/multiple.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
Methods inherited from MainKind
#compare, #compare_parameterized, #initialize, #kind
Constructor Details
This class inherits a constructor from Towsta::Kinds::MainKind
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/towsta/kinds/multiple.rb', line 6 def content @content end |
Instance Method Details
#export ⇒ Object
26 27 28 |
# File 'lib/towsta/kinds/multiple.rb', line 26 def export get.collect{|c| c.id}.join ' ' end |
#get ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/towsta/kinds/multiple.rb', line 8 def get return @content if @content.class == Array return [] if !!(@content =~ /[^0-9 ]/) aux = [] @content.to_s.split(' ').each do |i| Towsta::Core.subclasses.each do |v| horizontal = v.find_by_id i.to_i aux << horizontal if horizontal end end @content = aux end |
#set(content) ⇒ Object
21 22 23 24 |
# File 'lib/towsta/kinds/multiple.rb', line 21 def set content return @content = content if content.class == Array @content = content.to_s end |