Sha256: 5d8d58c7af996ca9485d1fb2cef80edb7aa89febf776940ea11aa5d09d261151
Contents?: true
Size: 711 Bytes
Versions: 1
Compression:
Stored size: 711 Bytes
Contents
module Rasti class Form module Types class String include Formatable class << self include Castable def [](format) new format end private def valid?(value) !value.nil? && value.respond_to?(:to_s) end def transform(value) value.to_s end end def to_s "#{self.class}[#{format.inspect}]" end alias_method :inspect, :to_s private attr_reader :format def initialize(format) @format = format.is_a?(String) ? ::Regexp.new(format) : format end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rasti-form-3.0.0 | lib/rasti/form/types/string.rb |