module RemindStore
Constants
- KEY
- PLUGIN
Public Instance Methods
Source
# File lib/remind_store.rb, line 35 def add(network:, channel:, entry:, store: RabbotDb) entries = list(network: network, channel: channel, store: store) entries << entry save_all(network: network, channel: channel, entries: entries, store: store) entry end
Source
# File lib/remind_store.rb, line 48 def due_entries(network:, channel:, now: Time.now, store: RabbotDb) list(network: network, channel: channel, store: store).select do |entry| at = store.parse_time(entry["at"]) at && at <= now end end
Source
# File lib/remind_store.rb, line 15 def get_all(network:, channel:, store: RabbotDb) store.get_plugin_json( plugin: PLUGIN, key: KEY, network: network, channel: channel, default: [] ) end
Source
# File lib/remind_store.rb, line 11 def list(network:, channel:, store: RabbotDb) Array(get_all(network: network, channel: channel, store: store)) end
Source
# File lib/remind_store.rb, line 42 def remove(network:, channel:, id:, store: RabbotDb) entries = list(network: network, channel: channel, store: store) entries.reject! { |entry| entry["id"] == id.to_s } save_all(network: network, channel: channel, entries: entries, store: store) end
Source
# File lib/remind_store.rb, line 25 def save_all(network:, channel:, entries:, store: RabbotDb) store.set_plugin_json( plugin: PLUGIN, key: KEY, network: network, channel: channel, value: entries ) end