Class: Wizard::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/wizard/step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Step

Returns a new instance of Step.



8
9
10
11
# File 'lib/wizard/step.rb', line 8

def initialize(id)
  @id = id
  @fields = []
end

Instance Attribute Details

#description_varsObject

Returns the value of attribute description_vars.



6
7
8
# File 'lib/wizard/step.rb', line 6

def description_vars
  @description_vars
end

#disabledObject

Returns the value of attribute disabled.



6
7
8
# File 'lib/wizard/step.rb', line 6

def disabled
  @disabled
end

#emojiObject

Returns the value of attribute emoji.



6
7
8
# File 'lib/wizard/step.rb', line 6

def emoji
  @emoji
end

#fieldsObject

Returns the value of attribute fields.



6
7
8
# File 'lib/wizard/step.rb', line 6

def fields
  @fields
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/wizard/step.rb', line 5

def id
  @id
end

#indexObject

Returns the value of attribute index.



6
7
8
# File 'lib/wizard/step.rb', line 6

def index
  @index
end

#nextObject

Returns the value of attribute next.



6
7
8
# File 'lib/wizard/step.rb', line 6

def next
  @next
end

#previousObject

Returns the value of attribute previous.



6
7
8
# File 'lib/wizard/step.rb', line 6

def previous
  @previous
end

#updaterObject (readonly)

Returns the value of attribute updater.



5
6
7
# File 'lib/wizard/step.rb', line 5

def updater
  @updater
end

Instance Method Details

#add_field(attrs) ⇒ Object



13
14
15
16
17
18
# File 'lib/wizard/step.rb', line 13

def add_field(attrs)
  field = Field.new(attrs)
  field.step = self
  @fields << field
  field
end

#has_fields?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/wizard/step.rb', line 20

def has_fields?
  @fields.present?
end

#on_update(&block) ⇒ Object



24
25
26
# File 'lib/wizard/step.rb', line 24

def on_update(&block)
  @updater = block
end