Sha256: d7c85ba87a8d21019c800a2914ef89562c3f1579a9b06858e24300d4cf18eed3

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

module Payday
  # Configuration for Payday. This is a singleton, so to set the company_name you would call
  # Payday::Config.default.company_name = "Awesome Corp".
  class Config
    attr_accessor :invoice_logo, :company_name, :company_details, :date_format, :currency

    # Sets the page size to use. See the
    # {http://prawn.majesticseacreature.com/docs/0.10.2/Prawn/Document/PageGeometry.html Prawn documentation} for valid
    # page_size values.
    attr_accessor :page_size

    # Returns the default configuration instance
    def self.default
      @@default ||= new
    end

    # Internal: Resets a config object back to its default settings.
    #
    # Primarily intended for use in our tests.
    def reset
      # TODO: Move into specs and make minimal configuration required (company name / details)
      self.invoice_logo = File.join(File.dirname(__FILE__), "..", "..", "spec", "assets", "default_logo.png")
      self.company_name = "Awesome Corp"
      self.company_details = "awesomecorp@commondream.net"
      self.date_format = "%B %e, %Y"
      self.currency = "USD"
      self.page_size = "LETTER"
    end

    # Internal: Contruct a new config object.
    def initialize
      reset
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
payday-1.1.5 lib/payday/config.rb
payday-1.1.4 lib/payday/config.rb