Class: Fabulator::Exhibit::Actions::Value

Inherits:
Action
  • Object
show all
Defined in:
lib/fabulator/exhibit/actions/value.rb

Instance Method Summary collapse

Instance Method Details

#run(context, autovivify = false) ⇒ Object



11
12
13
14
15
16
# File 'lib/fabulator/exhibit/actions/value.rb', line 11

def run(context, autovivify = false)
  @context.with(context) do |ctx|
     value = self.select(ctx).collect{ |s| s.value }
     ctx.get_scoped_info('exhibit/item/info')[self.name(ctx).first.to_s] = value.empty? ? nil : (value.size == 1 ? value.first : value)
  end
end