Class: BinaryParser::FreeCondition
- Inherits:
-
Object
- Object
- BinaryParser::FreeCondition
- Defined in:
- lib/binary_parser/general_class/free_condition.rb
Instance Method Summary collapse
- #eval(&name_eval_proc) ⇒ Object
-
#initialize(&condition_proc) ⇒ FreeCondition
constructor
A new instance of FreeCondition.
- #symbol_call(symbol, *args, &block) ⇒ Object
Constructor Details
#initialize(&condition_proc) ⇒ FreeCondition
Returns a new instance of FreeCondition.
3 4 5 |
# File 'lib/binary_parser/general_class/free_condition.rb', line 3 def initialize(&condition_proc) @condition_proc = condition_proc end |
Instance Method Details
#eval(&name_eval_proc) ⇒ Object
7 8 9 10 |
# File 'lib/binary_parser/general_class/free_condition.rb', line 7 def eval(&name_eval_proc) @name_eval_proc = name_eval_proc return Proxy.new(self, []).instance_eval(&@condition_proc) end |
#symbol_call(symbol, *args, &block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/binary_parser/general_class/free_condition.rb', line 12 def symbol_call(symbol, *args, &block) if symbol == :nextbits && args.length == 1 @name_eval_proc.call(Expression.nextbits_var(args[0])) else @name_eval_proc.call(Expression.value_var(symbol)) end end |