Class: Payday::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/payday/config.rb

Overview

Configuration for Payday. This is a singleton, so to set the company_name you would call Payday::Config.default.company_name = “Awesome Corp”.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Internal: Contruct a new config object.



31
32
33
# File 'lib/payday/config.rb', line 31

def initialize
  reset
end

Instance Attribute Details

#company_detailsObject

Returns the value of attribute company_details.



5
6
7
# File 'lib/payday/config.rb', line 5

def company_details
  @company_details
end

#company_nameObject

Returns the value of attribute company_name.



5
6
7
# File 'lib/payday/config.rb', line 5

def company_name
  @company_name
end

#currencyObject

Returns the value of attribute currency.



5
6
7
# File 'lib/payday/config.rb', line 5

def currency
  @currency
end

#date_formatObject

Returns the value of attribute date_format.



5
6
7
# File 'lib/payday/config.rb', line 5

def date_format
  @date_format
end

#invoice_logoObject

Returns the value of attribute invoice_logo.



5
6
7
# File 'lib/payday/config.rb', line 5

def 
  @invoice_logo
end

#page_sizeObject

Sets the page size to use. See the Prawn documentation for valid page_size values.



10
11
12
# File 'lib/payday/config.rb', line 10

def page_size
  @page_size
end

Class Method Details

.defaultObject

Returns the default configuration instance



13
14
15
# File 'lib/payday/config.rb', line 13

def self.default
  @@default ||= new
end

Instance Method Details

#resetObject

Internal: Resets a config object back to its default settings.

Primarily intended for use in our tests.



20
21
22
23
24
25
26
27
28
# File 'lib/payday/config.rb', line 20

def reset
  # TODO: Move into specs and make minimal configuration required (company name / details)
  self. = File.join(File.dirname(__FILE__), "..", "..", "spec", "assets", "default_logo.png")
  self.company_name = "Awesome Corp"
  self.company_details = "[email protected]"
  self.date_format = "%B %e, %Y"
  self.currency = "USD"
  self.page_size = "LETTER"
end