Sha256: d91fe8bfe2b39bee908a38856bb88b3a3687df60f06020358a3a6164f99701ee

Contents?: true

Size: 613 Bytes

Versions: 62

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module Effective
  module Resources
    module Model
      attr_accessor :model  # As defined by effective_resource do block in a model file

      def _initialize_model(&block)
        @model = (model || ModelReader.new)
        @model.read(&block)

        # If effective_developer is in live mode, this will cause it to refresh the class
        ActiveSupport.run_load_hooks(:effective_resource, self)
      end

      def model
        @model || (klass.effective_resource.model if klass.respond_to?(:effective_resource) && klass.effective_resource)
      end

    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
effective_resources-1.9.11 app/models/effective/resources/model.rb
effective_resources-1.9.10 app/models/effective/resources/model.rb