class Unimatrix::DynamicResource
Public Class Methods
new( attributes = {}, associations = {} )
click to toggle source
# File lib/unimatrix/dynamic_resource.rb, line 9 def new( attributes = {}, associations = {} ) Class.new( self ).old_new( { type_name: self.name.split( '::' ).last.underscore }. merge( attributes ), associations ) end
Also aliased as: old_new
new( attributes = {}, associations = {} ) { |self| ... }
click to toggle source
Calls superclass method
# File lib/unimatrix/dynamic_resource.rb, line 19 def initialize( attributes = {}, associations = {} ) unsupported_attributes_names = [] attributes.each do | key, value | unsupported_attributes_names << key.to_sym \ unless self.respond_to?( key.to_sym ) end self.class_eval do unsupported_attributes_names.each do | name | field name end end super( attributes, associations ) yield self if block_given? end