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.



102
103
104
105
106
# File 'lib/rubyang/database/schema_tree.rb', line 102

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

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



101
102
103
# File 'lib/rubyang/database/schema_tree.rb', line 101

def length
  @length
end

#patternObject (readonly)

Returns the value of attribute pattern.



101
102
103
# File 'lib/rubyang/database/schema_tree.rb', line 101

def pattern
  @pattern
end

Instance Method Details

#update_length(arg) ⇒ Object



107
108
109
# File 'lib/rubyang/database/schema_tree.rb', line 107

def update_length arg
  @length.update arg
end

#update_pattern(arg) ⇒ Object



110
111
112
# File 'lib/rubyang/database/schema_tree.rb', line 110

def update_pattern arg
  @pattern.update arg
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


113
114
115
116
117
118
# File 'lib/rubyang/database/schema_tree.rb', line 113

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