Class: Wizardly::Wizard::Button
- Inherits:
-
Object
- Object
- Wizardly::Wizard::Button
- Includes:
- TextHelpers
- Defined in:
- lib/wizardly/wizard/button.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(id, name = nil) ⇒ Button
constructor
A new instance of Button.
-
#name_to(name, opts = {}) ⇒ Object
used in the dsl.
- #user_defined? ⇒ Boolean
Constructor Details
#initialize(id, name = nil) ⇒ Button
Returns a new instance of Button.
10 11 12 13 14 |
# File 'lib/wizardly/wizard/button.rb', line 10 def initialize(id, name=nil) @id = id @name = name || (id) @user_defined = false end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/wizardly/wizard/button.rb', line 8 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/wizardly/wizard/button.rb', line 7 def name @name end |
Instance Method Details
#name_to(name, opts = {}) ⇒ Object
used in the dsl
19 20 21 22 23 24 25 |
# File 'lib/wizardly/wizard/button.rb', line 19 def name_to(name, opts={}) case name when String then @name = name.strip.squeeze(' ') when Symbol then @name = (name) end @id = opts[:id] if (opts[:id] && opts[:id].is_a?(Symbol)) end |
#user_defined? ⇒ Boolean
16 |
# File 'lib/wizardly/wizard/button.rb', line 16 def user_defined?; @user_defined; end |