peachy 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/peachy.rb +1 -0
- data/lib/peachy/mimic.rb +7 -0
- data/lib/peachy/morph_into_array.rb +2 -7
- data/lib/peachy/proxy.rb +1 -2
- data/lib/peachy/version.rb +1 -1
- metadata +5 -6
data/lib/peachy.rb
CHANGED
@@ -8,6 +8,7 @@ require File.join(File.dirname(__FILE__), 'peachy/convention_checks')
|
|
8
8
|
require File.join(File.dirname(__FILE__), 'peachy/string_styler')
|
9
9
|
require File.join(File.dirname(__FILE__), 'peachy/method_name')
|
10
10
|
require File.join(File.dirname(__FILE__), 'peachy/method_mask')
|
11
|
+
require File.join(File.dirname(__FILE__), 'peachy/mimic')
|
11
12
|
require File.join(File.dirname(__FILE__), 'peachy/morph_into_array')
|
12
13
|
require File.join(File.dirname(__FILE__), 'peachy/my_meta_class')
|
13
14
|
require File.join(File.dirname(__FILE__), 'peachy/xml_node')
|
data/lib/peachy/mimic.rb
ADDED
@@ -10,13 +10,8 @@ module Peachy
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def mimic object_to_mimic
|
13
|
-
|
14
|
-
|
15
|
-
define_method(:method_missing) do |method_name, *args, &block|
|
16
|
-
puts "[Peachy::Proxy] #{node_name} can only do '#{method_name}' with '#{args}' if an Array can. You see, really, #{node_name} is an array now." if Peachy.whiny?
|
17
|
-
return object_to_mimic.send(method_name, *args, &block)
|
18
|
-
end
|
19
|
-
end
|
13
|
+
@mimicked = object_to_mimic
|
14
|
+
eval_on_singleton_class { include Mimic }
|
20
15
|
end
|
21
16
|
|
22
17
|
def morph_into_array to_add_to_array, method_to_invoke, *args, &block
|
data/lib/peachy/proxy.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Peachy
|
2
2
|
class Proxy
|
3
|
-
alias_method :original_method_missing, :method_missing
|
4
3
|
extend MethodMask
|
5
4
|
include ConventionChecks, MorphIntoArray, MyMetaClass, XmlNode
|
6
5
|
|
@@ -69,7 +68,7 @@ module Peachy
|
|
69
68
|
end
|
70
69
|
|
71
70
|
# standard method_missing for any other call with arguments or a block
|
72
|
-
|
71
|
+
super if args.any? or block_given?
|
73
72
|
|
74
73
|
# try to create a method for the element
|
75
74
|
child_proxy = generate_method_for_xml(MethodName.new(method_name))
|
data/lib/peachy/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- NJ Pearman
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/peachy/convention_checks.rb
|
36
36
|
- lib/peachy/childless_proxy_with_attributes.rb
|
37
37
|
- lib/peachy/method_name.rb
|
38
|
+
- lib/peachy/mimic.rb
|
38
39
|
- lib/peachy/method_mask.rb
|
39
40
|
- lib/peachy/proxy_factory.rb
|
40
41
|
- lib/peachy/simple_content.rb
|
@@ -92,10 +93,8 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
93
|
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
segments:
|
95
|
-
-
|
96
|
-
|
97
|
-
- 7
|
98
|
-
version: 1.8.7
|
96
|
+
- 0
|
97
|
+
version: "0"
|
99
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
99
|
requirements:
|
101
100
|
- - ">="
|