Sha256: aa2e3215ce9b83db605bc97de1b6ab4147c743c81f630fa68f3d722780272e20

Contents?: true

Size: 512 Bytes

Versions: 3

Compression:

Stored size: 512 Bytes

Contents

module SmartKv::Register
  def required(*args)
    @required ||= superclass == SmartKv ? Set.new : superclass.required_keys.dup
    @required += args
  end

  def required_keys
    @required.to_a
  end

  def optional(*args)
    @optional ||= superclass == SmartKv ? Set.new : superclass.optional_keys.dup
    @optional += args
    @required -= @optional
    @optional
  end

  def optional_keys
    @optional.to_a
  end

  def new(*args)
    super(@required.to_a, @optional.to_a, @callable_as, *args)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smart_kv-0.1.3 lib/smart_kv/register.rb
smart_kv-0.1.2 lib/smart_kv/register.rb
smart_kv-0.1.1 lib/smart_kv/register.rb