Class: Construqt::Flavour::Ciscian::RangeVerb

Inherits:
Object
  • Object
show all
Defined in:
lib/construqt/flavour/ciscian/ciscian.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section) ⇒ RangeVerb

Returns a new instance of RangeVerb.



298
299
300
301
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 298

def initialize(section)
  self.section=section
  self.values = []
end

Instance Attribute Details

#sectionObject

Returns the value of attribute section.



297
298
299
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 297

def section
  @section
end

#valuesObject

Returns the value of attribute values.



297
298
299
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 297

def values
  @values
end

Class Method Details

.compare(nu, old) ⇒ Object



314
315
316
317
318
319
320
321
322
323
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 314

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



303
304
305
306
307
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 303

def add(value)
  throw "must be a number \'#{value}\'" unless /^\d+$/.match(value.to_s)
  self.values << value.to_i
  self
end

#noObject



309
310
311
312
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 309

def no
  @no="no "
  self
end

#serializeObject



325
326
327
328
329
330
331
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 325

def serialize
  if @no
    ["#{@no}#{section}"]
  else
    ["#{section} #{Construqt::Util.createRangeDefinition(values)}"]
  end
end