Class: FoodIngredientParser::Loose::Transform::SplitENumbers
- Inherits:
-
Object
- Object
- FoodIngredientParser::Loose::Transform::SplitENumbers
- Defined in:
- lib/food_ingredient_parser/loose/transform/split_e_numbers.rb
Constant Summary collapse
- SPLIT_RE =
Note:
mark and amount is lost, this is not expected on e-numbers
Transforms node tree to split e-number combinations.
/\s*(-|\ben\b|\band\b|\bund\b|\bet\b)\s*/.freeze
- SINGLE_RE =
/E(-|\s+)?\d{3}[a-z]?\s*(\([iv]+\)|\[[iv]+\])?/i.freeze
- MATCH_RE =
/\A\s*(#{SINGLE_RE})(?:#{SPLIT_RE}(#{SINGLE_RE}))+\s*\z/i.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(node) ⇒ SplitENumbers
constructor
A new instance of SplitENumbers.
- #transform! ⇒ Object
Constructor Details
#initialize(node) ⇒ SplitENumbers
Returns a new instance of SplitENumbers.
18 19 20 |
# File 'lib/food_ingredient_parser/loose/transform/split_e_numbers.rb', line 18 def initialize(node) @node = node end |
Class Method Details
.transform!(node) ⇒ Object
14 15 16 |
# File 'lib/food_ingredient_parser/loose/transform/split_e_numbers.rb', line 14 def self.transform!(node) new(node).transform! end |
Instance Method Details
#transform! ⇒ Object
22 23 24 25 |
# File 'lib/food_ingredient_parser/loose/transform/split_e_numbers.rb', line 22 def transform! transform_node!(@node) @node end |