Class: Substring

Inherits:
String show all
Defined in:
lib/adlint/prelude.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#longest_common_substrings_with, #to_default_external

Constructor Details

#initialize(str, idx, len) ⇒ Substring

Returns a new instance of Substring.



189
190
191
192
# File 'lib/adlint/prelude.rb', line 189

def initialize(str, idx, len)
  @range = idx...(idx + len)
  super(str.slice(@range))
end

Instance Attribute Details

#rangeObject (readonly)

Returns the value of attribute range.



194
195
196
# File 'lib/adlint/prelude.rb', line 194

def range
  @range
end