Sha256: fd74607bd0de9c96859a1239e4581d0bd24a7ca8ce613c18b00c9bd4de09497d
Contents?: true
Size: 856 Bytes
Versions: 2
Compression:
Stored size: 856 Bytes
Contents
require 'disposable/twin' require 'disposable/twin/option' module Cell class Twin < Disposable::Twin include Option def self.property_names representer_class.representable_attrs.collect(&:name) end module Properties def self.included(base) base.extend Uber::InheritableAttr base.inheritable_attr :twin_class base.extend ClassMethods end module ClassMethods def properties(twin_class) twin_class.property_names.each { |name| property name } self.twin_class = twin_class end alias_method :twin, :properties end def initialize(controller, model, options={}) super(controller, build_twin(model, options)) end private def build_twin(*args) self.class.twin_class.new(*args) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cells-3.11.3 | lib/cell/twin.rb |
cells-3.11.2 | lib/cell/twin.rb |