Class: Literal::Delegator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/literal/delegator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Delegator

Returns a new instance of Delegator.



12
13
14
15
16
# File 'lib/literal/delegator.rb', line 12

def initialize(value)
  Literal.check(value, __type__)
  super
  freeze
end

Class Method Details

.[](value) ⇒ Object



8
9
10
# File 'lib/literal/delegator.rb', line 8

def self.[](value)
  new(value)
end

.to_procObject



4
5
6
# File 'lib/literal/delegator.rb', line 4

def self.to_proc
  -> (value) { new(value) }
end

Instance Method Details

#===(other) ⇒ Object Also known as: ==



18
19
20
# File 'lib/literal/delegator.rb', line 18

def ===(other)
  self.class === other && __getobj__ == other.__getobj__
end