Module: BlueprintComponents

Included in:
Blueprint, Aggregate, Dependency, Parameter, Value
Defined in:
lib/blueprint/components.rb

Defined Under Namespace

Classes: Aggregate, Component, Dependency, Parameter, Value

Constant Summary collapse

BLUEPRINT_TRANSLATIONS =
{
  :render_as => :control,
  :type => :item_type
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_child(control) ⇒ Object



131
132
133
134
# File 'lib/blueprint/components.rb', line 131

def add_child(control)
  (@def[:children] ||= []) << control.definition
  control
end

Instance Method Details

#aggregate(*args) {|aggregate| ... } ⇒ Object

Yields:



119
120
121
122
123
# File 'lib/blueprint/components.rb', line 119

def aggregate(*args, &block)
  aggregate = Aggregate.new(*args)
  yield aggregate if block_given?
  add_child aggregate
end

#definitionObject



125
126
127
# File 'lib/blueprint/components.rb', line 125

def definition
  @def
end

#dependency(*args) {|dep| ... } ⇒ Object

Yields:

  • (dep)


108
109
110
111
112
# File 'lib/blueprint/components.rb', line 108

def dependency(*args, &block)
  dep = Dependency.new(*args)
  yield dep if block_given?
  add_child dep
end

#no_op(*args, &block) ⇒ Object



114
115
116
117
# File 'lib/blueprint/components.rb', line 114

def no_op(*args, &block)
  opts = args.last.is_a?(Hash) ? args.pop : {}
  dependency nil, { :label => args.pop }.merge(opts)
end

#parameter(*args) {|param| ... } ⇒ Object

Yields:

  • (param)


102
103
104
105
106
# File 'lib/blueprint/components.rb', line 102

def parameter(*args, &block)
  param = Parameter.new(*args)
  yield param if block_given?
  add_child param
end