coded_attribute 0.0.2
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.
- data/MIT-LICENSE +20 -0
- data/Manifest +41 -0
- data/README +13 -0
- data/Rakefile +34 -0
- data/coded_attribute.gemspec +31 -0
- data/init.rb +5 -0
- data/install.rb +1 -0
- data/lib/coded_attributes.rb +34 -0
- data/rdoc/CodedAttributes.html +226 -0
- data/rdoc/README.html +96 -0
- data/rdoc/created.rid +3 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +58 -0
- data/rdoc/js/darkfish.js +116 -0
- data/rdoc/js/jquery.js +32 -0
- data/rdoc/js/quicksearch.js +114 -0
- data/rdoc/js/thickbox-compressed.js +10 -0
- data/rdoc/lib/coded_attributes_rb.html +55 -0
- data/rdoc/rdoc.css +706 -0
- data/test/coded_attributes_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +112 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
MIT-LICENSE
|
2
|
+
Manifest
|
3
|
+
README
|
4
|
+
Rakefile
|
5
|
+
coded_attribute.gemspec
|
6
|
+
init.rb
|
7
|
+
install.rb
|
8
|
+
lib/coded_attributes.rb
|
9
|
+
rdoc/CodedAttributes.html
|
10
|
+
rdoc/README.html
|
11
|
+
rdoc/created.rid
|
12
|
+
rdoc/images/brick.png
|
13
|
+
rdoc/images/brick_link.png
|
14
|
+
rdoc/images/bug.png
|
15
|
+
rdoc/images/bullet_black.png
|
16
|
+
rdoc/images/bullet_toggle_minus.png
|
17
|
+
rdoc/images/bullet_toggle_plus.png
|
18
|
+
rdoc/images/date.png
|
19
|
+
rdoc/images/find.png
|
20
|
+
rdoc/images/loadingAnimation.gif
|
21
|
+
rdoc/images/macFFBgHack.png
|
22
|
+
rdoc/images/package.png
|
23
|
+
rdoc/images/page_green.png
|
24
|
+
rdoc/images/page_white_text.png
|
25
|
+
rdoc/images/page_white_width.png
|
26
|
+
rdoc/images/plugin.png
|
27
|
+
rdoc/images/ruby.png
|
28
|
+
rdoc/images/tag_green.png
|
29
|
+
rdoc/images/wrench.png
|
30
|
+
rdoc/images/wrench_orange.png
|
31
|
+
rdoc/images/zoom.png
|
32
|
+
rdoc/index.html
|
33
|
+
rdoc/js/darkfish.js
|
34
|
+
rdoc/js/jquery.js
|
35
|
+
rdoc/js/quicksearch.js
|
36
|
+
rdoc/js/thickbox-compressed.js
|
37
|
+
rdoc/lib/coded_attributes_rb.html
|
38
|
+
rdoc/rdoc.css
|
39
|
+
test/coded_attributes_test.rb
|
40
|
+
test/test_helper.rb
|
41
|
+
uninstall.rb
|
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
|
7
|
+
desc 'Default: run unit tests.'
|
8
|
+
task :default => :test
|
9
|
+
|
10
|
+
Echoe.new('coded_attribute', '0.0.2') do |p|
|
11
|
+
p.description = "ActiveRecord plugin for storing coded variables"
|
12
|
+
p.url = "http://github.com/windigo77/coded_attribute"
|
13
|
+
p.author = "Jaden Carver"
|
14
|
+
p.email = "jaden.carver@gmail.com"
|
15
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
16
|
+
p.development_dependencies = []
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Test the coded_attributes plugin.'
|
20
|
+
Rake::TestTask.new(:test) do |t|
|
21
|
+
t.libs << 'lib'
|
22
|
+
t.libs << 'test'
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
t.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Generate documentation for the coded_attributes plugin.'
|
28
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
29
|
+
rdoc.rdoc_dir = 'rdoc'
|
30
|
+
rdoc.title = 'CodedAttributes'
|
31
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
32
|
+
rdoc.rdoc_files.include('README')
|
33
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{coded_attribute}
|
5
|
+
s.version = "0.0.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jaden Carver"]
|
9
|
+
s.date = %q{2010-11-06}
|
10
|
+
s.description = %q{ActiveRecord plugin for storing coded variables}
|
11
|
+
s.email = %q{jaden.carver@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["README", "lib/coded_attributes.rb"]
|
13
|
+
s.files = ["MIT-LICENSE", "Manifest", "README", "Rakefile", "coded_attribute.gemspec", "init.rb", "install.rb", "lib/coded_attributes.rb", "rdoc/CodedAttributes.html", "rdoc/README.html", "rdoc/created.rid", "rdoc/images/brick.png", "rdoc/images/brick_link.png", "rdoc/images/bug.png", "rdoc/images/bullet_black.png", "rdoc/images/bullet_toggle_minus.png", "rdoc/images/bullet_toggle_plus.png", "rdoc/images/date.png", "rdoc/images/find.png", "rdoc/images/loadingAnimation.gif", "rdoc/images/macFFBgHack.png", "rdoc/images/package.png", "rdoc/images/page_green.png", "rdoc/images/page_white_text.png", "rdoc/images/page_white_width.png", "rdoc/images/plugin.png", "rdoc/images/ruby.png", "rdoc/images/tag_green.png", "rdoc/images/wrench.png", "rdoc/images/wrench_orange.png", "rdoc/images/zoom.png", "rdoc/index.html", "rdoc/js/darkfish.js", "rdoc/js/jquery.js", "rdoc/js/quicksearch.js", "rdoc/js/thickbox-compressed.js", "rdoc/lib/coded_attributes_rb.html", "rdoc/rdoc.css", "test/coded_attributes_test.rb", "test/test_helper.rb", "uninstall.rb"]
|
14
|
+
s.homepage = %q{http://github.com/windigo77/coded_attribute}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Coded_attribute", "--main", "README"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{coded_attribute}
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
|
+
s.summary = %q{ActiveRecord plugin for storing coded variables}
|
20
|
+
s.test_files = ["test/test_helper.rb", "test/coded_attributes_test.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 3
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
data/init.rb
ADDED
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# CodedAttributes
|
2
|
+
|
3
|
+
module CodedAttributes
|
4
|
+
VERSION = 0.1
|
5
|
+
|
6
|
+
def coded_attribute(method, *attribute_or_codes)
|
7
|
+
if [String,Symbol].include?(attribute_or_codes.first.class)
|
8
|
+
attribute = attribute_or_codes.shift
|
9
|
+
else
|
10
|
+
attribute = :"#{method}_code"
|
11
|
+
end
|
12
|
+
|
13
|
+
if attribute_or_codes.first.class == Hash
|
14
|
+
codes = attribute_or_codes.shift
|
15
|
+
raise ArgumentError, "Too many arguments" unless attribute_or_codes.blank?
|
16
|
+
elsif attribute_or_codes.first.class == Array
|
17
|
+
codes = attribute_or_codes.shift.inject({}) { |h, v| h.merge! h.keys.count => v }
|
18
|
+
raise ArgumentError, "Too many arguments" unless attribute_or_codes.blank?
|
19
|
+
else
|
20
|
+
codes = attribute_or_codes.inject({}) { |h, v| h.merge! h.keys.count => v }
|
21
|
+
end
|
22
|
+
|
23
|
+
class_variable_set :"@@#{method}_codes", codes
|
24
|
+
cattr_reader :"#{method}_codes"
|
25
|
+
|
26
|
+
define_method :"#{method}" do
|
27
|
+
self.class.class_variable_get("@@#{method}_codes")[read_attribute(attribute)]
|
28
|
+
end
|
29
|
+
|
30
|
+
define_method :"#{method}=" do |value|
|
31
|
+
write_attribute(attribute, self.class.class_variable_get("@@#{method}_codes").key(value.to_sym))
|
32
|
+
end
|
33
|
+
end # def coded
|
34
|
+
end # module CodedAttributes
|
@@ -0,0 +1,226 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: CodedAttributes</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="./js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="./js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="./js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="module">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="./index.html">Home</a>
|
29
|
+
<a href="./index.html#classes">Classes</a>
|
30
|
+
<a href="./index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="./lib/coded_attributes_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/coded_attributes.rb">lib/coded_attributes.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
|
56
|
+
<!-- Namespace Contents -->
|
57
|
+
|
58
|
+
|
59
|
+
<!-- Method Quickref -->
|
60
|
+
|
61
|
+
<div id="method-list-section" class="section">
|
62
|
+
<h3 class="section-header">Methods</h3>
|
63
|
+
<ul class="link-list">
|
64
|
+
|
65
|
+
<li><a href="#method-i-coded_attribute">#coded_attribute</a></li>
|
66
|
+
|
67
|
+
</ul>
|
68
|
+
</div>
|
69
|
+
|
70
|
+
|
71
|
+
<!-- Included Modules -->
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div id="project-metadata">
|
76
|
+
|
77
|
+
|
78
|
+
<div id="fileindex-section" class="section project-section">
|
79
|
+
<h3 class="section-header">Files</h3>
|
80
|
+
<ul>
|
81
|
+
|
82
|
+
<li class="file"><a href="./README.html">README</a></li>
|
83
|
+
|
84
|
+
</ul>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
<div id="classindex-section" class="section project-section">
|
89
|
+
<h3 class="section-header">Class Index
|
90
|
+
<span class="search-toggle"><img src="./images/find.png"
|
91
|
+
height="16" width="16" alt="[+]"
|
92
|
+
title="show/hide quicksearch" /></span></h3>
|
93
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
94
|
+
<fieldset>
|
95
|
+
<legend>Quicksearch</legend>
|
96
|
+
<input type="text" name="quicksearch" value=""
|
97
|
+
class="quicksearch-field" />
|
98
|
+
</fieldset>
|
99
|
+
</form>
|
100
|
+
|
101
|
+
<ul class="link-list">
|
102
|
+
|
103
|
+
<li><a href="./CodedAttributes.html">CodedAttributes</a></li>
|
104
|
+
|
105
|
+
</ul>
|
106
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div id="documentation">
|
114
|
+
<h1 class="module">CodedAttributes</h1>
|
115
|
+
|
116
|
+
<div id="description">
|
117
|
+
<p>
|
118
|
+
<a href="CodedAttributes.html">CodedAttributes</a>
|
119
|
+
</p>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<!-- Constants -->
|
124
|
+
|
125
|
+
<div id="constants-list" class="section">
|
126
|
+
<h3 class="section-header">Constants</h3>
|
127
|
+
<dl>
|
128
|
+
|
129
|
+
<dt><a name="VERSION">VERSION</a></dt>
|
130
|
+
|
131
|
+
<dd class="description"></dd>
|
132
|
+
|
133
|
+
|
134
|
+
</dl>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
<!-- Attributes -->
|
139
|
+
|
140
|
+
|
141
|
+
<!-- Methods -->
|
142
|
+
|
143
|
+
<div id="public-instance-method-details" class="method-section section">
|
144
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
145
|
+
|
146
|
+
|
147
|
+
<div id="coded-attribute-method" class="method-detail ">
|
148
|
+
<a name="method-i-coded_attribute"></a>
|
149
|
+
|
150
|
+
<div class="method-heading">
|
151
|
+
|
152
|
+
<span class="method-name">coded_attribute</span><span
|
153
|
+
class="method-args">(method, *attribute_or_codes)</span>
|
154
|
+
<span class="method-click-advice">click to toggle source</span>
|
155
|
+
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div class="method-description">
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
<div class="method-source-code"
|
165
|
+
id="coded-attribute-source">
|
166
|
+
<pre>
|
167
|
+
<span class="ruby-comment cmt"># File lib/coded_attributes.rb, line 6</span>
|
168
|
+
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">coded_attribute</span>(<span class="ruby-identifier">method</span>, *<span class="ruby-identifier">attribute_or_codes</span>)
|
169
|
+
7: <span class="ruby-keyword kw">if</span> [<span class="ruby-constant">String</span>,<span class="ruby-constant">Symbol</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span>)
|
170
|
+
8: <span class="ruby-identifier">attribute</span> = <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">shift</span>
|
171
|
+
9: <span class="ruby-keyword kw">else</span>
|
172
|
+
10: <span class="ruby-identifier">attribute</span> = <span class="ruby-value">:"#{method}_code"</span>
|
173
|
+
11: <span class="ruby-keyword kw">end</span>
|
174
|
+
12:
|
175
|
+
13: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
176
|
+
14: <span class="ruby-identifier">codes</span> = <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">shift</span>
|
177
|
+
15: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Too many arguments"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">blank?</span>
|
178
|
+
16: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
|
179
|
+
17: <span class="ruby-identifier">codes</span> = <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">count</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">v</span> }
|
180
|
+
18: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Too many arguments"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">blank?</span>
|
181
|
+
19: <span class="ruby-keyword kw">else</span>
|
182
|
+
20: <span class="ruby-identifier">codes</span> = <span class="ruby-identifier">attribute_or_codes</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">count</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">v</span> }
|
183
|
+
21: <span class="ruby-keyword kw">end</span>
|
184
|
+
22:
|
185
|
+
23: <span class="ruby-identifier">class_variable_set</span> <span class="ruby-value">:"@@#{method}_codes"</span>, <span class="ruby-identifier">codes</span>
|
186
|
+
24: <span class="ruby-identifier">cattr_reader</span> <span class="ruby-value">:"#{method}_codes"</span>
|
187
|
+
25:
|
188
|
+
26: <span class="ruby-identifier">define_method</span> <span class="ruby-value">:"#{method}"</span> <span class="ruby-keyword kw">do</span>
|
189
|
+
27: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">class_variable_get</span>(<span class="ruby-node">"@@#{method}_codes"</span>)[<span class="ruby-identifier">read_attribute</span>(<span class="ruby-identifier">attribute</span>)]
|
190
|
+
28: <span class="ruby-keyword kw">end</span>
|
191
|
+
29:
|
192
|
+
30: <span class="ruby-identifier">define_method</span> <span class="ruby-value">:"#{method}="</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
193
|
+
31: <span class="ruby-identifier">write_attribute</span>(<span class="ruby-identifier">attribute</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">class_variable_get</span>(<span class="ruby-node">"@@#{method}_codes"</span>).<span class="ruby-identifier">key</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_sym</span>))
|
194
|
+
32: <span class="ruby-keyword kw">end</span>
|
195
|
+
33: <span class="ruby-keyword kw">end</span></pre>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
</div>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
|
206
|
+
</div>
|
207
|
+
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
|
212
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
213
|
+
|
214
|
+
<p>Disabled; run with --debug to generate this.</p>
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="validator-badges">
|
219
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
220
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
221
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
</body>
|
225
|
+
</html>
|
226
|
+
|
data/rdoc/README.html
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
8
|
+
|
9
|
+
<title>File: README [CodedAttributes]</title>
|
10
|
+
|
11
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
|
12
|
+
|
13
|
+
<script src="./js/jquery.js" type="text/javascript"
|
14
|
+
charset="utf-8"></script>
|
15
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
16
|
+
charset="utf-8"></script>
|
17
|
+
<script src="./js/quicksearch.js" type="text/javascript"
|
18
|
+
charset="utf-8"></script>
|
19
|
+
<script src="./js/darkfish.js" type="text/javascript"
|
20
|
+
charset="utf-8"></script>
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="./index.html">Home</a>
|
29
|
+
<a href="./index.html#classes">Classes</a>
|
30
|
+
<a href="./index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="project-metadata">
|
36
|
+
|
37
|
+
|
38
|
+
<div id="fileindex-section" class="section project-section">
|
39
|
+
<h3 class="section-header">Files</h3>
|
40
|
+
<ul>
|
41
|
+
|
42
|
+
<li class="file"><a href="./README.html">README</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
|
48
|
+
<div id="classindex-section" class="section project-section">
|
49
|
+
<h3 class="section-header">Class Index
|
50
|
+
<span class="search-toggle"><img src="./images/find.png"
|
51
|
+
height="16" width="16" alt="[+]"
|
52
|
+
title="show/hide quicksearch" /></span></h3>
|
53
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
54
|
+
<fieldset>
|
55
|
+
<legend>Quicksearch</legend>
|
56
|
+
<input type="text" name="quicksearch" value=""
|
57
|
+
class="quicksearch-field" />
|
58
|
+
</fieldset>
|
59
|
+
</form>
|
60
|
+
|
61
|
+
<ul class="link-list">
|
62
|
+
|
63
|
+
<li><a href="./CodedAttributes.html">CodedAttributes</a></li>
|
64
|
+
|
65
|
+
</ul>
|
66
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div id="documentation">
|
74
|
+
<p>
|
75
|
+
<a href="CodedAttributes.html">CodedAttributes</a>
|
76
|
+
</p>
|
77
|
+
<h6>Introduction goes here.</h6>
|
78
|
+
<p>
|
79
|
+
Example
|
80
|
+
</p>
|
81
|
+
<h6>Example goes here.</h6>
|
82
|
+
<p>
|
83
|
+
Copyright © 2010 [name of plugin creator], released under the MIT
|
84
|
+
license
|
85
|
+
</p>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<div id="validator-badges">
|
90
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
91
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
92
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
93
|
+
</div>
|
94
|
+
</body>
|
95
|
+
</html>
|
96
|
+
|
data/rdoc/created.rid
ADDED
Binary file
|
Binary file
|
data/rdoc/images/bug.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/rdoc/index.html
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
6
|
+
<head>
|
7
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
8
|
+
|
9
|
+
<title>CodedAttributes</title>
|
10
|
+
|
11
|
+
<link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
|
12
|
+
|
13
|
+
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
<script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
17
|
+
|
18
|
+
</head>
|
19
|
+
<body class="indexpage">
|
20
|
+
|
21
|
+
|
22
|
+
<h1>CodedAttributes</h1>
|
23
|
+
|
24
|
+
|
25
|
+
<p>This is the API documentation for 'CodedAttributes'.</p>
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
<h2>Files</h2>
|
31
|
+
<ul>
|
32
|
+
|
33
|
+
<li class="file"><a href="README.html">README</a></li>
|
34
|
+
|
35
|
+
</ul>
|
36
|
+
|
37
|
+
|
38
|
+
<h2 id="classes">Classes/Modules</h2>
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li class="module"><a href="CodedAttributes.html">CodedAttributes</a></li>
|
42
|
+
|
43
|
+
</ul>
|
44
|
+
|
45
|
+
<h2 id="methods">Methods</h2>
|
46
|
+
<ul>
|
47
|
+
|
48
|
+
<li><a href="CodedAttributes.html#method-i-coded_attribute">#coded_attribute — CodedAttributes</a></li>
|
49
|
+
|
50
|
+
</ul>
|
51
|
+
|
52
|
+
<div id="validator-badges">
|
53
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
54
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
55
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
56
|
+
</div>
|
57
|
+
</body>
|
58
|
+
</html>
|