lib/coactive/context.rb in coactive-0.2.2 vs lib/coactive/context.rb in coactive-0.3.0

- old
+ new

@@ -1,9 +1,13 @@ # frozen_string_literal: true +require_relative 'contexts/inspect' + module Coactive class Context + include Contexts::Inspect + attr_reader :_data def initialize(data = {}, &block) data = data.to_h if data.respond_to?(:to_h) @_data = data @@ -21,14 +25,9 @@ @_data.key?(key) end def to_h @_data - end - - def to_s - attrs = @_data.map { |k, v| "#{k}=#{v.to_s.truncate(300)}" }.join(', ') - "#<#{self.class} #{attrs}>" end def define_accessors!(keys) Array(keys).each do |key| define_singleton_method key do