Class: Inch::Language::Nodejs::CodeObject::FunctionObject

Inherits:
Base show all
Defined in:
lib/inch/language/nodejs/code_object/function_object.rb

Overview

Proxy class for functions

Constant Summary collapse

MANY_PARAMETERS_THRESHOLD =
3

Instance Attribute Summary

Attributes inherited from CodeObject::Proxy

#object_lookup

Instance Method Summary collapse

Methods inherited from Base

#alias?, #aliased_object, #api_tag?, #children, #constant?, #core?, #depth, #docstring, #filename, #files, #fullname, #has_alias?, #has_children?, #has_code_example?, #has_doc?, #has_multiple_code_examples?, #has_unconsidered_tags?, #in_root?, #language, #method?, #name, #namespace?, #nodoc?, #original_docstring, #parent, #private?, #protected?, #public?, #tagged_as_internal_api?, #tagged_as_private?, #type, #unconsidered_tag_count, #undocumented?, #visibility

Methods inherited from CodeObject::Proxy

#[], for, #initialize, #inspect, #language, #marshal_dump, #marshal_load

Constructor Details

This class inherits a constructor from Inch::CodeObject::Proxy

Instance Method Details

#bang_name?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 9

def bang_name?
  self[:bang_name?]
end

#getter?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 13

def getter?
  self[:getter?]
end

#has_many_lines?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 26

def has_many_lines?
  false
end

#has_many_parameters?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 22

def has_many_parameters?
  parameters.size > MANY_PARAMETERS_THRESHOLD
end

#has_parameters?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 17

def has_parameters?
  !parameters.empty?
end

#overridden?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 40

def overridden?
  self[:overridden?]
end

#overridden_methodObject



44
45
46
47
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 44

def overridden_method
  @overridden_method ||=
    object_lookup.find(self[:overridden_method_fullname])
end

#parameter(name) ⇒ Object



30
31
32
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 30

def parameter(name)
  parameters.find { |p| p.name == name.to_s }
end

#parametersObject



34
35
36
37
38
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 34

def parameters
  @parameters ||= self[:parameters].map do |param_attr|
    FunctionParameterObject.new(param_attr)
  end
end

#questioning_name?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 69

def questioning_name?
  self[:questioning_name?]
end

#return_described?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 53

def return_described?
  self[:return_described?]
end

#return_mentioned?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 49

def return_mentioned?
  self[:return_mentioned?]
end

#return_typed?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 57

def return_typed?
  self[:return_typed?]
end

#setter?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 61

def setter?
  self[:setter?]
end

#sourceObject



65
66
67
# File 'lib/inch/language/nodejs/code_object/function_object.rb', line 65

def source
  self[:source?]
end