alki-support 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e79e4dbfb6e04f92d4b9298ee0538e2d6a49b51
4
- data.tar.gz: 6c63e0f671e0749899c23718d8a5ef439783c913
3
+ metadata.gz: 68a96f261d17f5d2b04b2854769c97b5d00bea30
4
+ data.tar.gz: dedd852862742d2589b9a9709a53925ba5417d31
5
5
  SHA512:
6
- metadata.gz: 954b82451d6429fd58d0d01b8b7982eea6a66fe629686b870b660d4fbfb04ca86e809679b96b725db3c0cdd9b4cd513fefafc7fe52edfb2526431d713823a57f
7
- data.tar.gz: dade4135f7ef06fa95dd6063adad1cd7115a65a0f4bfc6875165c506eec3aea0166a0086a6174e6cc0575f10c5840930b387cb9331d0292ac90053728850fd55
6
+ metadata.gz: ae6cdbb243009c56a924cf32e7e0ce984001ab383d92e6ea612346ae46818ef50ee2a2a6eb9e0cba9c9337db751a0260e57ed8e0a45713b83b258c6fe1c2178d
7
+ data.tar.gz: 5eeca462d9e01fa85fe6074ad5111e20ce045f2e51c373c5070bca9448c230243263c5f339eb996664af921a1b592275d731789543e7525af8421e985185da38
@@ -1,18 +1,32 @@
1
1
  require 'alki/support/version'
2
2
 
3
3
  module Alki
4
+ def self.load(name_or_obj)
5
+ Support.load name_or_obj
6
+ end
4
7
  module Support
5
- def self.load_class(klass)
6
- if klass.is_a?(String)
7
- name = klass
8
- class_name = classify klass
9
- klass = constantize class_name
10
- unless klass
11
- require name
12
- klass = constantize class_name
8
+ def self.load(name_or_obj)
9
+ if name_or_obj.is_a?(String)
10
+ name = name_or_obj
11
+ require name
12
+ obj = constantize classify name
13
+ else
14
+ obj = name_or_obj
15
+ end
16
+ obj
17
+ end
18
+
19
+ def self.create_constant(name, value, parent=nil)
20
+ parent ||= Object
21
+ *ans, ln = name.to_s.split('::')
22
+ ans.each do |a|
23
+ unless parent.const_defined? a
24
+ parent.const_set a, Module.new
13
25
  end
26
+ parent = parent.const_get a
14
27
  end
15
- klass
28
+
29
+ parent.const_set ln, value
16
30
  end
17
31
 
18
32
  def self.classify(str)
@@ -1,5 +1,5 @@
1
1
  module Alki
2
2
  module Support
3
- VERSION = '0.6.0'
3
+ VERSION = '0.7.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alki-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Edlefsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-17 00:00:00.000000000 Z
11
+ date: 2016-12-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Various helper methods for Alki
14
14
  email:
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
41
  version: '0'
42
42
  requirements: []
43
43
  rubyforge_project:
44
- rubygems_version: 2.5.1
44
+ rubygems_version: 2.5.2
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: Alki support methods