Sha256: 8089a85cd92abb27f3f152c036d1444bc62bca57e9d78d9a4e3c66dc9597b25a

Contents?: true

Size: 1.8 KB

Versions: 15

Compression:

Stored size: 1.8 KB

Contents

# frozen_string_literal: true

# :reek:UtilityFunction

module RubyRabbitmqJanus
  module Tools
    # Subclass for Config
    #
    # Options about Gem
    #
    # @see RubyRabbitmqJanus::Tools::Config
    module ConfigGem
      # @return [Boolean] Read option file for a janus cluster section
      def cluster
        @options['gem']['cluster']['enabled'].to_s.match?('true') ? true : false
      end

      # @return [Symbol] read configuration for log level used in this gem
      def log_level
        @options['gem']['log']['level'].upcase.to_sym || :INFO
      end

      # @return [Symbol] Read level to log
      def log_type
        @options['gem']['log']['type'].downcase.to_sym || :stdout
      end

      # @return [String] read configuration for log option
      def log_option
        option = @options['gem']['log']['option']
        option.empty? ? nil : option
      end

      # @return [String] Get path to classes in project calling this gem.
      def listener_path
        @options['gem']['listener']['path'].to_s ||
          'app/ruby_rabbitmq_janus/action_events'
      end

      # @return [String] Environment gem executed.
      def environment
        @options['gem']['environment'].to_s || 'development'
      end

      # @return [String] Get orm used (mongoid or active_record)
      def object_relational_mapping
        @options['gem']['orm'].to_s || 'mongoid'
      end

      # @return [String] Get program name or GEM_NAME
      def program_name
        ENV['PROGRAM_NAME'] || RubyRabbitmqJanus::GEM_NAME
      end

      # @return [String] Get path for json files contains a Janus response
      def rspec_response
        @options['gem']['response_path'] || 'spec/responses'
      end

      alias env environment
      alias orm object_relational_mapping
      alias pg program_name
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.7.2.pre.315 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.314 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.312 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.310 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.309 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.308 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.307 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.306 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.305 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.302 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.297 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.296 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.286 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.285 lib/rrj/tools/gem/config/gem.rb
ruby_rabbitmq_janus-2.7.2.pre.284 lib/rrj/tools/gem/config/gem.rb