Class: BinaryParser::Condition
- Inherits:
-
Object
- Object
- BinaryParser::Condition
- Defined in:
- lib/binary_parser/general_class/condition.rb
Instance Method Summary collapse
- #eval(&token_eval_proc) ⇒ Object
-
#initialize(*var_names, &condition_proc) ⇒ Condition
constructor
A new instance of Condition.
Constructor Details
#initialize(*var_names, &condition_proc) ⇒ Condition
Returns a new instance of Condition.
3 4 5 6 |
# File 'lib/binary_parser/general_class/condition.rb', line 3 def initialize(*var_names, &condition_proc) @tokens = var_names.map{|symbol| Expression.value_var(symbol)} @condition_proc = condition_proc end |
Instance Method Details
#eval(&token_eval_proc) ⇒ Object
8 9 10 |
# File 'lib/binary_parser/general_class/condition.rb', line 8 def eval(&token_eval_proc) return @condition_proc.call(*@tokens.map{|token| token_eval_proc.call(token)}) end |