Class: EnumeratedAttribute::MethodDefinition
- Inherits:
-
Object
- Object
- EnumeratedAttribute::MethodDefinition
- Defined in:
- lib/enumerated_attribute/method_definition_dsl.rb
Instance Attribute Summary collapse
-
#argument ⇒ Object
Returns the value of attribute argument.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#negated ⇒ Object
Returns the value of attribute negated.
Instance Method Summary collapse
- #has_argument? ⇒ Boolean
- #has_method_name? ⇒ Boolean
-
#initialize(name, arg, negated = false) ⇒ MethodDefinition
constructor
A new instance of MethodDefinition.
- #is_predicate_method? ⇒ Boolean
Constructor Details
#initialize(name, arg, negated = false) ⇒ MethodDefinition
Returns a new instance of MethodDefinition.
6 7 8 |
# File 'lib/enumerated_attribute/method_definition_dsl.rb', line 6 def initialize(name, arg, negated=false) @method_name, @negated, @argument = name, negated, arg end |
Instance Attribute Details
#argument ⇒ Object
Returns the value of attribute argument.
4 5 6 |
# File 'lib/enumerated_attribute/method_definition_dsl.rb', line 4 def argument @argument end |
#method_name ⇒ Object
Returns the value of attribute method_name.
4 5 6 |
# File 'lib/enumerated_attribute/method_definition_dsl.rb', line 4 def method_name @method_name end |
#negated ⇒ Object
Returns the value of attribute negated.
4 5 6 |
# File 'lib/enumerated_attribute/method_definition_dsl.rb', line 4 def negated @negated end |
Instance Method Details
#has_argument? ⇒ Boolean
12 |
# File 'lib/enumerated_attribute/method_definition_dsl.rb', line 12 def has_argument?; !!@argument; end |
#has_method_name? ⇒ Boolean
11 |
# File 'lib/enumerated_attribute/method_definition_dsl.rb', line 11 def has_method_name?; !!@method_name; end |
#is_predicate_method? ⇒ Boolean
10 |
# File 'lib/enumerated_attribute/method_definition_dsl.rb', line 10 def is_predicate_method?; @method_name[-1, 1] == '?'; end |