Class: Apstrings::KVPair
- Inherits:
-
Object
- Object
- Apstrings::KVPair
- Defined in:
- lib/apstrings/kv_pair.rb
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#raw_comment ⇒ Object
readonly
Returns the value of attribute raw_comment.
Instance Method Summary collapse
- #comment ⇒ Object
-
#initialize(line, comment) ⇒ KVPair
constructor
A new instance of KVPair.
- #key ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(line, comment) ⇒ KVPair
Returns a new instance of KVPair.
5 6 7 8 |
# File 'lib/apstrings/kv_pair.rb', line 5 def initialize(line, comment) @line = line @raw_comment = comment end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
3 4 5 |
# File 'lib/apstrings/kv_pair.rb', line 3 def line @line end |
#raw_comment ⇒ Object (readonly)
Returns the value of attribute raw_comment.
3 4 5 |
# File 'lib/apstrings/kv_pair.rb', line 3 def raw_comment @raw_comment end |
Instance Method Details
#comment ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/apstrings/kv_pair.rb', line 19 def comment if raw_comment.nil? @raw_comment = "" else raw_comment.gsub!(/(\/\*)|(\*\/)/,"") raw_comment.gsub!("\n", " ") raw_comment.gsub!(/\s+/, " ") raw_comment.strip end end |
#key ⇒ Object
10 11 12 |
# File 'lib/apstrings/kv_pair.rb', line 10 def key line.key unless line.key.nil? end |
#value ⇒ Object
14 15 16 17 |
# File 'lib/apstrings/kv_pair.rb', line 14 def value # puts line line.value unless line.key.nil? end |