Class: SimpleInvoice::Config

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/simple_invoice/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



20
21
22
# File 'lib/simple_invoice/config.rb', line 20

def initialize
  @config_hash = {}
end

Class Method Details

.allocate_invoice_number(callable) ⇒ Object

Parameters:

  • callable (#call)

    object that responds to call(), which returns the next invoice number.



14
15
16
# File 'lib/simple_invoice/config.rb', line 14

def allocate_invoice_number callable
  instance[:allocate_invoice_number] = callable
end

.instanceObject



8
9
10
# File 'lib/simple_invoice/config.rb', line 8

def instance
  @instance ||= new
end

Instance Method Details

#[](key) ⇒ Object



24
25
26
# File 'lib/simple_invoice/config.rb', line 24

def [](key)
  @config_hash[key]
end

#[]=(key, value) ⇒ Object



28
29
30
# File 'lib/simple_invoice/config.rb', line 28

def []=(key, value)
  @config_hash[key] = value
end