Class: Construqt::Flavour::Ciscian::RangeVerb
- Inherits:
-
Object
- Object
- Construqt::Flavour::Ciscian::RangeVerb
- Defined in:
- lib/construqt/flavour/ciscian/ciscian.rb
Instance Attribute Summary collapse
-
#section ⇒ Object
Returns the value of attribute section.
-
#values ⇒ Object
Returns the value of attribute values.
Class Method Summary collapse
Instance Method Summary collapse
- #add(value) ⇒ Object
-
#initialize(section) ⇒ RangeVerb
constructor
A new instance of RangeVerb.
- #no ⇒ Object
- #serialize ⇒ Object
- #yes ⇒ Object
Constructor Details
#initialize(section) ⇒ RangeVerb
Returns a new instance of RangeVerb.
329 330 331 332 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 329 def initialize(section) self.section=section self.values = [] end |
Instance Attribute Details
#section ⇒ Object
Returns the value of attribute section.
328 329 330 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 328 def section @section end |
#values ⇒ Object
Returns the value of attribute values.
328 329 330 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 328 def values @values end |
Class Method Details
.compare(nu, old) ⇒ Object
350 351 352 353 354 355 356 357 358 359 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 350 def self.compare(nu, old) return [nu] unless old return [old.no] unless nu throw "classes must match #{nu.class.name} != #{old.class.name}" unless nu.class == old.class if (nu.serialize==old.serialize) [nil] else [nu] end end |
Instance Method Details
#add(value) ⇒ Object
334 335 336 337 338 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 334 def add(value) #throw "must be a number \'#{value}\'" unless /^\d+$/.match(value.to_s) self.values << value #.to_i self end |
#no ⇒ Object
340 341 342 343 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 340 def no @no="no " self end |
#serialize ⇒ Object
361 362 363 364 365 366 367 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 361 def serialize if @no ["#{@no}#{section}"] else ["#{section} #{Construqt::Util.createRangeDefinition(values)}"] end end |
#yes ⇒ Object
345 346 347 348 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 345 def yes @no=nil self end |