Class: Definition::Types::Keys

Inherits:
Base
  • Object
show all
Includes:
Dsl
Defined in:
lib/definition/types/keys.rb

Defined Under Namespace

Modules: Dsl Classes: Conformer

Instance Attribute Summary collapse

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods included from Dsl

#optional, #required

Methods inherited from Base

#explain

Constructor Details

#initialize(name, req: {}, opt: {}) ⇒ Keys

Returns a new instance of Keys.



24
25
26
27
28
# File 'lib/definition/types/keys.rb', line 24

def initialize(name, req: {}, opt: {})
  super(name)
  self.required_definitions = req
  self.optional_definitions = opt
end

Instance Attribute Details

#optional_definitionsObject

Returns the value of attribute optional_definitions.



22
23
24
# File 'lib/definition/types/keys.rb', line 22

def optional_definitions
  @optional_definitions
end

#required_definitionsObject

Returns the value of attribute required_definitions.



22
23
24
# File 'lib/definition/types/keys.rb', line 22

def required_definitions
  @required_definitions
end

Instance Method Details

#conform(value) ⇒ Object



30
31
32
# File 'lib/definition/types/keys.rb', line 30

def conform(value)
  Conformer.new(self, value).conform
end

#keysObject



34
35
36
# File 'lib/definition/types/keys.rb', line 34

def keys
  required_definitions.keys + optional_definitions.keys
end