Class: Yet::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/yet/base.rb

Direct Known Subclasses

Invalid, Valid

Instance Method Summary collapse

Constructor Details

#initialize(value, operations = []) ⇒ Base

Returns a new instance of Base.



5
6
7
8
# File 'lib/yet/base.rb', line 5

def initialize(value, operations = [])
  @value      = value
  @operations = operations
end

Instance Method Details

#true_valueObject



20
21
22
# File 'lib/yet/base.rb', line 20

def true_value
  @value
end

#valueObject



10
11
12
13
14
15
16
17
18
# File 'lib/yet/base.rb', line 10

def value
  @operations.reduce(self) { |s, fn|
    begin
      s.map(&fn)
    rescue => e
      Yet.is_not(e)
    end
  }.true_value
end