Class: CookieCutter::Recipe
- Inherits:
-
Object
- Object
- CookieCutter::Recipe
- Defined in:
- lib/cookie_cutter/recipe.rb
Overview
Reads config file information and builds a cookie from the selected template
Constant Summary collapse
- DEFAULT_CONFIG_FILENAME =
'config.yml'
- CONFIG_PATH =
'config_path'
Instance Attribute Summary collapse
-
#config_file_path ⇒ Object
Returns the value of attribute config_file_path.
-
#cookie ⇒ Object
Returns the value of attribute cookie.
Instance Method Summary collapse
- #build_cookie(cookie_name, which_template) ⇒ Object
- #config ⇒ Object
-
#initialize(config_file_path = nil) ⇒ Recipe
constructor
A new instance of Recipe.
- #template ⇒ Object
Constructor Details
#initialize(config_file_path = nil) ⇒ Recipe
Returns a new instance of Recipe.
11 12 13 14 15 16 |
# File 'lib/cookie_cutter/recipe.rb', line 11 def initialize(config_file_path = nil) throw ArgumentError if config_file_path.nil? @config_file_path = config_file_path @_config = Recipe.read_config_file(config_file_path) end |
Instance Attribute Details
#config_file_path ⇒ Object
Returns the value of attribute config_file_path.
7 8 9 |
# File 'lib/cookie_cutter/recipe.rb', line 7 def config_file_path @config_file_path end |
#cookie ⇒ Object
Returns the value of attribute cookie.
7 8 9 |
# File 'lib/cookie_cutter/recipe.rb', line 7 def @cookie end |
Instance Method Details
#build_cookie(cookie_name, which_template) ⇒ Object
27 28 29 30 |
# File 'lib/cookie_cutter/recipe.rb', line 27 def (, which_template) @_template = self.config[which_template] @cookie = Cookie.new(, self.template) end |
#config ⇒ Object
18 19 20 |
# File 'lib/cookie_cutter/recipe.rb', line 18 def config @_config end |
#template ⇒ Object
22 23 24 25 |
# File 'lib/cookie_cutter/recipe.rb', line 22 def template @_template[Recipe::CONFIG_PATH] = @config_file_path @_template end |