Class: Coronet::TransformationRule

Inherits:
Object
  • Object
show all
Defined in:
lib/coronet/transformation_rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming, outgoing) ⇒ TransformationRule

Returns a new instance of TransformationRule.



5
6
7
8
# File 'lib/coronet/transformation_rule.rb', line 5

def initialize(incoming, outgoing)
  @in = incoming
  @out = outgoing
end

Instance Attribute Details

#inObject

Returns the value of attribute in.



3
4
5
# File 'lib/coronet/transformation_rule.rb', line 3

def in
  @in
end

#outObject

Returns the value of attribute out.



3
4
5
# File 'lib/coronet/transformation_rule.rb', line 3

def out
  @out
end

Instance Method Details

#apply(message) ⇒ Object



10
11
12
# File 'lib/coronet/transformation_rule.rb', line 10

def apply(message)
  @in.transform(message, @out)
end

#inverseObject



14
# File 'lib/coronet/transformation_rule.rb', line 14

def inverse; TransformationRule.new(@out, @in); end