rango 0.1.1.2.4 → 0.1.1.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rango.rb CHANGED
@@ -78,6 +78,12 @@ module Rango
78
78
  self.bootloaders[name] = block
79
79
  end
80
80
 
81
+ # Rango.loaded?("environments.rb")
82
+ def loaded?(relative_path) # would work just with Kernel#require, not with Kernel#load, I know that the name may be misleading, but better than required?
83
+ full_path = File.expand_path(File.join(File.dirname(__FILE__), relative_path))
84
+ $LOADED_FEATURES.any? { |file| file == full_path }
85
+ end
86
+
81
87
  # Start IRB interactive session
82
88
  # @since 0.0.1
83
89
  def interactive
@@ -20,7 +20,8 @@ module Rango
20
20
  # @return [Hash] Hash of settings attributes.
21
21
  # TODO: maybe it should returns Rango::Settings?
22
22
  def merge(another)
23
- self.hattributes.merge(another.hattributes)
23
+ hattributes = another.is_a?(Hash) ? another : another.hattributes
24
+ self.hattributes.merge(hattributes)
24
25
  end
25
26
 
26
27
  # @since 0.0.1
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require "rango" # Rango.loaded?
3
4
  require "rango/settings"
4
5
 
5
6
  module Rango
@@ -11,7 +12,7 @@ module Rango
11
12
 
12
13
  # @since 0.0.2
13
14
  # Sets whether or not to escape HTML-sensitive characters in script. If this is true, = behaves like &=; otherwise, it behaves like !=. Note that if this is set, != should be used for yielding to subtemplates and rendering partials. Defaults to false.
14
- hattribute :escape_html, lambda { Project.settings.autoescape }
15
+ hattribute :escape_html, false
15
16
 
16
17
  # @since 0.0.2
17
18
  # Whether or not attribute hashes and Ruby scripts designated by = or ~ should be evaluated. If this is true, said scripts are rendered as empty strings. Defaults to false.
@@ -35,7 +36,7 @@ module Rango
35
36
 
36
37
  # @since 0.0.7
37
38
  # Haml now has an :ugly option, thanks to Wincent Colaiuta. This option forgoes pretty output formatting in favor of speed increases, which show up in particular when rendering deeply nested partials
38
- hattribute :ugly, lambda { not Rango.development? }
39
+ hattribute :ugly, lambda { Rango.loaded?("environments.rb") ? !Rango.development? : false }
39
40
 
40
41
  # @since 0.1.1
41
42
  # You don't have to explicitly specify attributes which are same for all the tags of same
@@ -30,7 +30,7 @@ module Rango
30
30
  # @since 0.0.2
31
31
  def fullpath
32
32
  @fullpath ||= begin
33
- if self.path.match(/^\//)
33
+ if self.path.match(/^(\/|\.)/) # /foo or ./foo
34
34
  Dir[self.path, "#{self.path}.*"].first
35
35
  else
36
36
  self.find_in_template_dirs
data/lib/rango/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # NOTE: Do not edit this file manually, this
4
4
  # file is regenerated by task rake version:increase
5
5
  module Rango
6
- VERSION ||= "0.1.1.2.4"
6
+ VERSION ||= "0.1.1.2.5"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rango
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.2.4
4
+ version: 0.1.1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"