Class: FoodIngredientParser::Loose::Transform::Amount
- Inherits:
-
Object
- Object
- FoodIngredientParser::Loose::Transform::Amount
- Defined in:
- lib/food_ingredient_parser/loose/transform/amount.rb
Overview
Transforms node tree to extract amount into its own attribute.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(node) ⇒ Amount
constructor
A new instance of Amount.
- #transform! ⇒ Object
Constructor Details
#initialize(node) ⇒ Amount
Returns a new instance of Amount.
17 18 19 20 |
# File 'lib/food_ingredient_parser/loose/transform/amount.rb', line 17 def initialize(node) @node = node @parser = FoodIngredientParser::Loose::Transform::AmountFromNameParser.new end |
Class Method Details
.transform!(node) ⇒ Object
13 14 15 |
# File 'lib/food_ingredient_parser/loose/transform/amount.rb', line 13 def self.transform!(node) new(node).transform! end |
Instance Method Details
#transform! ⇒ Object
22 23 24 25 26 |
# File 'lib/food_ingredient_parser/loose/transform/amount.rb', line 22 def transform! transform_name transform_contains @node end |