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.



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

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

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



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

def ast
  @ast
end

#bufferObject (readonly)

Returns the value of attribute buffer.



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

def buffer
  @buffer
end

#errorObject (readonly)

Returns the value of attribute error.



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

def error
  @error
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Class Method Details

.from_file(path) ⇒ Object



17
18
19
20
# File 'lib/transpec/processed_source.rb', line 17

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

Instance Method Details

#to_sObject



27
28
29
# File 'lib/transpec/processed_source.rb', line 27

def to_s
  buffer.source
end