Class: Transpec::ProcessedSource

Inherits:
Object
  • Object
show all
Defined in:
lib/transpec/processed_source.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, path = nil) ⇒ ProcessedSource

Returns a new instance of ProcessedSource.



19
20
21
22
# File 'lib/transpec/processed_source.rb', line 19

def initialize(source, path = nil)
  @path = path
  parse(source)
end

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



12
13
14
# File 'lib/transpec/processed_source.rb', line 12

def ast
  @ast
end

#bufferObject (readonly)

Returns the value of attribute buffer.



12
13
14
# File 'lib/transpec/processed_source.rb', line 12

def buffer
  @buffer
end

#errorObject (readonly)

Returns the value of attribute error.



12
13
14
# File 'lib/transpec/processed_source.rb', line 12

def error
  @error
end

#pathObject (readonly)

Returns the value of attribute path.



12
13
14
# File 'lib/transpec/processed_source.rb', line 12

def path
  @path
end

Class Method Details

.from_file(path) ⇒ Object



14
15
16
17
# File 'lib/transpec/processed_source.rb', line 14

def self.from_file(path)
  source = File.read(path)
  new(source, path)
end

Instance Method Details

#to_sObject



24
25
26
# File 'lib/transpec/processed_source.rb', line 24

def to_s
  buffer.source
end