Class: Rubyang::Database::SchemaTree::Bit

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyang/database/schema_tree.rb

Instance Method Summary collapse

Constructor Details

#initializeBit

Returns a new instance of Bit.



374
375
376
# File 'lib/rubyang/database/schema_tree.rb', line 374

def initialize
  @bit = []
end

Instance Method Details

#update(arg) ⇒ Object



385
386
387
388
389
390
# File 'lib/rubyang/database/schema_tree.rb', line 385

def update arg
  if @bit.find{ |b| b == arg }
    raise ArgumentError, "#{arg} is not valid"
  end
  @bit.push arg
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


377
378
379
380
381
382
383
384
# File 'lib/rubyang/database/schema_tree.rb', line 377

def valid? value
  values = value.split( ' ' )
  if values.inject( true ){ |result, v| result && @bit.find{ |b| b == v } }
    true
  else
    false
  end
end