capitalism-journal 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6485a3ffba589b67ea11bdc48c089e812446d98
4
- data.tar.gz: 1b121b4f8af1621722094d2f7c158123c62b1473
3
+ metadata.gz: 53556ec638ccdcf8857d63eb92b2fdea1649226e
4
+ data.tar.gz: 94468ee64b908c47d7e3c2dbfbbcb7b4cd8995b2
5
5
  SHA512:
6
- metadata.gz: c81cb78478a855a184d82f89fb1cb6c31e60cfa8a9113b031973a41367750f6986e66f710fe3813c26f209a0757891236c9908ee39ef44fcf40ccc22c76bcd79
7
- data.tar.gz: 522d96fd1dc51eee6898d9b2ce477fe3d934ef5f2424df55f28249412e92796b8f5452925a80ba0c2a8c45f611b655356f16d2e0690d5a68667305782377472a
6
+ metadata.gz: d23155a35419b57c475d851b8d3fa603d2a57364758757210963d8d9b6e4328c1d6fd7cab36b73d92543e10339103082728fb804ba258b59696a2f250525ae5a
7
+ data.tar.gz: 8aa093274f461a7df1142c1d1ce6856c707a0b88f066e12d4c8924e3858ae0a89612369ca3733ba40eb3a9cb42e448c2bb1990c68ae85cfb1ae617a637cbefca
data/README.md CHANGED
@@ -44,12 +44,12 @@ Helper methods:
44
44
 
45
45
  By default journal accepts events with arbitrary timestamps and values.
46
46
 
47
- For a custom validation inject a class that responds to `#call.(journal, event)`:
47
+ For a custom validation inject a class that responds to `#call.(event)`:
48
48
 
49
- event_validator = -> (_journal, _event) { false }
49
+ event_validator = -> (_event) { false }
50
50
  journal = Capitalism::Journal.new(event_validator)
51
51
  journal.add
52
- => Capitalism::Journal::InvalidJournalEvent
52
+ => Capitalism::Journal::InvalidEvent
53
53
 
54
54
  ## Reading events
55
55
 
@@ -2,19 +2,19 @@ require 'ostruct'
2
2
 
3
3
  module Capitalism
4
4
  class Journal
5
- class InvalidJournalEvent < StandardError
5
+ class InvalidEvent < StandardError
6
6
  end
7
7
 
8
8
  attr_reader :event_validator, :events
9
9
 
10
- def initialize(event_validator = -> (_journal, _event) { true })
10
+ def initialize(event_validator = ->(_event) { true })
11
11
  @event_validator = event_validator
12
12
  @events = []
13
13
  end
14
14
 
15
15
  def add(timestamp: Time.now, value: true)
16
- event = OpenStruct.new({ timestamp: timestamp, value: value })
17
- raise InvalidJournalEvent unless event_validator.call(event, self)
16
+ event = OpenStruct.new({ journal: self, timestamp: timestamp, value: value })
17
+ raise InvalidEvent unless event_validator.call(event)
18
18
  @events << event
19
19
  nil
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Capitalism
2
2
  class Journal
3
- VERSION = '0.8.1'.freeze
3
+ VERSION = '0.8.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capitalism-journal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Zharikov