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.



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

#sectionObject

Returns the value of attribute section.



328
329
330
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 328

def section
  @section
end

#valuesObject

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

#noObject



340
341
342
343
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 340

def no
  @no="no "
  self
end

#serializeObject



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

#yesObject



345
346
347
348
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 345

def yes
  @no=nil
  self
end