Class: CodeInclusion::Subset::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/polytexnic/code_inclusion.rb

Overview

Return the lines in the named section.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input, args) ⇒ Section

Returns a new instance of Section.



376
377
378
379
# File 'lib/polytexnic/code_inclusion.rb', line 376

def initialize(input, args)
  @input = input
  @name  = args[:section]
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



374
375
376
# File 'lib/polytexnic/code_inclusion.rb', line 374

def input
  @input
end

#nameObject (readonly)

Returns the value of attribute name.



374
375
376
# File 'lib/polytexnic/code_inclusion.rb', line 374

def name
  @name
end

Instance Method Details

#linesObject



381
382
383
384
# File 'lib/polytexnic/code_inclusion.rb', line 381

def lines
  ensure_exists!
  input.slice(index_of_first_line, length)
end