Class: RubyToBlock::Block::OperatorsCompare
- Defined in:
- app/models/concerns/ruby_to_block/block/operators_compare.rb
Constant Summary collapse
- OPERATOR_TO_TYPE =
{ '<' => "#{type}_lt", '<=' => "#{type}_lte", '==' => "#{type}_eq", '>=' => "#{type}_gte", '>' => "#{type}_gt", }
Instance Attribute Summary collapse
-
#compare_type ⇒ Object
Returns the value of attribute compare_type.
Attributes inherited from Base
#fields, #parent, #prev_sibling, #sibling, #statements, #values
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#[], #add_statement, #add_value, blocknize, indent?, #indent_level, inherited, #initialize, inline?, #inline?, #null?, priority, process_else, process_end, process_value_string, regexp, statement?, #to_xml, type, value?
Constructor Details
This class inherits a constructor from RubyToBlock::Block::Base
Instance Attribute Details
#compare_type ⇒ Object
Returns the value of attribute compare_type.
16 17 18 |
# File 'app/models/concerns/ruby_to_block/block/operators_compare.rb', line 16 def compare_type @compare_type end |
Class Method Details
.process_match_data(md, context) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/models/concerns/ruby_to_block/block/operators_compare.rb', line 18 def self.process_match_data(md, context) md2 = regexp.match(md[type]) block = new context.add_value(block) process_value_string(context, block, md2[1], :A) block.compare_type = md2[2] process_value_string(context, block, md2[3], :B) true end |
Instance Method Details
#type ⇒ Object
31 32 33 |
# File 'app/models/concerns/ruby_to_block/block/operators_compare.rb', line 31 def type OPERATOR_TO_TYPE[@compare_type] end |