Class: Rubyang::Database::SchemaTree::StringType

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

Instance Attribute Summary collapse

Attributes inherited from Type

#arg

Instance Method Summary collapse

Constructor Details

#initializeStringType

Returns a new instance of StringType.



41
42
43
44
45
# File 'lib/rubyang/database/schema_tree.rb', line 41

def initialize
  @arg = 'string'
  @length = Length.new
  @pattern = Pattern.new
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



40
41
42
# File 'lib/rubyang/database/schema_tree.rb', line 40

def length
  @length
end

#patternObject (readonly)

Returns the value of attribute pattern.



40
41
42
# File 'lib/rubyang/database/schema_tree.rb', line 40

def pattern
  @pattern
end

Instance Method Details

#update_length(arg) ⇒ Object



46
47
48
# File 'lib/rubyang/database/schema_tree.rb', line 46

def update_length arg
  @length.update arg
end

#update_pattern(arg) ⇒ Object



49
50
51
# File 'lib/rubyang/database/schema_tree.rb', line 49

def update_pattern arg
  @pattern.update arg
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
# File 'lib/rubyang/database/schema_tree.rb', line 52

def valid? value
  result = true
  result &&= @length.valid? value
  result &&= @pattern.valid? value
  result
end