Class: Debitcredit::Entry::Dsl
- Inherits:
-
Object
- Object
- Debitcredit::Entry::Dsl
- Defined in:
- app/models/debitcredit/entry/dsl.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
Returns the value of attribute accounts.
-
#entry ⇒ Object
Returns the value of attribute entry.
Instance Method Summary collapse
- #credit(account, amount, comment = nil) ⇒ Object
- #debit(account, amount, comment = nil) ⇒ Object
- #description(desc) ⇒ Object (also: #desc)
-
#initialize(entry) ⇒ Dsl
constructor
A new instance of Dsl.
- #kind(kind) ⇒ Object
- #reference(ref) ⇒ Object (also: #ref)
Constructor Details
#initialize(entry) ⇒ Dsl
Returns a new instance of Dsl.
5 6 7 |
# File 'app/models/debitcredit/entry/dsl.rb', line 5 def initialize(entry) @entry = entry end |
Instance Attribute Details
#accounts ⇒ Object
Returns the value of attribute accounts.
3 4 5 |
# File 'app/models/debitcredit/entry/dsl.rb', line 3 def accounts @accounts end |
#entry ⇒ Object
Returns the value of attribute entry.
2 3 4 |
# File 'app/models/debitcredit/entry/dsl.rb', line 2 def entry @entry end |
Instance Method Details
#credit(account, amount, comment = nil) ⇒ Object
27 28 29 |
# File 'app/models/debitcredit/entry/dsl.rb', line 27 def credit(account, amount, comment = nil) build_item false, account, amount, comment end |
#debit(account, amount, comment = nil) ⇒ Object
23 24 25 |
# File 'app/models/debitcredit/entry/dsl.rb', line 23 def debit(account, amount, comment = nil) build_item true, account, amount, comment end |
#description(desc) ⇒ Object Also known as: desc
13 14 15 |
# File 'app/models/debitcredit/entry/dsl.rb', line 13 def description(desc) @entry.description = desc end |
#kind(kind) ⇒ Object
9 10 11 |
# File 'app/models/debitcredit/entry/dsl.rb', line 9 def kind(kind) @entry.kind = kind end |
#reference(ref) ⇒ Object Also known as: ref
18 19 20 |
# File 'app/models/debitcredit/entry/dsl.rb', line 18 def reference(ref) @entry.reference = ref end |