Class: GlooLang::Exec::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo_lang/exec/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, to, params = nil) ⇒ Action

Set up the action.



16
17
18
19
20
# File 'lib/gloo_lang/exec/action.rb', line 16

def initialize( msg, to, params = nil )
  @msg = msg
  @to = to
  @params = params
end

Instance Attribute Details

#msgObject

Returns the value of attribute msg.



11
12
13
# File 'lib/gloo_lang/exec/action.rb', line 11

def msg
  @msg
end

#paramsObject

Returns the value of attribute params.



11
12
13
# File 'lib/gloo_lang/exec/action.rb', line 11

def params
  @params
end

#toObject

Returns the value of attribute to.



11
12
13
# File 'lib/gloo_lang/exec/action.rb', line 11

def to
  @to
end

Instance Method Details

#dispatchObject

Execute the action. Dispatch the message to the object.



34
35
36
# File 'lib/gloo_lang/exec/action.rb', line 34

def dispatch
  @to.send_message @msg, @params
end

#display_valueObject

Generic function to get display value. Can be used for debugging, etc.



42
43
44
# File 'lib/gloo_lang/exec/action.rb', line 42

def display_value
  return "#{@msg} -> #{@to.pn}"
end

#valid?Boolean

The action is valid if the object can receive the message specified.

Returns:

  • (Boolean)


26
27
28
# File 'lib/gloo_lang/exec/action.rb', line 26

def valid?
  return @to.can_receive_message?( @msg )
end