Class: EacRubyUtils::StringDelimited
- Defined in:
- lib/eac_ruby_utils/string_delimited.rb
Instance Attribute Summary collapse
-
#begin_delimiter ⇒ Object
readonly
Returns the value of attribute begin_delimiter.
-
#end_delimiter ⇒ Object
readonly
Returns the value of attribute end_delimiter.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string, begin_delimiter, end_delimiter) ⇒ StringDelimited
constructor
A new instance of StringDelimited.
- #inner ⇒ Object
- #outer ⇒ Object
- #without_inner ⇒ Object
- #without_outer ⇒ Object
Constructor Details
#initialize(string, begin_delimiter, end_delimiter) ⇒ StringDelimited
Returns a new instance of StringDelimited.
7 8 9 10 11 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 7 def initialize(string, begin_delimiter, end_delimiter) @string = string @begin_delimiter = begin_delimiter @end_delimiter = end_delimiter end |
Instance Attribute Details
#begin_delimiter ⇒ Object (readonly)
Returns the value of attribute begin_delimiter.
5 6 7 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 5 def begin_delimiter @begin_delimiter end |
#end_delimiter ⇒ Object (readonly)
Returns the value of attribute end_delimiter.
5 6 7 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 5 def end_delimiter @end_delimiter end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
5 6 7 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 5 def string @string end |
Instance Method Details
#inner ⇒ Object
13 14 15 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 13 def inner between_indexes(content_index, end_index).to_s end |
#outer ⇒ Object
17 18 19 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 17 def outer between_indexes(begin_index, after_end_index).to_s end |
#without_inner ⇒ Object
21 22 23 24 25 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 21 def without_inner without_join( between_indexes(sos_index, content_index), between_indexes(end_index, eos_index) ) end |
#without_outer ⇒ Object
27 28 29 30 31 32 |
# File 'lib/eac_ruby_utils/string_delimited.rb', line 27 def without_outer without_join( between_indexes(sos_index, begin_index), between_indexes(after_end_index, eos_index) ) end |