Class: Identity

Inherits:
Object show all
Defined in:
lib/raskell/identity.rb

Instance Method Summary collapse

Instance Method Details

#*(lamb) ⇒ Object



12
13
14
# File 'lib/raskell/identity.rb', line 12

def *(lamb)
  lamb
end

#+(lamb) ⇒ Object



20
21
22
# File 'lib/raskell/identity.rb', line 20

def +(lamb)
  ->(x) { x } + lamb
end

#<<(val) ⇒ Object



24
25
26
27
# File 'lib/raskell/identity.rb', line 24

def <<(val)
  # feed data from the right
  self.(val.())
end

#>>(lamb) ⇒ Object



29
30
31
32
# File 'lib/raskell/identity.rb', line 29

def >>(lamb)
  # feed data from the left, assuming I am a wrapped Object of some sort
  lamb.(self)
end

#call(arg) ⇒ Object



8
9
10
# File 'lib/raskell/identity.rb', line 8

def call(arg)
  arg
end

#kind_of?(clazz) ⇒ Boolean

Returns:



4
5
6
# File 'lib/raskell/identity.rb', line 4

def kind_of?(clazz)
  clazz == Proc || standard_kind_of?(clazz)
end

#standard_kind_of?Object



3
# File 'lib/raskell/identity.rb', line 3

alias_method :standard_kind_of?, :kind_of?

#|(lamb) ⇒ Object



16
17
18
# File 'lib/raskell/identity.rb', line 16

def |(lamb)
  lamb
end