Sha256: a23b9b3b932200993381bf1a8e0b5d3fc53af0e0f831eeee30f334381ffec6fd

Contents?: true

Size: 444 Bytes

Versions: 1

Compression:

Stored size: 444 Bytes

Contents

module SeedGimmick
  class Options
    %i(seed_dir).each do |key|
      define_method "#{key}=" do |value|
        @options[key] = value
      end
    end

    def initialize(options = {})
      @options = options.symbolize_keys
    end

    def seed_dir
      @options[:seed_dir] || default_seed_dir
    end

    private
      def default_seed_dir
        (defined?(Rails) ? Rails.root : Pathname.pwd).join("db", "seeds")
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seed_gimmick-0.0.1 lib/seed_gimmick/options.rb