Class: Unimatrix::DynamicResource
- Defined in:
- lib/unimatrix/dynamic_resource.rb
Direct Known Subclasses
Activist::ActivitiesSchedule, Activist::Activity, Activist::Task, Cartographer::GeographicArea, Cartographer::Region, Cartographer::RegionGeographicArea, Curator::ActivityReference, Curator::Source, Unimatrix::Distributor::Destination, Unimatrix::Distributor::Distribution, Regent::Service, Regent::Setting
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}, associations = {}) {|_self| ... } ⇒ DynamicResource
constructor
A new instance of DynamicResource.
Methods inherited from Resource
build, field, find_by_type_name, has_many, has_one, inherited, type_name
Constructor Details
#initialize(attributes = {}, associations = {}) {|_self| ... } ⇒ DynamicResource
Returns a new instance of DynamicResource.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 |
Class Method Details
.new(attributes = {}, associations = {}) ⇒ Object
9 10 11 12 13 14 15 |
# 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 |
.old_new ⇒ Object
7 |
# File 'lib/unimatrix/dynamic_resource.rb', line 7 alias old_new new |