Class: Debitcredit::Entry::Dsl

Inherits:
Object
  • Object
show all
Defined in:
app/models/debitcredit/entry/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#accountsObject

Returns the value of attribute accounts.



3
4
5
# File 'app/models/debitcredit/entry/dsl.rb', line 3

def accounts
  @accounts
end

#entryObject

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(, amount, comment = nil)
  build_item false, , amount, comment
end

#debit(account, amount, comment = nil) ⇒ Object



23
24
25
# File 'app/models/debitcredit/entry/dsl.rb', line 23

def debit(, amount, comment = nil)
  build_item true, , 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