Class: Hashira::Smells::MethodContext
- Inherits:
-
Data
- Object
- Data
- Hashira::Smells::MethodContext
- Defined in:
- lib/hashira/smells/contexts.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#section ⇒ Object
readonly
Returns the value of attribute section.
Instance Method Summary collapse
- #arguments ⇒ Object
- #line ⇒ Object
- #mixin? ⇒ Boolean
- #parameters ⇒ Object
- #public? ⇒ Boolean
- #singleton? ⇒ Boolean
- #site ⇒ Object
- #subject ⇒ Object
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file
34 35 36 |
# File 'lib/hashira/smells/contexts.rb', line 34 def file @file end |
#node ⇒ Object (readonly)
Returns the value of attribute node
34 35 36 |
# File 'lib/hashira/smells/contexts.rb', line 34 def node @node end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner
34 35 36 |
# File 'lib/hashira/smells/contexts.rb', line 34 def owner @owner end |
#section ⇒ Object (readonly)
Returns the value of attribute section
34 35 36 |
# File 'lib/hashira/smells/contexts.rb', line 34 def section @section end |
Instance Method Details
#arguments ⇒ Object
48 |
# File 'lib/hashira/smells/contexts.rb', line 48 def arguments = Parameters.arguments(node) |
#line ⇒ Object
38 |
# File 'lib/hashira/smells/contexts.rb', line 38 def line = node.location.start_line |
#mixin? ⇒ Boolean
42 |
# File 'lib/hashira/smells/contexts.rb', line 42 def mixin? = section == :module_function |
#parameters ⇒ Object
46 |
# File 'lib/hashira/smells/contexts.rb', line 46 def parameters = Parameters.names(node) |
#public? ⇒ Boolean
44 |
# File 'lib/hashira/smells/contexts.rb', line 44 def public? = section == :public && !singleton? |
#singleton? ⇒ Boolean
40 |
# File 'lib/hashira/smells/contexts.rb', line 40 def singleton? = node.receiver.is_a?(Prism::Node) || section == :singleton |
#site ⇒ Object
50 |
# File 'lib/hashira/smells/contexts.rb', line 50 def site = "#{file}:#{line}" |
#subject ⇒ Object
36 |
# File 'lib/hashira/smells/contexts.rb', line 36 def subject = "#{owner}#{singleton? ? "." : "#"}#{node.name}" |