Sha256: a8c42e0098fca9fb5a4d99ee4ffc44ca61095b14058978c617b7a1bf15599624

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

module Daimon
  module Exhibition
    module Exhibit
      def acts_as_exhibit(to: :inquiry)
        define_method "#{to}_params" do
          {__send__("#{to}_key") => [__send__(self.class.primary_key)]}
        end

        define_method "#{to}_key" do
          inquiry_class = ::Daimon::Exhibition::Mapping.detect_inquiry_by(self.class)
          type          = ::Daimon::Exhibition::Mapping.class_to_type(self.class)

          inquiry_class.exhibit_writer_for(type)
        end

        ::Daimon::Exhibition::Mapping.register(self, to)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daimon-exhibition-0.1.0 app/models/concerns/daimon/exhibition/exhibit.rb