Class: Voom::Presenters::DSL::Components::Stepper

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/stepper.rb

Defined Under Namespace

Classes: Step

Constant Summary collapse

VALID_ORIENTATIONS =
[:vertical, :horizontal]

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ Stepper

Returns a new instance of Stepper.



9
10
11
12
13
14
15
16
# File 'lib/voom/presenters/dsl/components/stepper.rb', line 9

def initialize(**attribs_, &block)
  super(type: :stepper, **attribs_, &block)
  @orientation = attribs.delete(:orientation) {:horizontal}
  raise_parameter_validation "Invalid Orientation Type specified: #{orientation}" unless VALID_ORIENTATIONS.include? orientation
  @linear = attribs.delete(:linear) {true}
  @steps = []
  expand!
end

Instance Attribute Details

#linearObject (readonly)

Returns the value of attribute linear.



6
7
8
# File 'lib/voom/presenters/dsl/components/stepper.rb', line 6

def linear
  @linear
end

#orientationObject (readonly)

Returns the value of attribute orientation.



6
7
8
# File 'lib/voom/presenters/dsl/components/stepper.rb', line 6

def orientation
  @orientation
end

#stepsObject (readonly)

Returns the value of attribute steps.



6
7
8
# File 'lib/voom/presenters/dsl/components/stepper.rb', line 6

def steps
  @steps
end

Instance Method Details

#step(text = nil, **attribs, &block) ⇒ Object



18
19
20
# File 'lib/voom/presenters/dsl/components/stepper.rb', line 18

def step(text = nil, **attribs, &block)
  @steps << Step.new(parent: self, text: text, **attribs, &block)
end