Sha256: f34ca412b0c57931fb5dd1a9a468ba223a70a8408c9109a3ed41afdf157e9293

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true

require_relative "plugins/relation_readers"
require_relative "plugins/slice_readers"

module Snowpack
  module Console
    class Context < SimpleDelegator
      attr_reader :application

      def self.new(*args)
        ctx = super

        if ctx.rom
          ctx.extend(Snowpack::Console::Plugins::RelationReaders.new(ctx))
          ctx.extend(Snowpack::Console::Plugins::SliceReaders.new(ctx))
        end

        ctx
      end

      def initialize(application)
        super(application)
        @application = application
      end

      def rom
        application["persistence.rom"] if application.key?("persistence.rom")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha7 lib/snowpack/console/context.rb
snowpack-1.0.0.alpha6 lib/snowpack/console/context.rb
snowpack-1.0.0.alpha5 lib/snowpack/console/context.rb
snowpack-1.0.0.alpha4 lib/snowpack/console/context.rb
snowpack-1.0.0.alpha3 lib/snowpack/console/context.rb
snowpack-1.0.0.alpha2 lib/snowpack/console/context.rb