Class: PrivatePlease::Tracking::MethodDetails

Inherits:
Struct
  • Object
show all
Defined in:
lib/private_please/tracking/method_details.rb

Constant Summary collapse

METHOD_AS_KEY_PATTERN =
/(?<klass>.*)
 (?<separator>[#.])
 (?<method>.*)
/x

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#klassObject

Returns the value of attribute klass

Returns:

  • (Object)

    the current value of klass



6
7
8
# File 'lib/private_please/tracking/method_details.rb', line 6

def klass
  @klass
end

#linenoObject

Returns the value of attribute lineno

Returns:

  • (Object)

    the current value of lineno



6
7
8
# File 'lib/private_please/tracking/method_details.rb', line 6

def lineno
  @lineno
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



6
7
8
# File 'lib/private_please/tracking/method_details.rb', line 6

def method
  @method
end

#separatorObject

Returns the value of attribute separator

Returns:

  • (Object)

    the current value of separator



6
7
8
# File 'lib/private_please/tracking/method_details.rb', line 6

def separator
  @separator
end

#source_pathObject

Returns the value of attribute source_path

Returns:

  • (Object)

    the current value of source_path



6
7
8
# File 'lib/private_please/tracking/method_details.rb', line 6

def source_path
  @source_path
end

Class Method Details

.from_class_plus_method(class_plus_method) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/private_please/tracking/method_details.rb', line 12

def self.from_class_plus_method(class_plus_method)
  md = class_plus_method.match(METHOD_AS_KEY_PATTERN)
  klass     = Object.const_get(md[:klass])
  separator = md[:separator]
  method    = md[:method].to_sym
  source_path, lineno = Utils::SourceFileUtils.source_path_and_lineno(klass, separator, method)

  new(klass, separator, method, source_path, lineno)
end

Instance Method Details

#separator_plus_methodObject



22
23
24
# File 'lib/private_please/tracking/method_details.rb', line 22

def separator_plus_method
  "#{separator}#{method}"
end