Class: Conductor::Export

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/export.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Export

Returns a new instance of Export.



5
6
7
8
9
# File 'lib/conductor/export.rb', line 5

def initialize(options={})
  @id      = options.fetch(:id)
  @value   = options.fetch(:value)
  @context = options.fetch(:context)
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



3
4
5
# File 'lib/conductor/export.rb', line 3

def context
  @context
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/conductor/export.rb', line 3

def id
  @id
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/conductor/export.rb', line 3

def value
  @value
end

Instance Method Details

#export(export_value = nil) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/conductor/export.rb', line 11

def export(export_value=nil)
  if value.is_a? Proc
    context.instance_eval { value.call exported_value }
  else
    value
  end
end