Sha256: 96d4e5f97917e11f3e8dc94e7c3496b2e94e90f6dd86eccb62e620f921685bed

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

# Extension of USPSFlags::Config to allow including custom burgee files.
#
# @private
class USPSFlags::Config
  @@burgees_dir ||= defined?(::Rails) ? "#{::Rails.root}/app/lib/usps-burgees" : "#{File.dirname(__dir__)}/output"

  attr_accessor :burgees_dir

  alias :parent_initialize :initialize
  def initialize
    @burgees_dir = @@burgees_dir
    parent_initialize do |c|
      c.flags_dir = USPSFlags::Config.flags_dir
      c.reset = USPSFlags::Config.reset
      c.use_larger_tridents = USPSFlags::Config.use_larger_tridents
    end
    yield self if block_given? # This appears to be overwriting the parent variables with defaults
    @@burgees_dir = @burgees_dir
  end

  def self.burgees_dir
    burgees_path = if defined?(::Rails)
      "#{::Rails.root}/app/lib/usps-burgees"
    else
      @@burgees_dir
    end
    ::FileUtils.mkdir_p(burgees_path)
    burgees_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
usps_flags-burgees-0.0.7 lib/usps_flags/burgees/config.rb