module DistanceFuelStore
Constants
- KEY
- PLUGIN
Public Instance Methods
Source
# File lib/distance_fuel_store.rb, line 16 def get(network:, nick:, store: RabbotDb) raw = store.get_plugin_value( plugin: PLUGIN, key: KEY, network: network, channel: nil, nick: nick ) return nil if raw.nil? || raw.to_s.strip.empty? raw.to_f end
Source
# File lib/distance_fuel_store.rb, line 42 def resolve(network:, nick:, store: RabbotDb, default:) stored = get(network: network, nick: nick, store: store) stored.nil? ? default : stored end
Source
# File lib/distance_fuel_store.rb, line 29 def set(network:, nick:, consumption:, store: RabbotDb) value = consumption.to_f store.set_plugin_value( plugin: PLUGIN, key: KEY, value: value.to_s, network: network, channel: nil, nick: nick ) value end