Class: Rubyang::Database::SchemaTree::Pattern

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

Instance Method Summary collapse

Constructor Details

#initializePattern

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_sObject



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

Returns:

  • (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