Module: Vident::Capabilities::Inspectable

Included in:
Vident::Component
Defined in:
lib/vident/capabilities/inspectable.rb

Instance Method Summary collapse

Instance Method Details

#inspect(klass_name = "Component") ⇒ Object



11
12
13
14
# File 'lib/vident/capabilities/inspectable.rb', line 11

def inspect(klass_name = "Component")
  attr_text = to_h.map { |k, v| "#{k}=#{v.inspect}" }.join(", ")
  "#<#{self.class.name}<Vident::#{klass_name}> #{attr_text}>"
end

#with(overrides = {}) ⇒ Object

Matches the Data.define#with convention introduced in Ruby 3.2.



7
8
9
# File 'lib/vident/capabilities/inspectable.rb', line 7

def with(overrides = {})
  self.class.new(**to_h.merge(overrides))
end