Module: RKit

Extended by:
RKit
Included in:
RKit
Defined in:
lib/r_kit.rb,
lib/r_kit/version.rb

Defined Under Namespace

Classes: ActiveRecordUtility, Backtrace, Core, Css, Decoration, Dsl, Frame, Grid, Override, Pagination, Parser, Struct, Utility

Constant Summary collapse

VERSION =
'1.0.1'

Instance Method Summary collapse

Instance Method Details

#inspectObject



3
4
5
6
7
# File 'lib/r_kit.rb', line 3

def inspect
  "#{ name }"
  # TODO: add a brief, link to the doc, list of all services, and demo of inspect method for services
  # some kind of "--help" of unix commands
end

#load(*services) ⇒ Object

TODO: add a load priority order based on dependencies so if :X depend on :Y and I load like “.load :x, :y” it does not trigger the warn msg of dependency cause we first try to load :x, and :y is still not loaded instead, we detect that dependencie, and reorder the loading (so we just “require the core descriptive file”) to put :y before :x (double profit, this will keep config on :y, that iserwise would be lost)



19
20
21
# File 'lib/r_kit.rb', line 19

def load *services
  load_service_from Array.wrap(services)
end

#load_service_from(service) ⇒ Object



24
25
26
# File 'lib/r_kit.rb', line 24

def load_service_from service
  send "load_service_from_#{ service.class.name.underscore }", service
end

#load_service_from_array(services) ⇒ Object



28
29
30
31
32
# File 'lib/r_kit.rb', line 28

def load_service_from_array services
  services.each do |service|
    load_service_from service
  end
end

#load_service_from_hash(services) ⇒ Object



39
40
41
42
43
# File 'lib/r_kit.rb', line 39

def load_service_from_hash services
  services.each do |service, config = {}|
    load_service_from_symbol service, config: config
  end
end

#load_service_from_symbol(service, config: {}) ⇒ Object Also known as: load_service_from_string



34
35
36
# File 'lib/r_kit.rb', line 34

def load_service_from_symbol service, config: {}
  RKit.const_get(service.to_s.classify).load config
end