Class: Foodtaster::RSpec::ExampleMethods::ChefConfig
- Inherits:
-
Object
- Object
- Foodtaster::RSpec::ExampleMethods::ChefConfig
- Defined in:
- lib/foodtaster/rspec/example_methods.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
Returns the value of attribute json.
-
#run_list ⇒ Object
Returns the value of attribute run_list.
Instance Method Summary collapse
- #add_recipe(name) ⇒ Object
- #add_role(name) ⇒ Object
-
#initialize ⇒ ChefConfig
constructor
A new instance of ChefConfig.
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ ChefConfig
34 35 36 37 |
# File 'lib/foodtaster/rspec/example_methods.rb', line 34 def initialize @json = {} @run_list = [] end |
Instance Attribute Details
#json ⇒ Object
Returns the value of attribute json.
32 33 34 |
# File 'lib/foodtaster/rspec/example_methods.rb', line 32 def json @json end |
#run_list ⇒ Object
Returns the value of attribute run_list.
32 33 34 |
# File 'lib/foodtaster/rspec/example_methods.rb', line 32 def run_list @run_list end |
Instance Method Details
#add_recipe(name) ⇒ Object
39 40 41 42 |
# File 'lib/foodtaster/rspec/example_methods.rb', line 39 def add_recipe(name) name = "recipe[#{name}]" unless name =~ /^recipe\[(.+?)\]$/ run_list << name end |
#add_role(name) ⇒ Object
44 45 46 47 |
# File 'lib/foodtaster/rspec/example_methods.rb', line 44 def add_role(name) name = "role[#{name}]" unless name =~ /^role\[(.+?)\]$/ run_list << name end |
#to_hash ⇒ Object
49 50 51 |
# File 'lib/foodtaster/rspec/example_methods.rb', line 49 def to_hash { json: json, run_list: run_list } end |