entitize 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da0778eecad5364f3fe3884b162cdb9d3fa4f59c
4
- data.tar.gz: 7ab8eaf2c3171bd8938e3c07e4da26b266482fb1
3
+ metadata.gz: 68b75fd36291e1171baebb183c7fd0deba555202
4
+ data.tar.gz: ca3076415a27a43f6b2d50bba6bb9f8a016875f6
5
5
  SHA512:
6
- metadata.gz: 3b83b03861bf423f31b709daba129c552ce57618a48b77712606695b52e7a469f6497ccdcc6a78097c4877b7951bab534137d5c3658dfea02feb18015a811a2a
7
- data.tar.gz: ad1b7c0124fbc53b1c942f45c61eafa86ddff98daa63a717582fe756b49e7ca22f389917534b4354d0ead52fd144ccba43eb779a6249a8367b2a65f259466e5c
6
+ metadata.gz: ed52f0944221380ac6c1b1713e72341038483fd642497d5084c6daa7f857445299c6387bf963312114b847aaeacf8bead7eed9238e362b58592430f6490f6824
7
+ data.tar.gz: 13057b6bd494c493cb361776a8b99b0410e91b74ca051f0a32ff44c98a8ed5a98d19625216d9b97b730e20d4599ed9bf2fd30642691c122e8f478b1d47e6d411
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- entitize (0.1.3)
4
+ entitize (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,11 +11,16 @@ GEM
11
11
  i18n (>= 0.7, < 2)
12
12
  minitest (~> 5.1)
13
13
  tzinfo (~> 1.1)
14
+ coderay (1.1.2)
14
15
  concurrent-ruby (1.0.5)
15
16
  diff-lcs (1.3)
16
17
  i18n (1.0.1)
17
18
  concurrent-ruby (~> 1.0)
19
+ method_source (0.9.0)
18
20
  minitest (5.11.3)
21
+ pry (0.11.3)
22
+ coderay (~> 1.1.0)
23
+ method_source (~> 0.9.0)
19
24
  rake (10.5.0)
20
25
  rspec (3.7.0)
21
26
  rspec-core (~> 3.7.0)
@@ -41,6 +46,7 @@ DEPENDENCIES
41
46
  activesupport
42
47
  bundler (~> 1.16)
43
48
  entitize!
49
+ pry
44
50
  rake (~> 10.0)
45
51
  rspec (~> 3.0)
46
52
 
@@ -1,20 +1,19 @@
1
- # require 'pry'
2
-
3
1
  require 'active_support/inflector'
4
2
 
5
3
  require "entitize/version"
6
4
  require "entitize/repo"
7
5
  require "entitize/classifier"
6
+ require "entitize/entitizable"
8
7
  require "entitize/entity"
9
8
 
10
- module Bobs
9
+ module Entities
11
10
  end
12
11
 
13
12
  module Entitize
14
13
 
15
14
  # TODO: Make this customizable
16
15
  def self.base_class
17
- Bobs
16
+ Entities
18
17
  end
19
18
 
20
19
  end
@@ -27,6 +27,7 @@ module Entitize
27
27
  end
28
28
 
29
29
  def get_class(class_name, data)
30
+
30
31
  if base_class.const_defined?(class_name)
31
32
 
32
33
  klass = base_class.const_get(class_name)
@@ -37,7 +38,7 @@ module Entitize
37
38
  end
38
39
  else
39
40
  base_class.const_set(class_name, build(data))
40
- end.new(data)
41
+ end.auto_new(data)
41
42
  end
42
43
 
43
44
  def get_classes(class_name, data)
@@ -55,7 +56,7 @@ module Entitize
55
56
  end
56
57
 
57
58
  def build(data)
58
- Class.new do
59
+ Class.new(Entitize::Entity) do
59
60
  def initialize(data)
60
61
  Entitize::Classifier.define_methods(data, self)
61
62
  end
@@ -0,0 +1,27 @@
1
+ module Entitize
2
+ module Entitizable
3
+ module ClassMethods
4
+
5
+ def generate(data, class_name = nil)
6
+ Entitize::Classifier.generate(data, class_name)
7
+ end
8
+
9
+ def auto_new(*args, &block)
10
+ instance = allocate
11
+ instance.auto_initialize(*args, &block)
12
+ instance
13
+ end
14
+
15
+ end
16
+
17
+ def self.included(klass)
18
+ klass.extend(ClassMethods)
19
+ end
20
+
21
+
22
+ def auto_initialize(data)
23
+ Entitize::Classifier.define_methods(data, self)
24
+ end
25
+
26
+ end
27
+ end
@@ -1,15 +1,5 @@
1
1
  module Entitize
2
2
  class Entity
3
- class << self
4
-
5
- def generate(data, class_name)
6
- Entitize::Classifier.generate(data, class_name)
7
- end
8
-
9
- end # --> END CLASS METHODS
10
-
11
- def initialize(data)
12
- Entitize::Classifier.define_methods(data, self)
13
- end
3
+ include Entitize::Entitizable
14
4
  end
15
5
  end
@@ -1,3 +1,3 @@
1
1
  module Entitize
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entitize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Fiser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-18 00:00:00.000000000 Z
11
+ date: 2018-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,10 +71,10 @@ files:
71
71
  - Rakefile
72
72
  - bin/console
73
73
  - bin/setup
74
- - entitize-0.1.3.gem
75
74
  - entitize.gemspec
76
75
  - lib/entitize.rb
77
76
  - lib/entitize/classifier.rb
77
+ - lib/entitize/entitizable.rb
78
78
  - lib/entitize/entity.rb
79
79
  - lib/entitize/repo.rb
80
80
  - lib/entitize/version.rb
Binary file