lib/factbase/tee.rb in factbase-0.0.52 vs lib/factbase/tee.rb in factbase-0.0.53

- old
+ new

@@ -18,10 +18,11 @@ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +require 'others' require_relative '../factbase' # Tee of two facts. # # Author:: Yegor Bugayenko (yegor256@gmail.com) @@ -38,22 +39,15 @@ def to_s @fact.to_s end - def method_missing(*args) - return @fact.method_missing(*args) unless args[0].to_s == '[]' && args[1].to_s.start_with?('$') - n = args[1].to_s - n = n[1..] unless @upper.is_a?(Factbase::Tee) - @upper[n] - end - - # rubocop:disable Style/OptionalBooleanParameter - def respond_to?(_method, _include_private = false) - # rubocop:enable Style/OptionalBooleanParameter - true - end - - def respond_to_missing?(_method, _include_private = false) - true + others do |*args| + if args[0].to_s == '[]' && args[1].to_s.start_with?('$') + n = args[1].to_s + n = n[1..] unless @upper.is_a?(Factbase::Tee) + @upper[n] + else + @fact.method_missing(*args) + end end end