meta_methods 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.idea/workspace.xml +93 -40
- data/Rakefile +4 -0
- data/lib/meta_methods/meta_methods.rb +20 -14
- data/lib/meta_methods/version.rb +1 -1
- metadata +2 -2
data/.idea/workspace.xml
CHANGED
@@ -3,9 +3,6 @@
|
|
3
3
|
<component name="ChangeListManager">
|
4
4
|
<list default="true" id="cb96d5fa-a536-45ee-8377-2c11e1c06313" name="Default" comment="">
|
5
5
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
6
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/meta_methods/meta_methods.rb" afterPath="$PROJECT_DIR$/lib/meta_methods/meta_methods.rb" />
|
7
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/meta_methods/version.rb" afterPath="$PROJECT_DIR$/lib/meta_methods/version.rb" />
|
8
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/meta_methods.gemspec" afterPath="$PROJECT_DIR$/meta_methods.gemspec" />
|
9
6
|
</list>
|
10
7
|
<ignored path="meta_methods.iws" />
|
11
8
|
<ignored path=".idea/workspace.xml" />
|
@@ -45,46 +42,46 @@
|
|
45
42
|
</provider>
|
46
43
|
</entry>
|
47
44
|
</file>
|
48
|
-
<file leaf-file-name="meta_methods.gemspec" pinned="false" current="
|
45
|
+
<file leaf-file-name="meta_methods.gemspec" pinned="false" current="true" current-in-tab="true">
|
49
46
|
<entry file="file://$PROJECT_DIR$/meta_methods.gemspec">
|
50
47
|
<provider selected="true" editor-type-id="text-editor">
|
51
|
-
<state line="7" column="76" selection-start="331" selection-end="331" vertical-scroll-proportion="0.
|
48
|
+
<state line="7" column="76" selection-start="331" selection-end="331" vertical-scroll-proportion="0.1815235">
|
52
49
|
<folding />
|
53
50
|
</state>
|
54
51
|
</provider>
|
55
52
|
</entry>
|
56
53
|
</file>
|
57
|
-
<file leaf-file-name="
|
58
|
-
<entry file="file://$PROJECT_DIR$/meta_methods.
|
54
|
+
<file leaf-file-name="version.rb" pinned="false" current="false" current-in-tab="false">
|
55
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods/version.rb">
|
59
56
|
<provider selected="true" editor-type-id="text-editor">
|
60
|
-
<state line="
|
57
|
+
<state line="3" column="44" selection-start="43" selection-end="43" vertical-scroll-proportion="0.0">
|
61
58
|
<folding />
|
62
59
|
</state>
|
63
60
|
</provider>
|
64
61
|
</entry>
|
65
62
|
</file>
|
66
|
-
<file leaf-file-name="
|
67
|
-
<entry file="file://$PROJECT_DIR$/
|
63
|
+
<file leaf-file-name="Rakefile" pinned="false" current="false" current-in-tab="false">
|
64
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
68
65
|
<provider selected="true" editor-type-id="text-editor">
|
69
|
-
<state line="
|
66
|
+
<state line="24" column="0" selection-start="474" selection-end="548" vertical-scroll-proportion="0.0">
|
70
67
|
<folding />
|
71
68
|
</state>
|
72
69
|
</provider>
|
73
70
|
</entry>
|
74
71
|
</file>
|
75
|
-
<file leaf-file-name="
|
76
|
-
<entry file="file://$PROJECT_DIR$/
|
72
|
+
<file leaf-file-name="meta_methods.rb" pinned="false" current="false" current-in-tab="false">
|
73
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods/meta_methods.rb">
|
77
74
|
<provider selected="true" editor-type-id="text-editor">
|
78
|
-
<state line="
|
75
|
+
<state line="56" column="0" selection-start="1363" selection-end="1363" vertical-scroll-proportion="0.0">
|
79
76
|
<folding />
|
80
77
|
</state>
|
81
78
|
</provider>
|
82
79
|
</entry>
|
83
80
|
</file>
|
84
|
-
<file leaf-file-name="
|
85
|
-
<entry file="file://$PROJECT_DIR$/
|
81
|
+
<file leaf-file-name="meta_methods_spec.rb" pinned="false" current="false" current-in-tab="false">
|
82
|
+
<entry file="file://$PROJECT_DIR$/spec/meta_methods_spec.rb">
|
86
83
|
<provider selected="true" editor-type-id="text-editor">
|
87
|
-
<state line="
|
84
|
+
<state line="10" column="16" selection-start="155" selection-end="155" vertical-scroll-proportion="0.0">
|
88
85
|
<folding />
|
89
86
|
</state>
|
90
87
|
</provider>
|
@@ -109,9 +106,9 @@
|
|
109
106
|
<option value="$PROJECT_DIR$/README.md" />
|
110
107
|
<option value="$PROJECT_DIR$/meta_methods-template.gemspec" />
|
111
108
|
<option value="$PROJECT_DIR$/meta_methods.gemspec" />
|
112
|
-
<option value="$PROJECT_DIR$/Rakefile" />
|
113
109
|
<option value="$PROJECT_DIR$/Gemfile" />
|
114
110
|
<option value="$PROJECT_DIR$/meta_methods.gemspec.erb" />
|
111
|
+
<option value="$PROJECT_DIR$/Rakefile" />
|
115
112
|
<option value="$PROJECT_DIR$/lib/meta_methods/version.rb" />
|
116
113
|
<option value="$PROJECT_DIR$/lib/meta_methods/meta_methods.rb" />
|
117
114
|
</list>
|
@@ -149,7 +146,6 @@
|
|
149
146
|
<sortByType />
|
150
147
|
</navigator>
|
151
148
|
<panes>
|
152
|
-
<pane id="Scope" />
|
153
149
|
<pane id="ProjectPane">
|
154
150
|
<subPane>
|
155
151
|
<PATH>
|
@@ -168,6 +164,20 @@
|
|
168
164
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
169
165
|
</PATH_ELEMENT>
|
170
166
|
</PATH>
|
167
|
+
<PATH>
|
168
|
+
<PATH_ELEMENT>
|
169
|
+
<option name="myItemId" value="meta_methods" />
|
170
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
171
|
+
</PATH_ELEMENT>
|
172
|
+
<PATH_ELEMENT>
|
173
|
+
<option name="myItemId" value="meta_methods" />
|
174
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
175
|
+
</PATH_ELEMENT>
|
176
|
+
<PATH_ELEMENT>
|
177
|
+
<option name="myItemId" value="spec" />
|
178
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
179
|
+
</PATH_ELEMENT>
|
180
|
+
</PATH>
|
171
181
|
<PATH>
|
172
182
|
<PATH_ELEMENT>
|
173
183
|
<option name="myItemId" value="meta_methods" />
|
@@ -202,9 +212,45 @@
|
|
202
212
|
</PATH>
|
203
213
|
</subPane>
|
204
214
|
</pane>
|
215
|
+
<pane id="Scope" />
|
205
216
|
</panes>
|
206
217
|
</component>
|
207
|
-
<component name="
|
218
|
+
<component name="PropertiesComponent">
|
219
|
+
<property name="recentsLimit" value="5" />
|
220
|
+
</component>
|
221
|
+
<component name="RunManager" selected="RSpec.MetaMethodsDemo should evaluate content">
|
222
|
+
<configuration default="false" name="MetaMethodsDemo should evaluate content" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
223
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
224
|
+
<module name="meta_methods" />
|
225
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
226
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$/spec" />
|
227
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
228
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
229
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
230
|
+
<envs>
|
231
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
232
|
+
</envs>
|
233
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
234
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
235
|
+
<COVERAGE_PATTERN ENABLED="true">
|
236
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
237
|
+
</COVERAGE_PATTERN>
|
238
|
+
</EXTENSION>
|
239
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
240
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$PROJECT_DIR$/spec/meta_methods_spec.rb" />
|
241
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
242
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
243
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="MetaMethodsDemo should evaluate content" />
|
244
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
245
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
246
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
247
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
248
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
249
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
250
|
+
<RunnerSettings RunnerId="RubyRunner" />
|
251
|
+
<ConfigurationWrapper RunnerId="RubyRunner" />
|
252
|
+
<method />
|
253
|
+
</configuration>
|
208
254
|
<configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
|
209
255
|
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
210
256
|
<module name="" />
|
@@ -275,23 +321,30 @@
|
|
275
321
|
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
|
276
322
|
<method />
|
277
323
|
</configuration>
|
278
|
-
<list size="
|
324
|
+
<list size="1">
|
325
|
+
<item index="0" class="java.lang.String" itemvalue="RSpec.MetaMethodsDemo should evaluate content" />
|
326
|
+
</list>
|
327
|
+
<recent_temporary>
|
328
|
+
<list size="1">
|
329
|
+
<item index="0" class="java.lang.String" itemvalue="RSpec.MetaMethodsDemo should evaluate content" />
|
330
|
+
</list>
|
331
|
+
</recent_temporary>
|
279
332
|
</component>
|
280
333
|
<component name="ShelveChangesManager" show_recycled="false" />
|
281
334
|
<component name="ToolWindowManager">
|
282
335
|
<frame x="240" y="142" width="1588" height="1058" extended-state="0" />
|
283
|
-
<editor active="
|
336
|
+
<editor active="false" />
|
284
337
|
<layout>
|
285
|
-
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="
|
338
|
+
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298647" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
286
339
|
<window_info id="CSS-X-Fire" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
287
340
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
288
341
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
|
289
342
|
<window_info id="jenkinsBrowser" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
290
|
-
<window_info id="Project" active="
|
343
|
+
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.67013526" order="0" side_tool="false" content_ui="combo" />
|
291
344
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
292
345
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
293
346
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
294
|
-
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.
|
347
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298647" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
295
348
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
296
349
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
297
350
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
@@ -359,11 +412,6 @@
|
|
359
412
|
<breakpoint-manager />
|
360
413
|
</component>
|
361
414
|
<component name="editorHistoryManager">
|
362
|
-
<entry file="file://$PROJECT_DIR$/lib/meta_methods.rb">
|
363
|
-
<provider selected="true" editor-type-id="text-editor">
|
364
|
-
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
|
365
|
-
</provider>
|
366
|
-
</entry>
|
367
415
|
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.2-p318@global/gems/bundler-1.1.3/lib/bundler/environment.rb">
|
368
416
|
<provider selected="true" editor-type-id="text-editor">
|
369
417
|
<state line="25" column="8" selection-start="499" selection-end="499" vertical-scroll-proportion="0.273906" />
|
@@ -418,37 +466,42 @@
|
|
418
466
|
</state>
|
419
467
|
</provider>
|
420
468
|
</entry>
|
421
|
-
<entry file="file://$PROJECT_DIR$/
|
469
|
+
<entry file="file://$PROJECT_DIR$/meta_methods.gemspec.erb">
|
422
470
|
<provider selected="true" editor-type-id="text-editor">
|
423
|
-
<state line="
|
471
|
+
<state line="13" column="8" selection-start="548" selection-end="548" vertical-scroll-proportion="0.35135135" />
|
472
|
+
</provider>
|
473
|
+
</entry>
|
474
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods/meta_methods.rb">
|
475
|
+
<provider selected="true" editor-type-id="text-editor">
|
476
|
+
<state line="56" column="0" selection-start="1363" selection-end="1363" vertical-scroll-proportion="0.0">
|
424
477
|
<folding />
|
425
478
|
</state>
|
426
479
|
</provider>
|
427
480
|
</entry>
|
428
|
-
<entry file="file://$PROJECT_DIR$/
|
481
|
+
<entry file="file://$PROJECT_DIR$/spec/meta_methods_spec.rb">
|
429
482
|
<provider selected="true" editor-type-id="text-editor">
|
430
|
-
<state line="
|
483
|
+
<state line="10" column="16" selection-start="155" selection-end="155" vertical-scroll-proportion="0.0">
|
431
484
|
<folding />
|
432
485
|
</state>
|
433
486
|
</provider>
|
434
487
|
</entry>
|
435
|
-
<entry file="file://$PROJECT_DIR$/meta_methods.
|
488
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods/version.rb">
|
436
489
|
<provider selected="true" editor-type-id="text-editor">
|
437
|
-
<state line="
|
490
|
+
<state line="3" column="44" selection-start="43" selection-end="43" vertical-scroll-proportion="0.0">
|
438
491
|
<folding />
|
439
492
|
</state>
|
440
493
|
</provider>
|
441
494
|
</entry>
|
442
|
-
<entry file="file://$PROJECT_DIR$/
|
495
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
443
496
|
<provider selected="true" editor-type-id="text-editor">
|
444
|
-
<state line="
|
497
|
+
<state line="24" column="0" selection-start="474" selection-end="548" vertical-scroll-proportion="0.0">
|
445
498
|
<folding />
|
446
499
|
</state>
|
447
500
|
</provider>
|
448
501
|
</entry>
|
449
|
-
<entry file="file://$PROJECT_DIR$/
|
502
|
+
<entry file="file://$PROJECT_DIR$/meta_methods.gemspec">
|
450
503
|
<provider selected="true" editor-type-id="text-editor">
|
451
|
-
<state line="
|
504
|
+
<state line="7" column="76" selection-start="331" selection-end="331" vertical-scroll-proportion="0.1815235">
|
452
505
|
<folding />
|
453
506
|
</state>
|
454
507
|
</provider>
|
data/Rakefile
CHANGED
@@ -5,19 +5,19 @@ module MetaMethods
|
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
-
def define_attributes(type, object, hash,
|
8
|
+
def define_attributes(type, object, hash, create_instance=true)
|
9
9
|
hash.each_pair do |key, value|
|
10
|
-
define_attribute(type, object, key, value,
|
10
|
+
define_attribute(type, object, key, value, create_instance)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def define_attribute(type, object, key, value,
|
15
|
-
if
|
14
|
+
def define_attribute(type, object, key, value, create_instance=true)
|
15
|
+
if create_instance
|
16
16
|
metaclass(object).send type, key.to_sym
|
17
17
|
|
18
18
|
object.instance_variable_set("@#{key}".to_sym, value)
|
19
19
|
else
|
20
|
-
object.
|
20
|
+
metaclass(object).class_eval <<-CODE
|
21
21
|
def #{key}
|
22
22
|
"#{value}"
|
23
23
|
end
|
@@ -33,19 +33,13 @@ module MetaMethods
|
|
33
33
|
extract_values(defined_vars(scope), scope)
|
34
34
|
end
|
35
35
|
|
36
|
-
def evaluate_dsl(create_block, destroy_block, execute_block)
|
36
|
+
def evaluate_dsl(create_block, destroy_block, execute_block, access_block_scope=true)
|
37
37
|
object = nil
|
38
38
|
|
39
39
|
begin
|
40
40
|
object = create_block.kind_of?(Proc) ? create_block.call : create_block
|
41
|
-
object.instance_variable_set(:@execute_block, execute_block)
|
42
41
|
|
43
|
-
|
44
|
-
block_binding = @execute_block.binding
|
45
|
-
caller = block_binding.eval 'self'
|
46
|
-
|
47
|
-
caller.send sym, *args, &block
|
48
|
-
end
|
42
|
+
access_block_scope(object, @execute_block) if access_block_scope
|
49
43
|
|
50
44
|
object.instance_eval(&execute_block)
|
51
45
|
ensure
|
@@ -55,8 +49,20 @@ module MetaMethods
|
|
55
49
|
|
56
50
|
private
|
57
51
|
|
52
|
+
def access_block_scope object, block
|
53
|
+
object.instance_variable_set(:@execute_block, block)
|
54
|
+
|
55
|
+
def object.method_missing(sym, *args, &block)
|
56
|
+
block_binding = @execute_block.binding
|
57
|
+
|
58
|
+
caller = block_binding.eval 'self'
|
59
|
+
|
60
|
+
caller.send sym, *args, &block
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
58
64
|
def defined_vars scope
|
59
|
-
eval("local_variables", scope) - Kernel.local_variables -
|
65
|
+
eval("local_variables", scope) - Kernel.local_variables - %w(content)
|
60
66
|
end
|
61
67
|
|
62
68
|
def extract_values vars_list, scope
|
data/lib/meta_methods/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_methods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gemspec_deps_gen
|