Class: Fasterer::MethodDefinition
- Inherits:
-
Object
- Object
- Fasterer::MethodDefinition
- Defined in:
- lib/fasterer/method_definition.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#block_argument_name ⇒ Object
readonly
Returns the value of attribute block_argument_name.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#element ⇒ Object
readonly
for testing purposes.
-
#method_name ⇒ Object
(also: #name)
readonly
Returns the value of attribute method_name.
Instance Method Summary collapse
- #has_block? ⇒ Boolean
-
#initialize(element) ⇒ MethodDefinition
constructor
A new instance of MethodDefinition.
- #setter? ⇒ Boolean
Constructor Details
#initialize(element) ⇒ MethodDefinition
Returns a new instance of MethodDefinition.
11 12 13 14 15 16 17 |
# File 'lib/fasterer/method_definition.rb', line 11 def initialize(element) @element = element # Ripper element set_method_name set_body set_arguments set_block_argument_name end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
7 8 9 |
# File 'lib/fasterer/method_definition.rb', line 7 def arguments @arguments end |
#block_argument_name ⇒ Object (readonly)
Returns the value of attribute block_argument_name.
5 6 7 |
# File 'lib/fasterer/method_definition.rb', line 5 def block_argument_name @block_argument_name end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/fasterer/method_definition.rb', line 6 def body @body end |
#element ⇒ Object (readonly)
for testing purposes
3 4 5 |
# File 'lib/fasterer/method_definition.rb', line 3 def element @element end |
#method_name ⇒ Object (readonly) Also known as: name
Returns the value of attribute method_name.
4 5 6 |
# File 'lib/fasterer/method_definition.rb', line 4 def method_name @method_name end |
Instance Method Details
#has_block? ⇒ Boolean
19 20 21 |
# File 'lib/fasterer/method_definition.rb', line 19 def has_block? !!@block_argument_name end |
#setter? ⇒ Boolean
23 24 25 |
# File 'lib/fasterer/method_definition.rb', line 23 def setter? name.to_s.end_with?('=') end |