Class: Inch::Language::Ruby::CodeObject::MethodParameterObject

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/language/ruby/code_object/method_parameter_object.rb

Overview

Proxy class for method parameters

Constant Summary collapse

BAD_NAME_EXCEPTIONS =
%w(id)
BAD_NAME_THRESHOLD =
3

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ MethodParameterObject


7
8
9
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 7

def initialize(attributes)
  @attributes = attributes
end

Instance Method Details

#[](key) ⇒ Object


11
12
13
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 11

def [](key)
  @attributes[key]
end

#bad_name?Boolean


20
21
22
23
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 20

def bad_name?
  return false if BAD_NAME_EXCEPTIONS.include?(name)
  name.size < BAD_NAME_THRESHOLD || name =~ /[0-9]$/
end

#block?Boolean


26
27
28
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 26

def block?
  self[:block?]
end

#described?Boolean


31
32
33
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 31

def described?
  self[:described?]
end

#mentioned?Boolean


36
37
38
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 36

def mentioned?
  self[:mentioned?]
end

#nameObject Also known as: fullname


40
41
42
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 40

def name
  self[:name]
end

#splat?Boolean


46
47
48
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 46

def splat?
  self[:splat?]
end

#typed?Boolean


51
52
53
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 51

def typed?
  self[:typed?]
end

#wrongly_mentioned?Boolean


57
58
59
# File 'lib/inch/language/ruby/code_object/method_parameter_object.rb', line 57

def wrongly_mentioned?
  self[:wrongly_mentioned?]
end