Class: Gendalf::WizardModel

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Serialization, ActiveModel::Validations
Defined in:
lib/models/wizard_model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stepObject

Returns the value of attribute step.



7
8
9
# File 'lib/models/wizard_model.rb', line 7

def step
  @step
end

Class Method Details

.define_null_step(step_no) ⇒ Object Also known as: define_final_step



24
25
26
27
# File 'lib/models/wizard_model.rb', line 24

def define_null_step(step_no)
  define_step step_no, [] do
  end
end

.define_step(step_no, step_attributes, &validations_block) ⇒ Object

Defines a step



17
18
19
20
21
22
# File 'lib/models/wizard_model.rb', line 17

def define_step(step_no, step_attributes, &validations_block)
  define_attributes step_attributes

  @steps ||= []
  @steps[step_no] = step_model_class(step_no, step_attributes, &validations_block)
end

.stepsObject



31
32
33
# File 'lib/models/wizard_model.rb', line 31

def steps
  @steps
end

Instance Method Details

#merge_step!(step_model) ⇒ Object



9
10
11
12
13
# File 'lib/models/wizard_model.rb', line 9

def merge_step!(step_model)
  step_model.class.step_attributes.each do |attrib|
    send("#{attrib}=", step_model.send(attrib))
  end
end