module Cardio
Cardio
is a quick loading module and is at the heart (get it?) of card loading and configuration because it is useful long before the Card
class is (or card objects are)
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
Source
# File lib/cardio.rb, line 43 def database @database ||= config.database_configuration.dig Rails.env, "database" end
Source
# File lib/cardio.rb, line 20 def gem_root @gem_root ||= File.expand_path "..", __dir__ end
Source
# File lib/cardio.rb, line 34 def load_card! require "card" ActiveSupport.run_load_hooks :after_card end
Source
# File lib/cardio.rb, line 28 def load_card? ActiveRecord::Base.connection && !card_defined? rescue StandardError false end
Source
# File lib/cardio.rb, line 51 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