Class: PollEverywhere::Serializable::Property::Set

Inherits:
CoreExt::HashWithIndifferentAccess show all
Defined in:
lib/polleverywhere/serializable.rb

Overview

Manage a set of properties and easily create instances of values from them.

Instance Method Summary collapse

Methods inherited from CoreExt::HashWithIndifferentAccess

#[], #[]=, #delete, #merge, #merge!, #values_at

Constructor Details

#initializeSet

Create a set of of properties that we can use to create instances of value sets



17
18
19
20
21
# File 'lib/polleverywhere/serializable.rb', line 17

def initialize
  super() do |props, name|
    props[name] = Property.new(name)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PollEverywhere::CoreExt::HashWithIndifferentAccess

Instance Method Details

#value_set(hash = {}) ⇒ Object

Return a collection fo values wrapped inside of a valuset. Valuesets make it easier to query and validate a collection of values.



25
26
27
# File 'lib/polleverywhere/serializable.rb', line 25

def value_set(hash={})
  Value::Set.new(*values.map(&:value))
end