module BaseChip::Dsl
Attributes
modes[RW]
Public Class Methods
included(mod)
click to toggle source
# File lib/base_chip/dsl.rb, line 25 def self.included mod mod.extend Dsl::ClassMethods mod.class_eval do include Reporting include Dsl::InstanceMethods attr_accessor :name attr_reader :foster attr_reader :parent attr_accessor :settings attr_accessor :children attr_accessor :possible_settings attr_reader :configured attr_accessor :blks attr_accessor :abstract @settings = Hash.new @possible_settings = Hash.new @child_types = Hash.new @possible_child_types = Hash.new end end
Public Instance Methods
add_child_mode_as_child(child_name,mode)
click to toggle source
# File lib/base_chip/dsl.rb, line 398 def add_child_mode_as_child(child_name,mode) if c = @children[child_name.to_sym] c2 = c.clone c2.blks = c.blks # copy has the same blocks c2.modes << mode else fault "add_child_mode_as_child could not find child '#{child_name}'" end end
inherit(name)
click to toggle source
# File lib/base_chip/dsl.rb, line 428 def inherit(name) return if @base_types.map{|t|t.name}.include? name things = parent.instance_eval(type_plural) fault "'#{full_name}' tried to inherit from #{name.inspect}, but there are no '#{type_plural}' in '#{parent.full_name}'to extend'" unless things thing = things[name.to_sym] fault "'#{full_name}' tried to inherit from #{name.inspect}, but '#{parent.full_name}.#{type_plural}[#{name.inspect}]' is nil'" unless thing @base_types << thing end
mode(name, &blk)
click to toggle source
# File lib/base_chip/dsl.rb, line 407 def mode(name, &blk) if mode? name blk.call end end
mode?(name)
click to toggle source
# File lib/base_chip/dsl.rb, line 412 def mode?(name) # fault "Attempted to use mode '#{name}', which isn't registered with the project. Call register_mode(#{name}) in project.rb to allow." unless project.registered_modes.include? name.to_s if modes.include? name.to_s ".#{name}" end # else return nil end
type_plural()
click to toggle source
# File lib/base_chip/dsl.rb, line 418 def type_plural if is_a? Project ; 'project.subprojects' elsif is_a? Block ; 'project.blocks' elsif is_a? Configuration; 'block.configurations' elsif is_a? Action ; 'configuration.actions' elsif is_a? TestList ; 'configuration.test_lists' elsif is_a? Test ; 'test_list.test' else fault "Could not determine type of '#{full_name}' in order to make 'inherit' call" end end