Class: Orchparty::CommonBuilder

Inherits:
Builder
  • Object
show all
Defined in:
lib/orchparty/dsl_parser.rb

Direct Known Subclasses

AllBuilder, ServiceBuilder

Instance Method Summary collapse

Methods inherited from Builder

build

Constructor Details

#initializeCommonBuilder

Returns a new instance of CommonBuilder.



170
171
172
# File 'lib/orchparty/dsl_parser.rb', line 170

def initialize
  @service = AST::Node.new(_mix: [])
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *values, &block) ⇒ Object



178
179
180
181
182
183
184
# File 'lib/orchparty/dsl_parser.rb', line 178

def method_missing(name, *values, &block)
  if block_given?
    @service[name] = HashBuilder.build(block)
  else
    @service[name] = values.first
  end
end

Instance Method Details

#_buildObject



186
187
188
# File 'lib/orchparty/dsl_parser.rb', line 186

def _build
  @service
end

#mix(name) ⇒ Object



174
175
176
# File 'lib/orchparty/dsl_parser.rb', line 174

def mix(name)
  @service._mix << name
end

#variables(&block) ⇒ Object



190
191
192
193
# File 'lib/orchparty/dsl_parser.rb', line 190

def variables(&block)
  @service._variables = HashBuilder.build(block)
  self
end