module Dry::Interface::Interfaces::Unit
Public Instance Methods
new(value, *other, &block)
click to toggle source
Allows a struct to be called without a hash
@param value [Dry::Struct, Hash, Any] @param block [Proc]
@return [Dry::Struct]
# File lib/dry/interface/interfaces/unit.rb, line 32 def new(value, *other, &block) case value in Hash => attributes then _new(attributes, *other, &block) in Dry::Struct => instance then instance else case attribute_names in [] then raise ArgumentError, "[#{self}] has no attributes, one is required" in [key] then _new({ key => value }, *other, &block) else raise ArgumentError, "[#{self}] has more than one attribute: #{attribute_names.join(', ')}" end end end
to_s()
click to toggle source
Class name without parent module
@return [String]
# File lib/dry/interface/interfaces/unit.rb, line 21 def to_s demodulize(name) end