Class: Fasterer::MethodDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/fasterer/method_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ MethodDefinition

Returns a new instance of MethodDefinition.



8
9
10
11
12
13
14
15
16
17
# File 'lib/fasterer/method_definition.rb', line 8

def initialize(element)
  @element = element # Ripper element
  set_method_name
  set_body

  if arguments_element.any?
    set_argument_names
    set_block_argument_name
  end
end

Instance Attribute Details

#block_argument_nameObject (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

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/fasterer/method_definition.rb', line 6

def body
  @body
end

#elementObject (readonly)

for testing purposes



3
4
5
# File 'lib/fasterer/method_definition.rb', line 3

def element
  @element
end

#method_nameObject (readonly)

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

Returns:

  • (Boolean)


19
20
21
# File 'lib/fasterer/method_definition.rb', line 19

def has_block?
  !!@block_argument_name
end