Class: Playmo::Recipe::Dsl
- Defined in:
- lib/playmo/recipe/dsl.rb
Instance Attribute Summary collapse
-
#after(after) ⇒ Object
TODO: Сделать автолоадинг для зависимых рецептов.
-
#description(description = nil) ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Attributes inherited from Recipe
Instance Method Summary collapse
- #ask(question, &block) ⇒ Object
-
#initialize(name, options, &block) ⇒ Dsl
constructor
A new instance of Dsl.
-
#question(question, &block) ⇒ Object
Если блок с агрументами - то поддерживается ввод данных пользователем.
- #silently(&block) ⇒ Object
Methods inherited from Recipe
#before_exit, #cook!, #create_database, #generate, #install, #migrate_database, #retrieve, #seed_database, #store, #to_s
Constructor Details
#initialize(name, options, &block) ⇒ Dsl
Returns a new instance of Dsl.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/playmo/recipe/dsl.rb', line 6 def initialize(name, , &block) super() raise 'Recipe name not specified!' unless name @name = name @options = instance_eval &block end |
Instance Attribute Details
#after(after) ⇒ Object
TODO: Сделать автолоадинг для зависимых рецептов
36 37 38 |
# File 'lib/playmo/recipe/dsl.rb', line 36 def after @after end |
#description(description = nil) ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/playmo/recipe/dsl.rb', line 4 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/playmo/recipe/dsl.rb', line 4 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/playmo/recipe/dsl.rb', line 4 def @options end |
Instance Method Details
#ask(question, &block) ⇒ Object
27 28 29 |
# File 'lib/playmo/recipe/dsl.rb', line 27 def ask(question, &block) actions << lambda { Playmo::Question.new(self, question, :type => :ask, &block).to_s } end |