Class: TokenChain::Emitter
- Inherits:
-
Object
- Object
- TokenChain::Emitter
- Defined in:
- lib/token_chain/emitter.rb
Instance Method Summary collapse
-
#initialize(anchor: nil, passphrase: nil) ⇒ Emitter
constructor
A new instance of Emitter.
- #next_token! ⇒ Object
Constructor Details
#initialize(anchor: nil, passphrase: nil) ⇒ Emitter
Returns a new instance of Emitter.
6 7 8 |
# File 'lib/token_chain/emitter.rb', line 6 def initialize(anchor: nil, passphrase: nil) @emitter = weigh_anchor(anchor, passphrase) end |
Instance Method Details
#next_token! ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/token_chain/emitter.rb', line 10 def next_token! anchor = @emitter.anchor previous_token = @emitter.last_consumed_token generator = Generator.new(anchor, previous_token) generator.generate.tap do |token| @emitter.last_consumed_token = token @emitter.save end end |