ruhl 0.26.0 → 0.26.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.26.0
1
+ 0.26.1
data/lib/ruhl/engine.rb CHANGED
@@ -257,14 +257,27 @@ module Ruhl
257
257
  end
258
258
 
259
259
  def log_context(code)
260
- Ruhl.logger.error <<CONTEXT
260
+ error_message = <<CONTEXT
261
261
  Context:
262
262
  tag : #{current_tag.inspect}
263
263
  code : #{code.inspect}
264
- local_object : #{local_object.inspect}
265
- block_object : #{block_object.inspect}
266
- scope : #{scope.class}
267
264
  CONTEXT
265
+
266
+ error_message << " #{show_class_or_inspect('local_object')}\n"
267
+ error_message << " #{show_class_or_inspect('block_object')}\n"
268
+ error_message << " #{show_class_or_inspect('scope')}\n"
269
+
270
+ Ruhl.logger.error error_message
271
+ end
272
+
273
+ def show_class_or_inspect(object_str)
274
+ str = "#{object_str} : "
275
+
276
+ str + if Ruhl.send("inspect_#{object_str}")
277
+ send(object_str).inspect
278
+ else
279
+ send(object_str).class.to_s
280
+ end
268
281
  end
269
282
  end # Engine
270
283
  end # Ruhl
@@ -20,15 +20,13 @@ module Ruhl
20
20
  end
21
21
 
22
22
  def method_missing(name, *args)
23
- if presentee.respond_to?(name)
24
- # Pass presenter method call to model so you don't have to
25
- # redefine every model method in the presenter class.
26
- presentee.send(name, *args)
27
- elsif context.respond_to?(name)
28
- # Instead of saying context.link_to('Some site', some_path)
29
- # can just use link_to
30
- context.send(name, *args)
31
- end
23
+ # Pass presenter method call to model so you don't have to
24
+ # redefine every model method in the presenter class.
25
+ presentee.__send__(name, *args)
26
+ rescue NoMethodError
27
+ # Instead of saying context.link_to('Some site', some_path)
28
+ # can just use link_to
29
+ context.__send__(name, *args)
32
30
  end
33
31
 
34
32
  # Extend scope of respond_to? to model.
@@ -7,8 +7,11 @@ module Ruhl
7
7
 
8
8
  ruby = <<-RUBY
9
9
  before do
10
- f = File.basename("#{caller[0].split(':').first}")
11
- f = "#{app.views}/" + f.sub('_spec.rb','')
10
+ origin = "#{caller[0].split(':').first}"
11
+
12
+ f = origin.sub(/\\/spec\\//,'/app/')
13
+ f = f.sub('_spec.rb','')
14
+
12
15
  @view_nodes = Nokogiri::HTML.fragment(File.read(f))
13
16
  end
14
17
 
data/lib/ruhl.rb CHANGED
@@ -8,9 +8,15 @@ require 'ruhl/errors'
8
8
  module Ruhl
9
9
  class << self
10
10
  attr_accessor :logger, :encoding
11
+ attr_accessor :inspect_local_object, :inspect_block_object
12
+ attr_accessor :inspect_scope
11
13
  end
12
14
 
13
15
  self.logger = Logger.new(STDOUT)
14
16
 
15
- self.encoding = 'UTF8'
17
+ self.encoding = 'UTF-8'
18
+
19
+ self.inspect_local_object = false
20
+ self.inspect_block_object = false
21
+ self.inspect_scope = false
16
22
  end
data/ruhl.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruhl}
8
- s.version = "0.26.0"
8
+ s.version = "0.26.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Stone"]
12
- s.date = %q{2010-01-06}
12
+ s.date = %q{2010-01-14}
13
13
  s.description = %q{Make your HTML dynamic with the addition of a data-ruhl attribute.}
14
14
  s.email = %q{andy@stonean.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruhl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Stone
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-06 00:00:00 -05:00
12
+ date: 2010-01-14 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency