Class: MethodLog::MethodDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/method_log/method_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_file, lines) ⇒ MethodDefinition

Returns a new instance of MethodDefinition.



5
6
7
8
# File 'lib/method_log/method_definition.rb', line 5

def initialize(source_file, lines)
  @source_file = source_file
  @lines = lines
end

Instance Attribute Details

#source_fileObject (readonly)

Returns the value of attribute source_file.



3
4
5
# File 'lib/method_log/method_definition.rb', line 3

def source_file
  @source_file
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/method_log/method_definition.rb', line 10

def ==(other)
  (source_file == other.source_file) && (lines == other.lines)
end

#hashObject



14
15
16
# File 'lib/method_log/method_definition.rb', line 14

def hash
  [source_file, lines].hash
end

#sourceObject



18
19
20
# File 'lib/method_log/method_definition.rb', line 18

def source
  source_file.snippet(lines)
end