Sha256: f7f224552e1def225857a754986e9af6359b13cc299eca9bf9027e394107a857

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

module Annotate
  # Class for holding helper methods. Done to make lib/annotate.rb less bloated.
  class Helpers
    class << self
      def skip_on_migration?
        ENV['ANNOTATE_SKIP_ON_DB_MIGRATE'] =~ Constants::TRUE_RE || ENV['skip_on_db_migrate'] =~ Constants::TRUE_RE
      end

      def include_routes?
        ENV['routes'] =~ Constants::TRUE_RE
      end

      def include_models?
        ENV['models'] =~ Constants::TRUE_RE
      end

      def true?(val)
        val.present? && Constants::TRUE_RE.match?(val)
      end

      def fallback(*args)
        args.detect(&:present?)
      end

      def reset_options(options)
        options.flatten.each { |key| ENV[key.to_s] = nil }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
annotate-3.2.0 lib/annotate/helpers.rb
annotate-3.1.1 lib/annotate/helpers.rb
annotate-3.1.0 lib/annotate/helpers.rb