Class: Rasti::Types::String

Inherits:
Object
  • Object
show all
Extended by:
Castable
Defined in:
lib/rasti/types/string.rb

Class Method Summary collapse

Methods included from Castable

cast

Class Method Details

.[](format) ⇒ Object



8
9
10
11
12
# 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_sObject Also known as: inspect



14
15
16
# File 'lib/rasti/types/string.rb', line 14

def to_s
  name || "#{superclass.name}[#{format.inspect}]"
end