Class: Rubyang::Database::SchemaTree::Enum
- Inherits:
-
Object
- Object
- Rubyang::Database::SchemaTree::Enum
- Defined in:
- lib/rubyang/database/schema_tree.rb
Instance Method Summary collapse
-
#initialize ⇒ Enum
constructor
A new instance of Enum.
- #update(arg) ⇒ Object
- #valid?(value) ⇒ Boolean
Constructor Details
#initialize ⇒ Enum
Returns a new instance of Enum.
356 357 358 |
# File 'lib/rubyang/database/schema_tree.rb', line 356 def initialize @enum = [] end |
Instance Method Details
#update(arg) ⇒ Object
366 367 368 369 370 371 |
# File 'lib/rubyang/database/schema_tree.rb', line 366 def update arg if @enum.find{ |e| e == arg } raise ArgumentError, "#{arg} is not valid" end @enum.push arg end |
#valid?(value) ⇒ Boolean
359 360 361 362 363 364 365 |
# File 'lib/rubyang/database/schema_tree.rb', line 359 def valid? value if @enum.find{ |e| e == value } true else false end end |