Class: Yaks::Mapper::Form::Legend

Inherits:
Object
  • Object
show all
Defined in:
lib/yaks/mapper/form/legend.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(label, opts = {}) ⇒ Object



7
8
9
# File 'lib/yaks/mapper/form/legend.rb', line 7

def self.create(label, opts = {})
  new(opts.merge(type: :legend, label: label))
end

Instance Method Details

#to_resource_fields(mapper) ⇒ Object



11
12
13
14
# File 'lib/yaks/mapper/form/legend.rb', line 11

def to_resource_fields(mapper)
  return [] unless self.if.nil? || mapper.expand_value(self.if)
  [ Resource::Form::Legend.new(label: mapper.expand_value(label)) ]
end