class Rasti::Types::String
Attributes
format[R]
Public Class Methods
[](format)
click to toggle source
# File lib/rasti/types/string.rb, line 8 def [](format) Class.new(self) do @format = format.is_a?(::String) ? ::Regexp.new(format) : format end end
to_s()
click to toggle source
# File lib/rasti/types/string.rb, line 14 def to_s name || "#{superclass.name}[#{format.inspect}]" end
Also aliased as: inspect
Private Class Methods
transform(value)
click to toggle source
# File lib/rasti/types/string.rb, line 31 def transform(value) value.to_s end
valid?(value)
click to toggle source
# File lib/rasti/types/string.rb, line 23 def valid?(value) value.respond_to?(:to_s) && valid_format?(value) end
valid_format?(value)
click to toggle source
# File lib/rasti/types/string.rb, line 27 def valid_format?(value) format.nil? || !value.to_s.match(format).nil? end