Class: Payday::Config
- Inherits:
-
Object
- Object
- Payday::Config
- 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
-
#company_details ⇒ Object
Returns the value of attribute company_details.
-
#company_name ⇒ Object
Returns the value of attribute company_name.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#date_format ⇒ Object
Returns the value of attribute date_format.
-
#invoice_logo ⇒ Object
Returns the value of attribute invoice_logo.
-
#page_size ⇒ Object
Sets the page size to use.
Class Method Summary collapse
-
.default ⇒ Object
Returns the default configuration instance.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
Internal: Contruct a new config object.
-
#reset ⇒ Object
Internal: Resets a config object back to its default settings.
Constructor Details
#initialize ⇒ Config
Internal: Contruct a new config object.
35 36 37 |
# File 'lib/payday/config.rb', line 35 def initialize reset end |
Instance Attribute Details
#company_details ⇒ Object
Returns the value of attribute company_details.
9 10 11 |
# File 'lib/payday/config.rb', line 9 def company_details @company_details end |
#company_name ⇒ Object
Returns the value of attribute company_name.
9 10 11 |
# File 'lib/payday/config.rb', line 9 def company_name @company_name end |
#currency ⇒ Object
Returns the value of attribute currency.
9 10 11 |
# File 'lib/payday/config.rb', line 9 def currency @currency end |
#date_format ⇒ Object
Returns the value of attribute date_format.
9 10 11 |
# File 'lib/payday/config.rb', line 9 def date_format @date_format end |
#invoice_logo ⇒ Object
Returns the value of attribute invoice_logo.
9 10 11 |
# File 'lib/payday/config.rb', line 9 def invoice_logo @invoice_logo end |
#page_size ⇒ Object
Sets the page size to use. See the Prawn documentation for valid page_size values.
14 15 16 |
# File 'lib/payday/config.rb', line 14 def page_size @page_size end |
Class Method Details
.default ⇒ Object
Returns the default configuration instance
17 18 19 |
# File 'lib/payday/config.rb', line 17 def self.default @default ||= new end |
Instance Method Details
#reset ⇒ Object
Internal: Resets a config object back to its default settings.
Primarily intended for use in our tests.
24 25 26 27 28 29 30 31 32 |
# File 'lib/payday/config.rb', line 24 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 = '[email protected]' self.date_format = '%B %e, %Y' self.currency = 'USD' self.page_size = 'LETTER' end |