Class: StringDataSource
- Inherits:
-
BaseDataSource
- Object
- BaseDataSource
- StringDataSource
- Defined in:
- lib/data/string_data_source.rb
Instance Attribute Summary
Attributes inherited from BaseDataSource
Instance Method Summary collapse
-
#initialize(s) ⇒ StringDataSource
constructor
A new instance of StringDataSource.
- #numberValues ⇒ Object
-
#toString(startOffset, endOffset) ⇒ Object
substring.
- #valueAt(offset) ⇒ Object
Methods inherited from BaseDataSource
#each_with_index, #extendWith, #has_terminator?, #nextDataSourceValueAt, #valueSequence
Constructor Details
#initialize(s) ⇒ StringDataSource
Returns a new instance of StringDataSource.
5 6 7 8 |
# File 'lib/data/string_data_source.rb', line 5 def initialize(s) @s = s super() end |
Instance Method Details
#numberValues ⇒ Object
10 11 12 |
# File 'lib/data/string_data_source.rb', line 10 def numberValues return @s.length end |
#toString(startOffset, endOffset) ⇒ Object
substring
24 25 26 27 28 29 30 |
# File 'lib/data/string_data_source.rb', line 24 def toString(startOffset, endOffset) if (endOffset >= startOffset) then return @s[startOffset..endOffset] else return @s[startOffset..(@s.length - 1)] end end |
#valueAt(offset) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/data/string_data_source.rb', line 14 def valueAt(offset) value = @s[ offset - @startOffset ] if (value == nil) then return self.nextDataSourceValueAt(offset) else return value end end |