Class: Floe::Workflow::IntrinsicFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/floe/workflow/intrinsic_function.rb,
lib/floe/workflow/intrinsic_function/parser.rb,
lib/floe/workflow/intrinsic_function/transformer.rb

Defined Under Namespace

Classes: Parser, Transformer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ IntrinsicFunction

Returns a new instance of IntrinsicFunction.



16
17
18
19
20
21
22
23
# File 'lib/floe/workflow/intrinsic_function.rb', line 16

def initialize(payload)
  @payload = payload
  @tree    = Parser.new.parse(payload)

  Floe.logger.debug { "Parsed intrinsic function: #{payload.inspect} => #{tree.inspect}" }
rescue Parslet::ParseFailed => err
  raise Floe::InvalidWorkflowError, err.message
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



14
15
16
# File 'lib/floe/workflow/intrinsic_function.rb', line 14

def payload
  @payload
end

Class Method Details

.intrinsic_function?(payload) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/floe/workflow/intrinsic_function.rb', line 10

def self.intrinsic_function?(payload)
  payload.start_with?("States.")
end

.value(payload, context = {}, input = {}) ⇒ Object



6
7
8
# File 'lib/floe/workflow/intrinsic_function.rb', line 6

def self.value(payload, context = {}, input = {})
  new(payload).value(context, input)
end

Instance Method Details

#value(context = {}, input = {}) ⇒ Object



25
26
27
# File 'lib/floe/workflow/intrinsic_function.rb', line 25

def value(context = {}, input = {})
  Transformer.new.apply(tree, :context => context, :input => input)
end