mark_facets 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mark_facets.rb +1 -1
- data/lib/mark_facets/ruby/magic_attributes.rb +24 -0
- metadata +6 -4
data/lib/mark_facets.rb
CHANGED
@@ -6,7 +6,7 @@ path = File.join(File.dirname(__FILE__), 'mark_facets')
|
|
6
6
|
ruby_path = File.join(path, 'ruby')
|
7
7
|
rails_path = File.join(path, 'rails')
|
8
8
|
|
9
|
-
%w{ruby string hash big_decimal math file}.each do |f|
|
9
|
+
%w{ruby string hash big_decimal math file magic_attributes}.each do |f|
|
10
10
|
p = File.expand_path(File.join(ruby_path, f))
|
11
11
|
# puts p
|
12
12
|
require p
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module MagicAttributes
|
2
|
+
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def included(klass)
|
6
|
+
klass.class_eval do
|
7
|
+
attr_accessor :attributes
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(attributes = {})
|
14
|
+
self.attributes = attributes.to_mash
|
15
|
+
self.attributes.each do |k, v|
|
16
|
+
self.send("#{k}=", v) if self.respond_to?("#{k}=")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def method_missing(sym, *args, &block)
|
21
|
+
self.attributes.send(sym, *args)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.9
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- markbates
|
@@ -14,12 +14,11 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-30 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: hashie
|
22
|
-
prerelease: false
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
@@ -29,6 +28,7 @@ dependencies:
|
|
29
28
|
- 0
|
30
29
|
version: "0"
|
31
30
|
type: :runtime
|
31
|
+
prerelease: false
|
32
32
|
version_requirements: *id001
|
33
33
|
description: "mark_facets was developed by: markbates"
|
34
34
|
email: mark@markbates.com
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/mark_facets/ruby/big_decimal.rb
|
53
53
|
- lib/mark_facets/ruby/file.rb
|
54
54
|
- lib/mark_facets/ruby/hash.rb
|
55
|
+
- lib/mark_facets/ruby/magic_attributes.rb
|
55
56
|
- lib/mark_facets/ruby/math.rb
|
56
57
|
- lib/mark_facets/ruby/ruby.rb
|
57
58
|
- lib/mark_facets/ruby/string.rb
|
@@ -72,6 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
73
|
requirements:
|
73
74
|
- - ">="
|
74
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: -3572590871769718849
|
75
77
|
segments:
|
76
78
|
- 0
|
77
79
|
version: "0"
|