Class: Hierogloss::MdC::Transform

Inherits:
Parslet::Transform
  • Object
show all
Defined in:
lib/hierogloss/mdc.rb

Class Method Summary collapse

Class Method Details

.lists_as(klass, list) ⇒ Object

If we only have one item, we don’t need to build an extra wrapper class; we can just pass it up.



125
126
127
128
129
130
131
# File 'lib/hierogloss/mdc.rb', line 125

def self.lists_as(klass, list)
  if list.length == 1
    list.first
  else
    klass.new(list)
  end
end