Class: Hashira::Smells::TypeContext

Inherits:
Data
  • Object
show all
Defined in:
lib/hashira/smells/contexts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assigned: nil, **rest) ⇒ TypeContext

Returns a new instance of TypeContext.



55
# File 'lib/hashira/smells/contexts.rb', line 55

def initialize(assigned: nil, **rest) = super

Instance Attribute Details

#assignedObject (readonly)

Returns the value of attribute assigned

Returns:

  • (Object)

    the current value of assigned



53
54
55
# File 'lib/hashira/smells/contexts.rb', line 53

def assigned
  @assigned
end

#defsObject (readonly)

Returns the value of attribute defs

Returns:

  • (Object)

    the current value of defs



53
54
55
# File 'lib/hashira/smells/contexts.rb', line 53

def defs
  @defs
end

#fileObject (readonly)

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



53
54
55
# File 'lib/hashira/smells/contexts.rb', line 53

def file
  @file
end

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



53
54
55
# File 'lib/hashira/smells/contexts.rb', line 53

def kind
  @kind
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



53
54
55
# File 'lib/hashira/smells/contexts.rb', line 53

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



53
54
55
# File 'lib/hashira/smells/contexts.rb', line 53

def node
  @node
end

Instance Method Details

#lineObject



57
# File 'lib/hashira/smells/contexts.rb', line 57

def line = node.location.start_line

#ownedObject



61
# File 'lib/hashira/smells/contexts.rb', line 61

def owned = defs.reject(&:singleton?)

#siteObject



63
# File 'lib/hashira/smells/contexts.rb', line 63

def site = "#{file}:#{line}"

#subjectObject



59
# File 'lib/hashira/smells/contexts.rb', line 59

def subject = name