Class: ReVIEW::Line

Inherits:
Object show all
Defined in:
lib/review/preprocessor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number, string) ⇒ Line



354
355
356
357
# File 'lib/review/preprocessor.rb', line 354

def initialize(number, string)
  @number = number
  @string = string
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



359
360
361
# File 'lib/review/preprocessor.rb', line 359

def number
  @number
end

#stringObject (readonly) Also known as: to_s

Returns the value of attribute string.



360
361
362
# File 'lib/review/preprocessor.rb', line 360

def string
  @string
end

Instance Method Details

#editObject



363
364
365
# File 'lib/review/preprocessor.rb', line 363

def edit
  self.class.new(@number, yield(@string))
end

#empty?Boolean



367
368
369
# File 'lib/review/preprocessor.rb', line 367

def empty?
  @string.strip.empty?
end

#num_indentObject



371
372
373
# File 'lib/review/preprocessor.rb', line 371

def num_indent
  @string.slice(/\A\s*/).size
end