Sha256: 26e2aaa855316a5195c3490b91ad4a3b2bfeafa34b26d7ae8d14fec27fe4f1ab

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

module RShade
  class Config
    class Store
      attr_reader :filter_composition, :formatter, :tp_events

      # @param [Hash] options
      # @option options [RShade::Filter::FilterComposition] :filter_composition
      # @option options [#call(event_store)] :formatter
      # @option options [Array<Symbol>] :tp_events
      def initialize(options={})
        @filter_composition = options.fetch(:filter_composition, default_filter_composition)
        @formatter = options.fetch(:formatter, ::RShade::Formatter::Stdout)
        @tp_events = options.fetch(:tp_events, [:call, :return])
      end

      def set_tp_events(tp_events)
        @tp_events = tp_events
      end

      def config_filter(filter_type, &block)
        filter_composition.config_filter(filter_type, &block)
        self
      end

      def set_formatter(formatter)
        @formatter = formatter
        self
      end

      private

      def default_filter_composition
        RShade::Filter::FilterBuilder.build([:or,[:or, RShade::Filter::VariableFilter.new, RShade::Filter::IncludePathFilter.new] , RShade::Filter::ExcludePathFilter.new])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rshade-0.1.9 lib/rshade/config/store.rb