class Cog::DSL::FeatureDSL
DSL
for defining cog features
Attributes
feature[R]
@api developer @return [Cog::Seed] the seed which is defined by this DSL
object
Public Class Methods
new(seed, name, opt={})
click to toggle source
@api developer
# File lib/cog/dsl/feature_dsl.rb, line 12 def initialize(seed, name, opt={}) @feature = Seed::Feature.new seed, name, opt end
Public Instance Methods
abstract()
click to toggle source
Declare this method abstract @return [nil]
# File lib/cog/dsl/feature_dsl.rb, line 26 def abstract feature_eval { @abstract = true } nil end
desc(value)
click to toggle source
Describe what this method does in one line @param value [String] a short description @return [nil]
# File lib/cog/dsl/feature_dsl.rb, line 19 def desc(value) feature_eval { @desc = value } nil end
param(type, name, opt={})
click to toggle source
Add a parameter to the feature @param type [Symbol] the type of the parameter @param name [String] name of the parameter @option opt [String] :desc (nil) optional description which will be used in documentation @option opt [Seed] :scope (nil) optional scope to use when rendering the variable in a qualified way @return [nil]
# 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)
click to toggle source
Define the return type for the method. Will be `:void` if this method is never called. @param type [Symbol] a type @return [nil]
# File lib/cog/dsl/feature_dsl.rb, line 47 def return(type) feature_eval { @return_type = type } nil end
Private Instance Methods
feature_eval(&block)
click to toggle source
# File lib/cog/dsl/feature_dsl.rb, line 54 def feature_eval(&block) @feature.instance_eval &block end