Sha256: 3aa48243afea8b7455f83b9fe646e1e64dac59ed169796406fddb0130e3f8672

Contents?: true

Size: 1019 Bytes

Versions: 8

Compression:

Stored size: 1019 Bytes

Contents

require "golden_fleece/context/export"
require "golden_fleece/context/formats"
require "golden_fleece/context/getters"
require "golden_fleece/context/normalizers"
require "golden_fleece/context/schemas"
require 'golden_fleece/schema'

module GoldenFleece
  class Context
    include ::GoldenFleece::Context::Export
    include ::GoldenFleece::Context::Formats
    include ::GoldenFleece::Context::Getters
    include ::GoldenFleece::Context::Normalizers
    include ::GoldenFleece::Context::Schemas

    attr_accessor :rules
    attr_reader :model_class, :normalizers, :formats, :attributes, :schemas, :setup_callbacks, :has_run_setup

    def initialize(model_class)
      @model_class = model_class
      @normalizers = {}
      @formats = {}
      @attributes = []
      @schemas = Schema.new(self, '/', {})
      @setup_callbacks = []
      @has_run_setup = false
    end

    def run_setup_callbacks
      @setup_callbacks.each do |cb|
        cb.call self
      end

      @has_run_setup = true
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
golden_fleece-1.0.1 lib/golden_fleece/context.rb
golden_fleece-1.0.0 lib/golden_fleece/context.rb
golden_fleece-0.1.5 lib/golden_fleece/context.rb
golden_fleece-0.1.4 lib/golden_fleece/context.rb
golden_fleece-0.1.3 lib/golden_fleece/context.rb
golden_fleece-0.1.2 lib/golden_fleece/context.rb
golden_fleece-0.1.1 lib/golden_fleece/context.rb
golden_fleece-0.1.0 lib/golden_fleece/context.rb