oop 0.4.0 → 1.0.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: 2aaca8a6b423ff2bccc411180331c5c8c1be89ff
4
- data.tar.gz: 19fee614c4f7c83a4201230669fb736d5657025e
3
+ metadata.gz: 05267ddf9d0e7add200bd12d9a7f13c965e1bdaa
4
+ data.tar.gz: da06c0733f88ff49adee2ee0ba8804b9722d2b17
5
5
  SHA512:
6
- metadata.gz: 4e38453713fe1d67ed64443835e8db36341852e00e59201ba4720d8d62660a14f7e39bc59d2558432b27ec88a896a74b62297c31074453fd5665306d3020dc08
7
- data.tar.gz: 32cddc73ed98d112b2a4e1a560ec0576be8bf7be6aee183ac3b247930d82cec4ae72710eea5d783a80003e3dd7d9f2c3d9ac10d1e9fa052a0d4118a069d179b5
6
+ metadata.gz: 1caf9191826055b629d3bf0ae94754903f27c185ac282e315f428abe8200015211a976a59e9034faf5508d1651065cfbe67f701a11ff8f620fccc7717ab9d7ea
7
+ data.tar.gz: 8e2bade109a12c98d1080c291bc2ac5cb27a3bc5a5e361dce6c6e80d57933501c14fd61164fca450bfa31c4d0fc4be86a604a2c5e0d32c2b2a4d1b634313b720
@@ -12,7 +12,7 @@ module OOP
12
12
  end
13
13
 
14
14
  def cast_to_value(arg)
15
- if arg.respond_to?(:super_mega_private_oop_method_valid?) && arg.super_mega_private_oop_method_valid?
15
+ if arg.respond_to?(:super_mega_private_oop_method_value?) && arg.super_mega_private_oop_method_value?
16
16
  return arg
17
17
  end
18
18
 
@@ -0,0 +1,56 @@
1
+ require 'oop/basic_rules'
2
+
3
+ module OOP
4
+ module CellObject
5
+ module ClassMethods
6
+ def message(meth, &block)
7
+ define_method(meth) do |*args, &blk|
8
+ args = args.map do |arg|
9
+ BasicRules.cast_to_value(arg)
10
+ end
11
+ BasicRules.cast_to_value(self.instance_exec(*(args + [blk]), &block))
12
+ end
13
+ end
14
+
15
+ def import(imports)
16
+ imports.each do |name, import|
17
+ define_method(name.to_sym) do
18
+ BasicRules.cast_to_value(import)
19
+ end
20
+ end
21
+ end
22
+
23
+ def constructor(*parts, &block)
24
+ define_method(:initialize) do |opts={}|
25
+ opts ||= {}
26
+ if block
27
+ block.call(opts)
28
+ end
29
+ extra_args = (opts.keys - parts)
30
+ missing_args = parts.select do |k|
31
+ !opts.has_key?(k) && !opts.has_key?(k)
32
+ end
33
+ if extra_args.any?
34
+ raise "extra args: #{extra_args}"
35
+ elsif missing_args.any?
36
+ raise "missing args: #{missing_args}"
37
+ end
38
+ @opts = opts;
39
+ opts.each do |k, v|
40
+ k = k.to_sym
41
+ @opts[k] = v
42
+ end
43
+ end
44
+ parts.each do |p|
45
+ define_method(p.to_sym) do
46
+ @opts[p]
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ def self.included(klass)
53
+ klass.extend(ClassMethods)
54
+ end
55
+ end
56
+ end
@@ -1,7 +1,7 @@
1
1
  require 'oop/basic_rules'
2
2
 
3
3
  module OOP
4
- module ValueCommunications
4
+ module ValueObject
5
5
  module ClassMethods
6
6
  def message(meth, &block)
7
7
  define_method(meth) do |*args, &blk|
@@ -49,7 +49,7 @@ module OOP
49
49
  end
50
50
  end
51
51
 
52
- def super_mega_private_oop_method_valid?
52
+ def super_mega_private_oop_method_value?
53
53
  true
54
54
  end
55
55
 
data/lib/oop/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OOP
2
- VERSION = "0.4.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serguei Filimonov
@@ -73,12 +73,11 @@ files:
73
73
  - lib/oop/basic_rules.rb
74
74
  - lib/oop/boundary.rb
75
75
  - lib/oop/cell.rb
76
- - lib/oop/ext.rb
76
+ - lib/oop/cell_object.rb
77
77
  - lib/oop/non_value_arg.rb
78
78
  - lib/oop/tools.rb
79
79
  - lib/oop/value.rb
80
- - lib/oop/value_communications.rb
81
- - lib/oop/value_interface.rb
80
+ - lib/oop/value_object.rb
82
81
  - lib/oop/value_provider.rb
83
82
  - lib/oop/version.rb
84
83
  - oop.gemspec
data/lib/oop/ext.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'oop/basic_rules'
2
- require 'oop/value_provider'
3
- require 'oop/value_interface'
4
- require 'oop/value_communications'
5
-
6
- class Class
7
- def acts_as_value
8
- include OOP::ValueCommunications
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- module OOP
2
- module ValueInterface
3
- def super_mega_private_oop_method_valid?
4
- true
5
- end
6
- end
7
- end