Class: Camille::Types::String

Inherits:
BasicType show all
Defined in:
lib/camille/types/string.rb

Instance Attribute Summary

Attributes inherited from BasicType

#fingerprint

Instance Method Summary collapse

Methods inherited from BasicType

&, #&, [], #[], directly_instantiable?, inherited, #initialize, instance, #transform, |, #|

Constructor Details

This class inherits a constructor from Camille::BasicType

Instance Method Details

#check(value) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/camille/types/string.rb', line 4

def check value
  if value.is_a?(::String) || value.is_a?(Symbol)
    Camille::Checked.new(fingerprint, value)
  else
    Camille::TypeError.new("Expected string, got #{value.inspect}.")
  end
end

#literalObject



12
13
14
# File 'lib/camille/types/string.rb', line 12

def literal
  "string"
end