Class: Kit
- Inherits:
-
Object
- Object
- Kit
- Defined in:
- lib/kit.rb,
lib/kit/version.rb
Defined Under Namespace
Classes: Bit, Group, Permission, User
Constant Summary collapse
- VERSION =
Version number.
'1.2.0'
Class Method Summary collapse
-
.open(config_file) ⇒ Object
Load a kit with its configuration and connect to its database.
Instance Method Summary collapse
-
#config ⇒ Hash
Loads settings from the config file (only loads from file on first call).
-
#initialize(config_file) ⇒ Kit
constructor
Load a kit with its configuration.
-
#path ⇒ String
Determines and returns the kit’s root directory.
Constructor Details
#initialize(config_file) ⇒ Kit
Load a kit with its configuration.
15 16 17 18 19 20 |
# File 'lib/kit.rb', line 15 def initialize config_file @config_file = File.absolute_path config_file Dir["#{path}/models/*.rb"].each { |f| require f } require "#{path}/actions/default" Dir["#{path}/actions/*.rb"].each { |f| require f } end |
Class Method Details
.open(config_file) ⇒ Object
Load a kit with its configuration and connect to its database.
24 25 26 27 28 |
# File 'lib/kit.rb', line 24 def self.open config_file kit = self.new config_file kit.db_connect kit end |
Instance Method Details
#config ⇒ Hash
Loads settings from the config file (only loads from file on first call).
38 39 40 |
# File 'lib/kit.rb', line 38 def config @config ||= YAML.load File.read(@config_file) end |
#path ⇒ String
Determines and returns the kit’s root directory.
32 33 34 |
# File 'lib/kit.rb', line 32 def path @path ||= File.dirname @config_file end |