class ROM::OpenStruct

ROM's open structs are used for relations with empty schemas. Such relations may exist in cases like using raw SQL strings where schema was not explicitly defined using `view` DSL.

@api public

Constants

IVAR

Public Class Methods

new(attributes) click to toggle source

@api private

# File lib/rom/open_struct.rb, line 13
def initialize(attributes)
  attributes.each do |key, value|
    instance_variable_set(IVAR[key], value)
  end
end

Public Instance Methods

respond_to_missing?(meth, include_private = false) click to toggle source

@api private

Calls superclass method
# File lib/rom/open_struct.rb, line 20
def respond_to_missing?(meth, include_private = false)
  super || instance_variables.include?(IVAR[meth])
end

Private Instance Methods

method_missing(meth, *args, &block) click to toggle source

@api private

Calls superclass method
# File lib/rom/open_struct.rb, line 27
def method_missing(meth, *args, &block)
  ivar = IVAR[meth]

  if instance_variables.include?(ivar)
    instance_variable_get(ivar)
  else
    super
  end
end