module Cardio
We could have used CommandsBase (and may yet move to that), but it’s worth noting that this might have caused its own confusion with CommandBase, a base class for classes that handle specific kinds of commands.
Constants
- Application
The application class from which card applications inherit
Public Class Methods
cache()
click to toggle source
# File lib/cardio.rb, line 36 def cache @cache ||= ::Rails.cache end
card_defined?()
click to toggle source
# File lib/cardio.rb, line 21 def card_defined? const_defined? "Card" end
database()
click to toggle source
# File lib/cardio.rb, line 40 def database @database ||= config.database_configuration.dig Rails.env, "database" end
gem_root()
click to toggle source
# File lib/cardio.rb, line 17 def gem_root @gem_root ||= File.expand_path "..", __dir__ end
load_card!()
click to toggle source
# File lib/cardio.rb, line 31 def load_card! require "card" ActiveSupport.run_load_hooks :after_card end
load_card?()
click to toggle source
# File lib/cardio.rb, line 25 def load_card? ActiveRecord::Base.connection && !card_defined? rescue StandardError false end
mods()
click to toggle source
# File lib/cardio.rb, line 44 def mods Mod.dirs.mods end
with_config(tmp) { || ... }
click to toggle source
# File lib/cardio.rb, line 48 def with_config tmp keep = tmp.keys.each_with_object({}) { |k, h| h[k] = config.send k } tmp.each { |k, v| config.send "#{k}=", v } yield ensure keep.each { |k, v| config.send "#{k}=", v } end