Class: ConditionsFu::Lathe

Inherits:
Object
  • Object
show all
Defined in:
lib/conditions_fu/builder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_params) ⇒ Lathe

Returns a new instance of Lathe.



38
39
40
41
# File 'lib/conditions_fu/builder.rb', line 38

def initialize(_params)
  @params = _params
  @conditions = ConditionsArray.new
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



36
37
38
# File 'lib/conditions_fu/builder.rb', line 36

def conditions
  @conditions
end

Class Method Details

.run(*args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/conditions_fu/builder.rb', line 25

def self.run(*args)
  blueprint = Builder.blueprint
  if args.first.is_a?(Symbol)
    named_blueprint = Builder.blueprint(args.shift) 
    raise "No blueprint found" if named_blueprint.nil?
  end
  lathe = self.new(args.shift)
  lathe.instance_eval(&named_blueprint) if named_blueprint
  lathe.conditions.create_active_record_conditions
end

Instance Method Details

#paramsObject



43
44
45
# File 'lib/conditions_fu/builder.rb', line 43

def params
  @params
end