Class: Packcr::Parser::Capture

Inherits:
Object
  • Object
show all
Defined in:
lib/packcr/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range_start = 0, range_end = 0, start_loc = nil, end_loc = nil) ⇒ Capture

Returns a new instance of Capture.



4533
4534
4535
4536
4537
4538
# File 'lib/packcr/parser.rb', line 4533

def initialize(range_start = 0, range_end = 0, start_loc = nil, end_loc = nil)
  @range_start = range_start
  @range_end = range_end
  @start_loc = start_loc || Location.new
  @end_loc = end_loc || Location.new
end

Instance Attribute Details

#end_locObject

Returns the value of attribute end_loc.



4531
4532
4533
# File 'lib/packcr/parser.rb', line 4531

def end_loc
  @end_loc
end

#range_endObject

Returns the value of attribute range_end.



4530
4531
4532
# File 'lib/packcr/parser.rb', line 4530

def range_end
  @range_end
end

#range_startObject

Returns the value of attribute range_start.



4530
4531
4532
# File 'lib/packcr/parser.rb', line 4530

def range_start
  @range_start
end

#start_locObject

Returns the value of attribute start_loc.



4531
4532
4533
# File 'lib/packcr/parser.rb', line 4531

def start_loc
  @start_loc
end

Instance Method Details

#capture_string(buffer) ⇒ Object



4540
4541
4542
# File 'lib/packcr/parser.rb', line 4540

def capture_string(buffer)
  @string ||= buffer[@range_start, @range_end - @range_start]
end