meta_methods 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/cssxfire.xml +9 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/meta_methods.iml +19 -0
- data/.idea/misc.xml +8 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +486 -0
- data/.rvmrc +4 -0
- data/CHANGES +5 -0
- data/Gemfile +15 -0
- data/LICENSE +22 -0
- data/README.md +34 -0
- data/Rakefile +34 -0
- data/lib/meta_methods/meta_methods.rb +73 -0
- data/lib/meta_methods/version.rb +3 -0
- data/lib/meta_methods.rb +3 -0
- data/meta_methods.gemspec +24 -0
- data/meta_methods.gemspec.erb +22 -0
- data/spec/meta_methods_spec.rb +18 -0
- metadata +100 -0
data/.gitignore
ADDED
data/.idea/.name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
meta_methods
|
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.idea/cssxfire.xml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="CssXFireSettings">
|
4
|
+
<general autoClear="false" autoExpand="false" />
|
5
|
+
<strategy useRoutes="false" mediaReduce="false" fileReduce="false" currentDocumentsReduce="false" resolveVariables="true" resolveMixins="true" />
|
6
|
+
<routes />
|
7
|
+
</component>
|
8
|
+
</project>
|
9
|
+
|
data/.idea/encodings.xml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager">
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
5
|
+
<orderEntry type="inheritedJdk" />
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
7
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.1.3, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
8
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.1.3, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
9
|
+
<orderEntry type="library" scope="PROVIDED" name="gemcutter (v0.7.1, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="gemspec_deps_gen (v1.0.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.1, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="mocha (v0.10.3, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v2.9.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.9.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.9.1, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.9.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
17
|
+
</component>
|
18
|
+
</module>
|
19
|
+
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectResources">
|
4
|
+
<default-html-doctype>$APPLICATION_HOME_DIR$/lib/rubymine.jar!/resources/html5-schema/html5.rnc</default-html-doctype>
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.3-p194 [meta_methods]" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
8
|
+
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/meta_methods.iml" filepath="$PROJECT_DIR$/.idea/meta_methods.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
9
|
+
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,486 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="cb96d5fa-a536-45ee-8377-2c11e1c06313" name="Default" comment="">
|
5
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/meta_methods.iml" afterPath="$PROJECT_DIR$/.idea/meta_methods.iml" />
|
6
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
7
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Gemfile" afterPath="$PROJECT_DIR$/Gemfile" />
|
8
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Rakefile" afterPath="$PROJECT_DIR$/Rakefile" />
|
9
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/meta_methods/version.rb" afterPath="$PROJECT_DIR$/lib/meta_methods/version.rb" />
|
10
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/meta_methods.gemspec.erb" afterPath="$PROJECT_DIR$/meta_methods.gemspec.erb" />
|
11
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/meta_methods.gemspec" afterPath="$PROJECT_DIR$/meta_methods.gemspec" />
|
12
|
+
</list>
|
13
|
+
<ignored path="meta_methods.iws" />
|
14
|
+
<ignored path=".idea/workspace.xml" />
|
15
|
+
<option name="TRACKING_ENABLED" value="true" />
|
16
|
+
<option name="SHOW_DIALOG" value="false" />
|
17
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
18
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
19
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
20
|
+
</component>
|
21
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
22
|
+
<component name="CreatePatchCommitExecutor">
|
23
|
+
<option name="PATCH_PATH" value="" />
|
24
|
+
</component>
|
25
|
+
<component name="DaemonCodeAnalyzer">
|
26
|
+
<disable_hints />
|
27
|
+
</component>
|
28
|
+
<component name="FavoritesManager">
|
29
|
+
<favorites_list name="meta_methods" />
|
30
|
+
</component>
|
31
|
+
<component name="FileEditorManager">
|
32
|
+
<leaf>
|
33
|
+
<file leaf-file-name=".rvmrc" pinned="false" current="false" current-in-tab="false">
|
34
|
+
<entry file="file://$PROJECT_DIR$/.rvmrc">
|
35
|
+
<provider selected="true" editor-type-id="text-editor">
|
36
|
+
<state line="3" column="13" selection-start="70" selection-end="70" vertical-scroll-proportion="0.0">
|
37
|
+
<folding />
|
38
|
+
</state>
|
39
|
+
</provider>
|
40
|
+
</entry>
|
41
|
+
</file>
|
42
|
+
<file leaf-file-name="Rakefile" pinned="false" current="false" current-in-tab="false">
|
43
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
44
|
+
<provider selected="true" editor-type-id="text-editor">
|
45
|
+
<state line="6" column="14" selection-start="165" selection-end="165" vertical-scroll-proportion="0.0">
|
46
|
+
<folding />
|
47
|
+
</state>
|
48
|
+
</provider>
|
49
|
+
</entry>
|
50
|
+
</file>
|
51
|
+
<file leaf-file-name="Gemfile" pinned="false" current="false" current-in-tab="false">
|
52
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
53
|
+
<provider selected="true" editor-type-id="text-editor">
|
54
|
+
<state line="8" column="16" selection-start="105" selection-end="105" vertical-scroll-proportion="0.0">
|
55
|
+
<folding />
|
56
|
+
</state>
|
57
|
+
</provider>
|
58
|
+
</entry>
|
59
|
+
</file>
|
60
|
+
<file leaf-file-name="version.rb" pinned="false" current="false" current-in-tab="false">
|
61
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods/version.rb">
|
62
|
+
<provider selected="true" editor-type-id="text-editor">
|
63
|
+
<state line="1" column="18" selection-start="37" selection-end="37" vertical-scroll-proportion="0.0">
|
64
|
+
<folding />
|
65
|
+
</state>
|
66
|
+
</provider>
|
67
|
+
</entry>
|
68
|
+
</file>
|
69
|
+
<file leaf-file-name="meta_methods.gemspec" pinned="false" current="false" current-in-tab="false">
|
70
|
+
<entry file="file://$PROJECT_DIR$/meta_methods.gemspec">
|
71
|
+
<provider selected="true" editor-type-id="text-editor">
|
72
|
+
<state line="16" column="11" selection-start="723" selection-end="723" vertical-scroll-proportion="0.0">
|
73
|
+
<folding />
|
74
|
+
</state>
|
75
|
+
</provider>
|
76
|
+
</entry>
|
77
|
+
</file>
|
78
|
+
<file leaf-file-name="meta_methods.gemspec.erb" pinned="false" current="true" current-in-tab="true">
|
79
|
+
<entry file="file://$PROJECT_DIR$/meta_methods.gemspec.erb">
|
80
|
+
<provider selected="true" editor-type-id="text-editor">
|
81
|
+
<state line="18" column="33" selection-start="787" selection-end="787" vertical-scroll-proportion="0.4864865">
|
82
|
+
<folding />
|
83
|
+
</state>
|
84
|
+
</provider>
|
85
|
+
</entry>
|
86
|
+
</file>
|
87
|
+
<file leaf-file-name="LICENSE" pinned="false" current="false" current-in-tab="false">
|
88
|
+
<entry file="file://$PROJECT_DIR$/LICENSE">
|
89
|
+
<provider selected="true" editor-type-id="text-editor">
|
90
|
+
<state line="21" column="42" selection-start="1051" selection-end="1051" vertical-scroll-proportion="0.0">
|
91
|
+
<folding />
|
92
|
+
</state>
|
93
|
+
</provider>
|
94
|
+
</entry>
|
95
|
+
</file>
|
96
|
+
<file leaf-file-name="README.md" pinned="false" current="false" current-in-tab="false">
|
97
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
98
|
+
<provider selected="true" editor-type-id="text-editor">
|
99
|
+
<state line="0" column="65" selection-start="65" selection-end="65" vertical-scroll-proportion="0.0">
|
100
|
+
<folding />
|
101
|
+
</state>
|
102
|
+
</provider>
|
103
|
+
</entry>
|
104
|
+
</file>
|
105
|
+
</leaf>
|
106
|
+
</component>
|
107
|
+
<component name="FindManager">
|
108
|
+
<FindUsagesManager>
|
109
|
+
<setting name="OPEN_NEW_TAB" value="false" />
|
110
|
+
</FindUsagesManager>
|
111
|
+
</component>
|
112
|
+
<component name="Git.Settings">
|
113
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
114
|
+
</component>
|
115
|
+
<component name="IdeDocumentHistory">
|
116
|
+
<option name="changedFiles">
|
117
|
+
<list>
|
118
|
+
<option value="$PROJECT_DIR$/.gitignore" />
|
119
|
+
<option value="$PROJECT_DIR$/CHANGES" />
|
120
|
+
<option value="$PROJECT_DIR$/.rvmrc" />
|
121
|
+
<option value="$PROJECT_DIR$/README.md" />
|
122
|
+
<option value="$PROJECT_DIR$/meta_methods-template.gemspec" />
|
123
|
+
<option value="$PROJECT_DIR$/meta_methods.gemspec" />
|
124
|
+
<option value="$PROJECT_DIR$/Rakefile" />
|
125
|
+
<option value="$PROJECT_DIR$/Gemfile" />
|
126
|
+
<option value="$PROJECT_DIR$/lib/meta_methods/version.rb" />
|
127
|
+
<option value="$PROJECT_DIR$/meta_methods.gemspec.erb" />
|
128
|
+
</list>
|
129
|
+
</option>
|
130
|
+
</component>
|
131
|
+
<component name="ProjectFrameBounds">
|
132
|
+
<option name="x" value="240" />
|
133
|
+
<option name="y" value="282" />
|
134
|
+
<option name="width" value="1588" />
|
135
|
+
<option name="height" value="1058" />
|
136
|
+
</component>
|
137
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
138
|
+
<OptionsSetting value="true" id="Add" />
|
139
|
+
<OptionsSetting value="true" id="Remove" />
|
140
|
+
<OptionsSetting value="true" id="Checkout" />
|
141
|
+
<OptionsSetting value="true" id="Update" />
|
142
|
+
<OptionsSetting value="true" id="Status" />
|
143
|
+
<OptionsSetting value="true" id="Edit" />
|
144
|
+
<ConfirmationsSetting value="0" id="Add" />
|
145
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
146
|
+
</component>
|
147
|
+
<component name="ProjectReloadState">
|
148
|
+
<option name="STATE" value="0" />
|
149
|
+
</component>
|
150
|
+
<component name="ProjectView">
|
151
|
+
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
|
152
|
+
<flattenPackages />
|
153
|
+
<showMembers />
|
154
|
+
<showModules />
|
155
|
+
<showLibraryContents />
|
156
|
+
<hideEmptyPackages />
|
157
|
+
<abbreviatePackageNames />
|
158
|
+
<autoscrollToSource ProjectPane="true" />
|
159
|
+
<autoscrollFromSource ProjectPane="true" />
|
160
|
+
<sortByType />
|
161
|
+
</navigator>
|
162
|
+
<panes>
|
163
|
+
<pane id="ProjectPane">
|
164
|
+
<subPane>
|
165
|
+
<PATH>
|
166
|
+
<PATH_ELEMENT>
|
167
|
+
<option name="myItemId" value="meta_methods" />
|
168
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
169
|
+
</PATH_ELEMENT>
|
170
|
+
</PATH>
|
171
|
+
<PATH>
|
172
|
+
<PATH_ELEMENT>
|
173
|
+
<option name="myItemId" value="meta_methods" />
|
174
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
175
|
+
</PATH_ELEMENT>
|
176
|
+
<PATH_ELEMENT>
|
177
|
+
<option name="myItemId" value="meta_methods" />
|
178
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
179
|
+
</PATH_ELEMENT>
|
180
|
+
</PATH>
|
181
|
+
<PATH>
|
182
|
+
<PATH_ELEMENT>
|
183
|
+
<option name="myItemId" value="meta_methods" />
|
184
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
185
|
+
</PATH_ELEMENT>
|
186
|
+
<PATH_ELEMENT>
|
187
|
+
<option name="myItemId" value="meta_methods" />
|
188
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
189
|
+
</PATH_ELEMENT>
|
190
|
+
<PATH_ELEMENT>
|
191
|
+
<option name="myItemId" value="lib" />
|
192
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
193
|
+
</PATH_ELEMENT>
|
194
|
+
</PATH>
|
195
|
+
<PATH>
|
196
|
+
<PATH_ELEMENT>
|
197
|
+
<option name="myItemId" value="meta_methods" />
|
198
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
199
|
+
</PATH_ELEMENT>
|
200
|
+
<PATH_ELEMENT>
|
201
|
+
<option name="myItemId" value="meta_methods" />
|
202
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
203
|
+
</PATH_ELEMENT>
|
204
|
+
<PATH_ELEMENT>
|
205
|
+
<option name="myItemId" value="lib" />
|
206
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
207
|
+
</PATH_ELEMENT>
|
208
|
+
<PATH_ELEMENT>
|
209
|
+
<option name="myItemId" value="meta_methods" />
|
210
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
211
|
+
</PATH_ELEMENT>
|
212
|
+
</PATH>
|
213
|
+
</subPane>
|
214
|
+
</pane>
|
215
|
+
<pane id="Scope" />
|
216
|
+
</panes>
|
217
|
+
</component>
|
218
|
+
<component name="RunManager">
|
219
|
+
<configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
|
220
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
221
|
+
<module name="" />
|
222
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
223
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
224
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
225
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
226
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
227
|
+
<envs />
|
228
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
229
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
230
|
+
<COVERAGE_PATTERN ENABLED="true">
|
231
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
232
|
+
</COVERAGE_PATTERN>
|
233
|
+
</EXTENSION>
|
234
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
235
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
236
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
237
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
238
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
239
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
240
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
241
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
242
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
243
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
244
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
245
|
+
<method />
|
246
|
+
</configuration>
|
247
|
+
<configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby">
|
248
|
+
<module name="" />
|
249
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
250
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="" />
|
251
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
252
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
253
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
254
|
+
<envs />
|
255
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
256
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
257
|
+
<COVERAGE_PATTERN ENABLED="true">
|
258
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
259
|
+
</COVERAGE_PATTERN>
|
260
|
+
</EXTENSION>
|
261
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="" />
|
262
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
263
|
+
<method />
|
264
|
+
</configuration>
|
265
|
+
<configuration default="true" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest">
|
266
|
+
<predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
|
267
|
+
<module name="" />
|
268
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
269
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
270
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
271
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
272
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
273
|
+
<envs />
|
274
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
275
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
276
|
+
<COVERAGE_PATTERN ENABLED="true">
|
277
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
278
|
+
</COVERAGE_PATTERN>
|
279
|
+
</EXTENSION>
|
280
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
281
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
282
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
|
283
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
|
284
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
285
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
286
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
|
287
|
+
<method />
|
288
|
+
</configuration>
|
289
|
+
<list size="0" />
|
290
|
+
<recent_temporary>
|
291
|
+
<list size="0" />
|
292
|
+
</recent_temporary>
|
293
|
+
</component>
|
294
|
+
<component name="ShelveChangesManager" show_recycled="false" />
|
295
|
+
<component name="ToolWindowManager">
|
296
|
+
<frame x="240" y="282" width="1588" height="1058" extended-state="0" />
|
297
|
+
<editor active="true" />
|
298
|
+
<layout>
|
299
|
+
<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" />
|
300
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3298647" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
301
|
+
<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" />
|
302
|
+
<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" />
|
303
|
+
<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" />
|
304
|
+
<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" />
|
305
|
+
<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" />
|
306
|
+
<window_info id="Messages" 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" />
|
307
|
+
<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" />
|
308
|
+
<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" />
|
309
|
+
<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" />
|
310
|
+
<window_info id="Project" active="false" 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" />
|
311
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
312
|
+
<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" />
|
313
|
+
<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" />
|
314
|
+
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
315
|
+
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
316
|
+
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
317
|
+
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
318
|
+
</layout>
|
319
|
+
</component>
|
320
|
+
<component name="VcsContentAnnotationSettings">
|
321
|
+
<option name="myLimit" value="2678400000" />
|
322
|
+
</component>
|
323
|
+
<component name="VcsManagerConfiguration">
|
324
|
+
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
|
325
|
+
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
|
326
|
+
<option name="CHECK_NEW_TODO" value="true" />
|
327
|
+
<option name="myTodoPanelSettings">
|
328
|
+
<value>
|
329
|
+
<are-packages-shown value="false" />
|
330
|
+
<are-modules-shown value="false" />
|
331
|
+
<flatten-packages value="false" />
|
332
|
+
<is-autoscroll-to-source value="false" />
|
333
|
+
</value>
|
334
|
+
</option>
|
335
|
+
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
|
336
|
+
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
|
337
|
+
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
|
338
|
+
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
|
339
|
+
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
|
340
|
+
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
|
341
|
+
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
|
342
|
+
<option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
|
343
|
+
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
|
344
|
+
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
|
345
|
+
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
|
346
|
+
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
|
347
|
+
<option name="SHORT_DIFF_HORISONTALLY" value="true" />
|
348
|
+
<option name="SHORT_DIFF_EXTRA_LINES" value="2" />
|
349
|
+
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
|
350
|
+
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
|
351
|
+
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
|
352
|
+
<option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
|
353
|
+
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
|
354
|
+
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
|
355
|
+
<option name="CHANGE_DETAILS_ON" value="false" />
|
356
|
+
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
357
|
+
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
|
358
|
+
<option name="LAST_COMMIT_MESSAGE" />
|
359
|
+
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
|
360
|
+
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
361
|
+
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
|
362
|
+
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
363
|
+
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
364
|
+
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
365
|
+
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
366
|
+
<option name="ACTIVE_VCS_NAME" />
|
367
|
+
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
|
368
|
+
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
|
369
|
+
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
370
|
+
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
371
|
+
</component>
|
372
|
+
<component name="XDebuggerManager">
|
373
|
+
<breakpoint-manager />
|
374
|
+
</component>
|
375
|
+
<component name="editorHistoryManager">
|
376
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods.rb">
|
377
|
+
<provider selected="true" editor-type-id="text-editor">
|
378
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
|
379
|
+
</provider>
|
380
|
+
</entry>
|
381
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods/meta_methods.rb">
|
382
|
+
<provider selected="true" editor-type-id="text-editor">
|
383
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
384
|
+
<folding />
|
385
|
+
</state>
|
386
|
+
</provider>
|
387
|
+
</entry>
|
388
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.2-p318@global/gems/bundler-1.1.3/lib/bundler/environment.rb">
|
389
|
+
<provider selected="true" editor-type-id="text-editor">
|
390
|
+
<state line="25" column="8" selection-start="499" selection-end="499" vertical-scroll-proportion="0.273906">
|
391
|
+
<folding />
|
392
|
+
</state>
|
393
|
+
</provider>
|
394
|
+
</entry>
|
395
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.2-p318@global/gems/bundler-1.1.3/lib/bundler/definition.rb">
|
396
|
+
<provider selected="true" editor-type-id="text-editor">
|
397
|
+
<state line="4" column="8" selection-start="60" selection-end="60" vertical-scroll-proportion="0.10372771">
|
398
|
+
<folding />
|
399
|
+
</state>
|
400
|
+
</provider>
|
401
|
+
</entry>
|
402
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.2-p318@global/gems/bundler-1.1.3/lib/bundler.rb">
|
403
|
+
<provider selected="true" editor-type-id="text-editor">
|
404
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
405
|
+
<folding />
|
406
|
+
</state>
|
407
|
+
</provider>
|
408
|
+
</entry>
|
409
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
410
|
+
<provider selected="true" editor-type-id="text-editor">
|
411
|
+
<state line="0" column="65" selection-start="65" selection-end="65" vertical-scroll-proportion="0.0">
|
412
|
+
<folding />
|
413
|
+
</state>
|
414
|
+
</provider>
|
415
|
+
</entry>
|
416
|
+
<entry file="file://$PROJECT_DIR$/LICENSE">
|
417
|
+
<provider selected="true" editor-type-id="text-editor">
|
418
|
+
<state line="21" column="42" selection-start="1051" selection-end="1051" vertical-scroll-proportion="0.0">
|
419
|
+
<folding />
|
420
|
+
</state>
|
421
|
+
</provider>
|
422
|
+
</entry>
|
423
|
+
<entry file="file://$USER_HOME$/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/erb.rb">
|
424
|
+
<provider selected="true" editor-type-id="text-editor">
|
425
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
426
|
+
<folding />
|
427
|
+
</state>
|
428
|
+
</provider>
|
429
|
+
</entry>
|
430
|
+
<entry file="file://$PROJECT_DIR$/.rvmrc">
|
431
|
+
<provider selected="true" editor-type-id="text-editor">
|
432
|
+
<state line="3" column="13" selection-start="70" selection-end="70" vertical-scroll-proportion="0.0">
|
433
|
+
<folding />
|
434
|
+
</state>
|
435
|
+
</provider>
|
436
|
+
</entry>
|
437
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
438
|
+
<provider selected="true" editor-type-id="text-editor">
|
439
|
+
<state line="18" column="0" selection-start="164" selection-end="164" vertical-scroll-proportion="0.31578946" />
|
440
|
+
</provider>
|
441
|
+
</entry>
|
442
|
+
<entry file="file://$PROJECT_DIR$/CHANGES">
|
443
|
+
<provider selected="true" editor-type-id="text-editor">
|
444
|
+
<state line="2" column="16" selection-start="42" selection-end="42" vertical-scroll-proportion="0.051863857">
|
445
|
+
<folding />
|
446
|
+
</state>
|
447
|
+
</provider>
|
448
|
+
</entry>
|
449
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
450
|
+
<provider selected="true" editor-type-id="text-editor">
|
451
|
+
<state line="6" column="14" selection-start="165" selection-end="165" vertical-scroll-proportion="0.0">
|
452
|
+
<folding />
|
453
|
+
</state>
|
454
|
+
</provider>
|
455
|
+
</entry>
|
456
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
457
|
+
<provider selected="true" editor-type-id="text-editor">
|
458
|
+
<state line="8" column="16" selection-start="105" selection-end="105" vertical-scroll-proportion="0.0">
|
459
|
+
<folding />
|
460
|
+
</state>
|
461
|
+
</provider>
|
462
|
+
</entry>
|
463
|
+
<entry file="file://$PROJECT_DIR$/lib/meta_methods/version.rb">
|
464
|
+
<provider selected="true" editor-type-id="text-editor">
|
465
|
+
<state line="1" column="18" selection-start="37" selection-end="37" vertical-scroll-proportion="0.0">
|
466
|
+
<folding />
|
467
|
+
</state>
|
468
|
+
</provider>
|
469
|
+
</entry>
|
470
|
+
<entry file="file://$PROJECT_DIR$/meta_methods.gemspec">
|
471
|
+
<provider selected="true" editor-type-id="text-editor">
|
472
|
+
<state line="16" column="11" selection-start="723" selection-end="723" vertical-scroll-proportion="0.0">
|
473
|
+
<folding />
|
474
|
+
</state>
|
475
|
+
</provider>
|
476
|
+
</entry>
|
477
|
+
<entry file="file://$PROJECT_DIR$/meta_methods.gemspec.erb">
|
478
|
+
<provider selected="true" editor-type-id="text-editor">
|
479
|
+
<state line="18" column="33" selection-start="787" selection-end="787" vertical-scroll-proportion="0.4864865">
|
480
|
+
<folding />
|
481
|
+
</state>
|
482
|
+
</provider>
|
483
|
+
</entry>
|
484
|
+
</component>
|
485
|
+
</project>
|
486
|
+
|
data/.rvmrc
ADDED
data/CHANGES
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Alexander Shvets
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# MetaMethods - Collection of methods for easing meta-programming
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
gem 'meta_methods'
|
8
|
+
|
9
|
+
And then execute:
|
10
|
+
|
11
|
+
$ bundle
|
12
|
+
|
13
|
+
Or install it yourself as:
|
14
|
+
|
15
|
+
$ gem install meta_methods
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
class MyNewClass
|
20
|
+
include MetaMethods
|
21
|
+
|
22
|
+
def test
|
23
|
+
puts metaclass
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path("lib", File.dirname(__FILE__))
|
4
|
+
|
5
|
+
require "rspec/core/rake_task"
|
6
|
+
require "meta_methods/version"
|
7
|
+
require "gemspec_deps_gen/gemspec_deps_gen"
|
8
|
+
|
9
|
+
def version
|
10
|
+
MetaMethods::VERSION
|
11
|
+
end
|
12
|
+
|
13
|
+
def project_name
|
14
|
+
File.basename(Dir.pwd)
|
15
|
+
end
|
16
|
+
|
17
|
+
task :build do
|
18
|
+
generator = GemspecDepsGen.new
|
19
|
+
|
20
|
+
generator.generate_dependencies "#{project_name}.gemspec.erb", "#{project_name}.gemspec"
|
21
|
+
|
22
|
+
system "gem build #{project_name}.gemspec"
|
23
|
+
end
|
24
|
+
|
25
|
+
task :release => :build do
|
26
|
+
system "gem push #{project_name}-#{version}.gem"
|
27
|
+
end
|
28
|
+
|
29
|
+
RSpec::Core::RakeTask.new do |task|
|
30
|
+
task.pattern = 'spec/**/*_spec.rb'
|
31
|
+
task.verbose = false
|
32
|
+
end
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module MetaMethods
|
2
|
+
def metaclass object
|
3
|
+
class << object
|
4
|
+
self
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def define_attributes(type, object, hash, create_instance_variable=true)
|
9
|
+
hash.each_pair do |key, value|
|
10
|
+
define_attribute(type, object, key, value, create_instance_variable)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def define_attribute(type, object, key, value, create_instance_variable=true)
|
15
|
+
if create_instance_variable
|
16
|
+
metaclass(object).send type, key.to_sym
|
17
|
+
|
18
|
+
object.instance_variable_set("@#{key}".to_sym, value)
|
19
|
+
else
|
20
|
+
object.class_eval <<-CODE
|
21
|
+
def #{key}
|
22
|
+
"#{value}"
|
23
|
+
end
|
24
|
+
CODE
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def locals_to_hash object, content
|
29
|
+
scope = object.instance_eval { binding }
|
30
|
+
|
31
|
+
eval(content, scope)
|
32
|
+
|
33
|
+
extract_values(defined_vars(scope), scope)
|
34
|
+
end
|
35
|
+
|
36
|
+
def evaluate_dsl(create_block, destroy_block, execute_block)
|
37
|
+
object = nil
|
38
|
+
|
39
|
+
begin
|
40
|
+
object = create_block.kind_of?(Proc) ? create_block.call : create_block
|
41
|
+
|
42
|
+
object.instance_eval(&execute_block)
|
43
|
+
ensure
|
44
|
+
destroy_block.call(object) if destroy_block && object
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def defined_vars scope
|
51
|
+
eval("local_variables", scope) - Kernel.local_variables - ["content"]
|
52
|
+
end
|
53
|
+
|
54
|
+
def extract_values vars_list, scope
|
55
|
+
vars_values_list = vars_list.collect { |name| [name, get_property(name, scope)] }
|
56
|
+
|
57
|
+
hash = {}
|
58
|
+
vars_values_list.each do |var, value|
|
59
|
+
hash[var.to_sym] = value
|
60
|
+
end
|
61
|
+
|
62
|
+
hash
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_property name, scope
|
66
|
+
begin
|
67
|
+
eval(name.to_s, scope)
|
68
|
+
rescue NameError
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
data/lib/meta_methods.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/meta_methods/version')
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "meta_methods"
|
7
|
+
spec.summary = %q{Collection of methods for easing meta-programming}
|
8
|
+
spec.description = %q{Collection of methods for easing meta-programming}
|
9
|
+
spec.email = "alexander.shvets@gmail.com"
|
10
|
+
spec.authors = ["Alexander Shvets"]
|
11
|
+
spec.homepage = "http://github.com/shvets/meta_methods"
|
12
|
+
|
13
|
+
spec.files = `git ls-files`.split($\)
|
14
|
+
#spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
#gemspec.bindir = "bin"
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
spec.version = MetaMethods::VERSION
|
19
|
+
|
20
|
+
spec.add_development_dependency "gemspec_deps_gen", [">= 0"]
|
21
|
+
spec.add_development_dependency "gemcutter", [">= 0"]
|
22
|
+
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/meta_methods/version')
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "meta_methods"
|
7
|
+
spec.summary = %q{Collection of methods for easing meta-programming}
|
8
|
+
spec.description = %q{Collection of methods for easing meta-programming}
|
9
|
+
spec.email = "alexander.shvets@gmail.com"
|
10
|
+
spec.authors = ["Alexander Shvets"]
|
11
|
+
spec.homepage = "http://github.com/shvets/meta_methods"
|
12
|
+
|
13
|
+
spec.files = `git ls-files`.split($\)
|
14
|
+
#spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
#gemspec.bindir = "bin"
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
spec.version = MetaMethods::VERSION
|
19
|
+
|
20
|
+
<%= include_dependencies %>
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'meta_methods'
|
2
|
+
|
3
|
+
class MetaMethodsDemo
|
4
|
+
include MetaMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
describe MetaMethodsDemo do
|
8
|
+
|
9
|
+
it "should evaluate content" do
|
10
|
+
s = "a=1; b=2"
|
11
|
+
|
12
|
+
hash = subject.locals_to_hash subject, s
|
13
|
+
|
14
|
+
hash[:a].should == 1
|
15
|
+
hash[:b].should == 2
|
16
|
+
hash[:c].should be_nil
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: meta_methods
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alexander Shvets
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: gemspec_deps_gen
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: gemcutter
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Collection of methods for easing meta-programming
|
47
|
+
email: alexander.shvets@gmail.com
|
48
|
+
executables: []
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- .gitignore
|
53
|
+
- .idea/.name
|
54
|
+
- .idea/.rakeTasks
|
55
|
+
- .idea/cssxfire.xml
|
56
|
+
- .idea/encodings.xml
|
57
|
+
- .idea/meta_methods.iml
|
58
|
+
- .idea/misc.xml
|
59
|
+
- .idea/modules.xml
|
60
|
+
- .idea/scopes/scope_settings.xml
|
61
|
+
- .idea/vcs.xml
|
62
|
+
- .idea/workspace.xml
|
63
|
+
- .rvmrc
|
64
|
+
- CHANGES
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- lib/meta_methods.rb
|
70
|
+
- lib/meta_methods/meta_methods.rb
|
71
|
+
- lib/meta_methods/version.rb
|
72
|
+
- meta_methods.gemspec
|
73
|
+
- meta_methods.gemspec.erb
|
74
|
+
- spec/meta_methods_spec.rb
|
75
|
+
homepage: http://github.com/shvets/meta_methods
|
76
|
+
licenses: []
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 1.8.23
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: Collection of methods for easing meta-programming
|
99
|
+
test_files:
|
100
|
+
- spec/meta_methods_spec.rb
|