Class: Rubyang::Database::SchemaTree::Bit
- Inherits:
-
Object
- Object
- Rubyang::Database::SchemaTree::Bit
- Defined in:
- lib/rubyang/database/schema_tree.rb
Instance Method Summary collapse
-
#initialize ⇒ Bit
constructor
A new instance of Bit.
- #update(arg) ⇒ Object
- #valid?(value) ⇒ Boolean
Constructor Details
#initialize ⇒ Bit
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
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 |