Class: OneUp::LedgerRepository

Inherits:
Object
  • Object
show all
Extended by:
Mixins::ActsAsCrud
Defined in:
lib/one_up/ledger.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::ActsAsCrud

all, create, crud_element_list, crud_element_list=, delete_all

Constructor Details

#initialize(giver:, receiver:, gift:, message:, created_at: Time.now) ⇒ LedgerRepository

Returns a new instance of LedgerRepository.



6
7
8
9
10
11
12
# File 'lib/one_up/ledger.rb', line 6

def initialize(giver:, receiver:, gift:, message:, created_at: Time.now)
  @giver = giver
  @receiver = receiver
  @gift = gift
  @message = message
  @created_at = created_at
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



5
6
7
# File 'lib/one_up/ledger.rb', line 5

def created_at
  @created_at
end

#giftObject

Returns the value of attribute gift.



5
6
7
# File 'lib/one_up/ledger.rb', line 5

def gift
  @gift
end

#giverObject

Returns the value of attribute giver.



5
6
7
# File 'lib/one_up/ledger.rb', line 5

def giver
  @giver
end

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/one_up/ledger.rb', line 5

def message
  @message
end

#receiverObject

Returns the value of attribute receiver.



5
6
7
# File 'lib/one_up/ledger.rb', line 5

def receiver
  @receiver
end

Class Method Details

.entries_from_range(today_start, today_end) ⇒ Object



14
15
16
# File 'lib/one_up/ledger.rb', line 14

def self.entries_from_range(today_start, today_end)
  all.select { |e| (today_start..today_end).cover? e.created_at }
end