Class: Hashematics::Configuration

Inherits:
Object
  • Object
show all
Includes:
Keys
Defined in:
lib/hashematics/configuration.rb

Overview

This class understands how to take in a hash of options and construct an array of groups. See test fixtures for examples.

Defined Under Namespace

Modules: Keys

Constant Summary

Constants included from Keys

Keys::BY, Keys::GROUPS, Keys::INCLUDE_BLANK, Keys::OBJECT_CLASS, Keys::PROPERTIES, Keys::TYPE, Keys::TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Configuration

Returns a new instance of Configuration.



27
28
29
30
31
32
33
34
# File 'lib/hashematics/configuration.rb', line 27

def initialize(config = {})
  types = build_types(config_value(config, TYPES))
  @type_dictionary = Dictionary.new(Type.null_type).add(types, &:name)

  @groups = build_groups(config_value(config, GROUPS))

  freeze
end

Instance Attribute Details

#groupsObject (readonly)

Returns the value of attribute groups.



25
26
27
# File 'lib/hashematics/configuration.rb', line 25

def groups
  @groups
end