Class: Factbase::Tee

Inherits:
Object
  • Object
show all
Defined in:
lib/factbase/tee.rb

Overview

Tee of two facts.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2024 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(fact, upper) ⇒ Tee

Ctor.

Parameters:



34
35
36
37
# File 'lib/factbase/tee.rb', line 34

def initialize(fact, upper)
  @fact = fact
  @upper = upper
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



43
44
45
46
# File 'lib/factbase/tee.rb', line 43

def method_missing(*args)
  return @upper[args[1].to_s[1..]] if args[0].to_s == '[]' && args[1].to_s.start_with?('$')
  @fact.method_missing(*args)
end

Instance Method Details

#respond_to?(_method, _include_private = false) ⇒ Boolean

rubocop:disable Style/OptionalBooleanParameter

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/factbase/tee.rb', line 49

def respond_to?(_method, _include_private = false)
  # rubocop:enable Style/OptionalBooleanParameter
  true
end

#respond_to_missing?(_method, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/factbase/tee.rb', line 54

def respond_to_missing?(_method, _include_private = false)
  true
end

#to_sObject



39
40
41
# File 'lib/factbase/tee.rb', line 39

def to_s
  @fact.to_s
end