Class: BeerRecipe::RecipeReader
- Inherits:
-
Object
- Object
- BeerRecipe::RecipeReader
- Defined in:
- lib/beer_recipe/recipe_reader.rb
Instance Attribute Summary collapse
-
#parser ⇒ Object
Returns the value of attribute parser.
-
#recipe ⇒ Object
Returns the value of attribute recipe.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ RecipeReader
constructor
A new instance of RecipeReader.
- #output ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ RecipeReader
Returns a new instance of RecipeReader.
4 5 6 |
# File 'lib/beer_recipe/recipe_reader.rb', line 4 def initialize( = {}) @options = end |
Instance Attribute Details
#parser ⇒ Object
Returns the value of attribute parser.
2 3 4 |
# File 'lib/beer_recipe/recipe_reader.rb', line 2 def parser @parser end |
#recipe ⇒ Object
Returns the value of attribute recipe.
2 3 4 |
# File 'lib/beer_recipe/recipe_reader.rb', line 2 def recipe @recipe end |
Instance Method Details
#output ⇒ Object
18 19 20 21 |
# File 'lib/beer_recipe/recipe_reader.rb', line 18 def output @options[:formatter].format(recipe) self end |
#read ⇒ Object
8 9 10 11 12 |
# File 'lib/beer_recipe/recipe_reader.rb', line 8 def read @parser ||= NRB::BeerXML::Parser.new @beerxml = parser.parse @options[:file] self end |