jam-ruby 0.0.8 → 0.0.9

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/README.rdoc CHANGED
@@ -25,7 +25,7 @@ Standart Rails configuration:
25
25
  # app/views/posts/show.json.jam
26
26
  object @post do |p|
27
27
  {
28
- :body => p.downcase
28
+ :body => p.body.downcase
29
29
  }
30
30
  end
31
31
 
@@ -34,7 +34,7 @@ Standart Rails configuration:
34
34
  # app/views/posts/show.json.jam
35
35
  object @post, :only => [:title] do |p|
36
36
  {
37
- :body => p.downcase
37
+ :body => p.body.downcase
38
38
  }
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ Standart Rails configuration:
43
43
  # app/views/posts/index.json.jam
44
44
  collection @posts { |p|
45
45
  {
46
- :body => p.downcase
46
+ :body => p.body.downcase
47
47
  }
48
48
  }
49
49
 
@@ -69,7 +69,7 @@ Works like in Rails to_json:
69
69
 
70
70
  object @post, :root => :bost
71
71
 
72
- Other examples[link:https://github.com/edtsech/jam/tree/master/examples]
72
+ Other examples[https://github.com/edtsech/jam/tree/master/examples]
73
73
 
74
74
  == Contributions
75
75
 
@@ -77,8 +77,8 @@ We open for you contributions, suggestions and ideas.
77
77
 
78
78
  == Inspired by
79
79
 
80
- - Tequila[link:https://github.com/inem/tequila]
81
- - Rabl[link:https://github.com/nesquena/rabl]
80
+ - Tequila[https://github.com/inem/tequila]
81
+ - Rabl[https://github.com/nesquena/rabl]
82
82
 
83
83
  Some of code was borrowed from RABL.
84
84
 
data/lib/jam/builder.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Jam
2
2
  class Builder
3
- include ActionView::Helpers
4
3
 
5
4
  # Constructs a new engine based on given source and options
6
5
  #
@@ -78,6 +77,11 @@ module Jam
78
77
 
79
78
  protected
80
79
 
80
+ # Supports calling helpers defined for the template scope using method_missing hook
81
+ def method_missing(name, *args, &block)
82
+ @_scope.respond_to?(name) ? @_scope.send(name, *args, &block) : super
83
+ end
84
+
81
85
  def copy_instance_variables_from(object, exclude = []) #:nodoc:
82
86
  vars = object.instance_variables.map(&:to_s) - exclude.map(&:to_s)
83
87
  vars.each { |name| instance_variable_set(name, object.instance_variable_get(name)) }
@@ -0,0 +1,8 @@
1
+ class << ActionController::Base
2
+ def add_template_helper_with_jam(helper_module, *args, &block)
3
+ Jam::Builder.instance_eval { include helper_module }
4
+ add_template_helper_without_jam(helper_module, *args, &block)
5
+ end
6
+
7
+ alias_method_chain :add_template_helper, :jam
8
+ end
data/lib/jam.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), 'jam/template.rb')
2
2
  require File.join(File.dirname(__FILE__), 'jam/builder.rb')
3
+ require File.join(File.dirname(__FILE__), 'jam/controller.rb')
3
4
 
4
5
  module Jam
5
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jam-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Edward Tsech
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-19 00:00:00 +07:00
18
+ date: 2011-08-07 00:00:00 +07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -30,6 +30,7 @@ extra_rdoc_files: []
30
30
 
31
31
  files:
32
32
  - lib/jam/builder.rb
33
+ - lib/jam/controller.rb
33
34
  - lib/jam/template.rb
34
35
  - lib/jam.rb
35
36
  - MIT-LICENSE