Class: Clamp::Attribute
- Inherits:
-
Object
- Object
- Clamp::Attribute
- Defined in:
- lib/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.
-
#environment_variable ⇒ Object
readonly
Returns the value of attribute environment_variable.
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/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/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/clamp/attribute.rb', line 5 def description @description end |
#environment_variable ⇒ Object (readonly)
Returns the value of attribute environment_variable.
5 6 7 |
# File 'lib/clamp/attribute.rb', line 5 def environment_variable @environment_variable end |
Instance Method Details
#default_method ⇒ Object
30 31 32 |
# File 'lib/clamp/attribute.rb', line 30 def default_method "default_#{read_method}" end |
#help ⇒ Object
18 19 20 |
# File 'lib/clamp/attribute.rb', line 18 def help [help_lhs, help_rhs] end |
#help_rhs ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/clamp/attribute.rb', line 7 def help_rhs rhs = description if defined?(@default_value) rhs += " (default: #{@default_value.inspect})" end if defined?(@environment_variable) rhs += " (env: #{@environment_variable.inspect})" end rhs end |
#ivar_name ⇒ Object
22 23 24 |
# File 'lib/clamp/attribute.rb', line 22 def ivar_name "@#{attribute_name}" end |
#read_method ⇒ Object
26 27 28 |
# File 'lib/clamp/attribute.rb', line 26 def read_method attribute_name end |
#write_method ⇒ Object
34 35 36 |
# File 'lib/clamp/attribute.rb', line 34 def write_method "#{attribute_name}=" end |