Class: Monolens::Type::Symbol

Inherits:
Object
  • Object
show all
Extended by:
ErrorHandling
Defined in:
lib/monolens/type/symbol.rb

Class Method Summary collapse

Methods included from ErrorHandling

fail!

Class Method Details

.===(instance) ⇒ Object



7
8
9
# File 'lib/monolens/type/symbol.rb', line 7

def self.===(instance)
  instance.is_a?(::Symbol)
end

.dress(instance, registry, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/monolens/type/symbol.rb', line 11

def self.dress(instance, registry, &block)
  unless instance.is_a?(::String) or instance.is_a?(::Symbol)
    fail!("Invalid symbol #{instance}", &block)
  end

  instance.to_sym
end