class Struct

Constants

STRUCT_TYPE

Public Instance Methods

lock() click to toggle source
# File ext/struct.rb, line 40
def lock
  self #noop
end
merge(other) click to toggle source

returns new object

# File ext/struct.rb, line 32
def merge other
  selfHash = self.to_h
  otherHash = other.is_a?(Hash) ? other : other.to_h

  selfHash.merge!(otherHash)
  selfHash.to_struct(STRUCT_TYPE)
end
struct_type() click to toggle source
# File ext/struct.rb, line 7
def struct_type
  STRUCT_TYPE
end
unlock(type=ClassyStruct::STRUCT_TYPE) click to toggle source

Convert Struct to OpenStruct or ClassyStruct (default), thus unlocking it.

# File ext/struct.rb, line 45
def unlock(type=ClassyStruct::STRUCT_TYPE)
  return nil if type.to_sym == Struct::STRUCT_TYPE
  return self.to_h.to_struct(type)
end