Class: Clamp::Attribute
- Inherits:
-
Object
- Object
- Clamp::Attribute
- Defined in:
- lib/wpb/clamp/attribute.rb
Instance Attribute Summary collapse
-
#attribute_name ⇒ Object
readonly
Returns the value of attribute attribute_name.
-
#default_value ⇒ Object
readonly
Returns the value of attribute default_value.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
- #default_method ⇒ Object
- #help ⇒ Object
- #help_rhs ⇒ Object
- #ivar_name ⇒ Object
- #read_method ⇒ Object
- #write_method ⇒ Object
Instance Attribute Details
#attribute_name ⇒ Object (readonly)
Returns the value of attribute attribute_name.
5 6 7 |
# File 'lib/wpb/clamp/attribute.rb', line 5 def attribute_name @attribute_name end |
#default_value ⇒ Object (readonly)
Returns the value of attribute default_value.
5 6 7 |
# File 'lib/wpb/clamp/attribute.rb', line 5 def default_value @default_value end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/wpb/clamp/attribute.rb', line 5 def description @description end |
Instance Method Details
#default_method ⇒ Object
27 28 29 |
# File 'lib/wpb/clamp/attribute.rb', line 27 def default_method "default_#{read_method}" end |
#help ⇒ Object
15 16 17 |
# File 'lib/wpb/clamp/attribute.rb', line 15 def help [help_lhs, help_rhs] end |
#help_rhs ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/wpb/clamp/attribute.rb', line 7 def help_rhs rhs = description if defined?(@default_value) rhs += " (default: #{@default_value.inspect})" end rhs end |
#ivar_name ⇒ Object
19 20 21 |
# File 'lib/wpb/clamp/attribute.rb', line 19 def ivar_name "@#{attribute_name}" end |
#read_method ⇒ Object
23 24 25 |
# File 'lib/wpb/clamp/attribute.rb', line 23 def read_method attribute_name end |
#write_method ⇒ Object
31 32 33 |
# File 'lib/wpb/clamp/attribute.rb', line 31 def write_method "#{attribute_name}=" end |