prospecto 0.0.9 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,10 +11,24 @@ module Prospecto
11
11
  end
12
12
  end
13
13
 
14
+ def method_missing(name, *args, &block)
15
+ if property_name = self.class.__properties.find{|m| name.to_s.start_with? "#{m}_"}
16
+ field_name = name.to_s.sub("#{property_name}_", "")
17
+ self.send(property_name).send(field_name)
18
+ else
19
+ super
20
+ end
21
+ end
22
+
14
23
  class << self
15
- # "Presents" means a member will be reflected out to the view
24
+ # "Presents" means a member will be reflected out to the view. Use of presents should be
25
+ # limited to very special cases.
16
26
  alias :presents :attr_reader
17
27
 
28
+ def __properties
29
+ @__properties ||= []
30
+ end
31
+
18
32
  # Accepts means the view uses the member internally, but it is not available
19
33
  # outside the class.
20
34
  def accepts(*args)
@@ -25,6 +39,15 @@ module Prospecto
25
39
  protected name
26
40
  end
27
41
  end
42
+
43
+ # Proxies means that the properties of the object can be accessed directly from this object
44
+ # when prefixed with the object name. (ie: @view.user_full_name)
45
+ def proxies(*args)
46
+ args.each do |name|
47
+ __properties << name
48
+ end
49
+ accepts(*args)
50
+ end
28
51
  end
29
52
  end
30
53
  end
@@ -1,3 +1,3 @@
1
1
  module Prospecto
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prospecto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70256414237120 !ruby/object:Gem::Requirement
16
+ requirement: &70320447511480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70256414237120
24
+ version_requirements: *70320447511480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &70256414236320 !ruby/object:Gem::Requirement
27
+ requirement: &70320447510460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70256414236320
35
+ version_requirements: *70320447510460
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: turn
38
- requirement: &70256414235640 !ruby/object:Gem::Requirement
38
+ requirement: &70320447509740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70256414235640
46
+ version_requirements: *70320447509740
47
47
  description: ''
48
48
  email:
49
49
  - bigjasonwebb@gmail.com
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: -40013224359218802
113
+ hash: -3688896391981247024
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements:
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: -40013224359218802
122
+ hash: -3688896391981247024
123
123
  requirements: []
124
124
  rubyforge_project:
125
125
  rubygems_version: 1.8.10