Class: Construqt::Flavour::Ciscian::SingleValueVerb
- Inherits:
-
Object
- Object
- Construqt::Flavour::Ciscian::SingleValueVerb
- Defined in:
- lib/construqt/flavour/ciscian/ciscian.rb
Instance Attribute Summary collapse
-
#section ⇒ Object
Returns the value of attribute section.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #add(value) ⇒ Object
-
#initialize(section) ⇒ SingleValueVerb
constructor
A new instance of SingleValueVerb.
- #no ⇒ Object
- #serialize ⇒ Object
Constructor Details
#initialize(section) ⇒ SingleValueVerb
Returns a new instance of SingleValueVerb.
128 129 130 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 128 def initialize(section) self.section=section end |
Instance Attribute Details
#section ⇒ Object
Returns the value of attribute section.
127 128 129 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 127 def section @section end |
#value ⇒ Object
Returns the value of attribute value.
127 128 129 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 127 def value @value end |
Class Method Details
.compare(nu, old) ⇒ Object
136 137 138 139 140 141 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 136 def self.compare(nu, old) return [nu] unless old return [old.no] unless nu return [nu] unless nu.serialize == old.serialize [nil] end |
.parse_line(line, lines, section, result) ⇒ Object
153 154 155 156 157 158 159 160 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 153 def self.parse_line(line, lines, section, result) regexp = line.to_s.strip.end_with?("\"") ? /^(.*) (\"[^"]+\")$/ : /^(.*) ([^\s"]+)$/ if (line.to_s.strip =~ regexp) section.add($1, Ciscian::SingleValueVerb).add($2) else section.add(line.to_s, Ciscian::SingleValueVerb) end end |
Instance Method Details
#add(value) ⇒ Object
143 144 145 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 143 def add(value) self.value=value end |
#no ⇒ Object
147 148 149 150 151 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 147 def no @no="no" self.value=nil self end |
#serialize ⇒ Object
132 133 134 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 132 def serialize [[@no, section , value].compact.join(" ")] end |