Class: Cog::DSL::FeatureDSL
- Inherits:
-
Object
- Object
- Cog::DSL::FeatureDSL
- Defined in:
- lib/cog/dsl/feature_dsl.rb
Overview
DSL for defining cog features
Instance Attribute Summary collapse
-
#feature ⇒ Cog::Seed
readonly
The seed which is defined by this DSL object.
Instance Method Summary collapse
-
#abstract ⇒ nil
Declare this method abstract.
-
#desc(value) ⇒ nil
Describe what this method does in one line.
-
#initialize(seed, name, opt = {}) ⇒ FeatureDSL
constructor
A new instance of FeatureDSL.
-
#param(type, name, opt = {}) ⇒ nil
Add a parameter to the feature.
-
#return(type) ⇒ nil
Define the return type for the method.
Constructor Details
#initialize(seed, name, opt = {}) ⇒ FeatureDSL
Returns a new instance of FeatureDSL.
12 13 14 |
# File 'lib/cog/dsl/feature_dsl.rb', line 12 def initialize(seed, name, opt={}) @feature = Seed::Feature.new seed, name, opt end |
Instance Attribute Details
#feature ⇒ Cog::Seed (readonly)
Returns the seed which is defined by this DSL object.
9 10 11 |
# File 'lib/cog/dsl/feature_dsl.rb', line 9 def feature @feature end |
Instance Method Details
#abstract ⇒ nil
Declare this method abstract
26 27 28 29 |
# File 'lib/cog/dsl/feature_dsl.rb', line 26 def abstract feature_eval { @abstract = true } nil end |
#desc(value) ⇒ nil
Describe what this method does in one line
19 20 21 22 |
# File 'lib/cog/dsl/feature_dsl.rb', line 19 def desc(value) feature_eval { @desc = value } nil end |
#param(type, name, opt = {}) ⇒ nil
Add a parameter to the feature
37 38 39 40 41 |
# File 'lib/cog/dsl/feature_dsl.rb', line 37 def param(type, name, opt={}) v = Seed::Var.new type, name, opt feature_eval { @params << v } nil end |
#return(type) ⇒ nil
Define the return type for the method. Will be ‘:void` if this method is never called.
47 48 49 50 |
# File 'lib/cog/dsl/feature_dsl.rb', line 47 def return(type) feature_eval { @return_type = type } nil end |