Class: Yoda::Store::Objects::SerializableSet

Inherits:
Object
  • Object
show all
Includes:
MissingDelegatable, Serializable
Defined in:
lib/yoda/store/objects/serializable_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Serializable

#==, #derive, #eql?, #hash, included, #to_json

Methods included from MissingDelegatable

#delegate_missing_target, included, #method_missing, #respond_to_missing?

Constructor Details

#initialize(els = nil, elements: nil) ⇒ SerializableSet

Returns a new instance of SerializableSet.



13
14
15
# File 'lib/yoda/store/objects/serializable_set.rb', line 13

def initialize(els = nil, elements: nil)
  @set = Set.new(els || elements)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Yoda::MissingDelegatable

Instance Attribute Details

#setSet (readonly)

Returns:

  • (Set)


11
12
13
# File 'lib/yoda/store/objects/serializable_set.rb', line 11

def set
  @set
end

Instance Method Details

#to_hObject



17
18
19
# File 'lib/yoda/store/objects/serializable_set.rb', line 17

def to_h
  { elements: set.to_a }
end