Class: Parse::Conf::ParserHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/conf/parser_helper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ ParserHelper

Returns a new instance of ParserHelper.



6
7
8
# File 'lib/parse/conf/parser_helper.rb', line 6

def initialize(string)
  @string = string
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



4
5
6
# File 'lib/parse/conf/parser_helper.rb', line 4

def string
  @string
end

Class Method Details

.trim_and_remove_ugly_symbol(string) ⇒ Object



10
11
12
13
14
15
# File 'lib/parse/conf/parser_helper.rb', line 10

def self.trim_and_remove_ugly_symbol(string)
  obj = new(string)
  obj.trim!
  obj.remove_ugly_symbol!
  obj.string
end

Instance Method Details

#remove_ugly_symbol!Object



21
22
23
# File 'lib/parse/conf/parser_helper.rb', line 21

def remove_ugly_symbol!
  string.gsub!(/(\[|\])/, '')
end

#trim!Object



17
18
19
# File 'lib/parse/conf/parser_helper.rb', line 17

def trim!
  string.strip!
end