Class: Rubyang::Database::SchemaTree::Pattern
- Inherits:
-
Object
- Object
- Rubyang::Database::SchemaTree::Pattern
- Defined in:
- lib/rubyang/database/schema_tree.rb
Instance Method Summary collapse
-
#initialize ⇒ Pattern
constructor
A new instance of Pattern.
- #to_s ⇒ Object
- #update(arg) ⇒ Object
- #valid?(value) ⇒ Boolean
Constructor Details
#initialize ⇒ Pattern
Returns a new instance of Pattern.
337 338 339 |
# File 'lib/rubyang/database/schema_tree.rb', line 337 def initialize @pattern = Regexp.new( '^.*$' ) end |
Instance Method Details
#to_s ⇒ Object
351 352 353 |
# File 'lib/rubyang/database/schema_tree.rb', line 351 def to_s @pattern.inspect end |
#update(arg) ⇒ Object
347 348 349 350 |
# File 'lib/rubyang/database/schema_tree.rb', line 347 def update arg p arg @pattern = Regexp.new( '^' + arg + '$' ) end |
#valid?(value) ⇒ Boolean
340 341 342 343 344 345 346 |
# File 'lib/rubyang/database/schema_tree.rb', line 340 def valid? value if @pattern =~ value true else false end end |