Sha256: 5a5c457d1341f6bdb5208866c7d1041faf501979c3a4bad3823a5cc383ca50ee

Contents?: true

Size: 659 Bytes

Versions: 16

Compression:

Stored size: 659 Bytes

Contents

require 'active_support/core_ext/class'

module ActiveTriples
  module Reflection
    extend ActiveSupport::Concern

    included do
      class_attribute :_active_triples_config
      self._active_triples_config = {}
    end

    def self.add_reflection(model, name, reflection)
      model._active_triples_config = model._active_triples_config.merge(name.to_s => reflection)
    end

    module ClassMethods
      def reflect_on_property(term)
        _active_triples_config[term.to_s]
      end

      def properties
        _active_triples_config
      end

      def properties=(val)
        self._active_triples_config = val
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
active-triples-0.4.1 lib/active_triples/reflection.rb
active-triples-0.7.6 lib/active_triples/reflection.rb
active-triples-0.7.5 lib/active_triples/reflection.rb
active-triples-0.7.4 lib/active_triples/reflection.rb
active-triples-0.7.3 lib/active_triples/reflection.rb
active-triples-0.7.2 lib/active_triples/reflection.rb
active-triples-0.7.1 lib/active_triples/reflection.rb
active-triples-0.8.1 lib/active_triples/reflection.rb
active-triples-0.8.0 lib/active_triples/reflection.rb
active-triples-0.7.0 lib/active_triples/reflection.rb
active-triples-0.6.1 lib/active_triples/reflection.rb
active-triples-0.6.0 lib/active_triples/reflection.rb
active-triples-0.5.0 lib/active_triples/reflection.rb
active-triples-0.4.0 lib/active_triples/reflection.rb
active-triples-0.3.1 lib/active_triples/reflection.rb
active-triples-0.3.0 lib/active_triples/reflection.rb