Class: HamlCoffeeAssets::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/haml_coffee_assets/configuration.rb

Overview

Haml Coffee configuration object that contains the default values. It’s a plain Ruby object so a Sinatra app doesn’t have to depend on ActiveSupport just because of the Rails engine configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Constructor with defaults



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/haml_coffee_assets/configuration.rb', line 19

def initialize
  self.namespace              = 'window.JST'
  self.format                 = 'html5'
  self.uglify                 = false
  self.basename               = false
  self.escapeHtml             = true
  self.escapeAttributes       = true
  self.cleanValue             = true
  self.placement              = 'global'
  self.dependencies           = { hc: 'hamlcoffee_amd' }
  self.customHtmlEscape       = 'window.HAML.escape'
  self.customCleanValue       = 'window.HAML.cleanValue'
  self.customPreserve         = 'window.HAML.preserve'
  self.customFindAndPreserve  = 'window.HAML.findAndPreserve'
  self.customSurround         = 'window.HAML.surround'
  self.customSucceed          = 'window.HAML.succeed'
  self.customPrecede          = 'window.HAML.precede'
  self.customReference        = 'window.HAML.reference'
  self.preserveTags           = 'textarea,pre'
  self.selfCloseTags          = 'meta,img,link,br,hr,input,area,param,col,base'
  self.context                = 'window.HAML.context'
  self.templates_path         = 'app/assets/javascripts/templates'
  self.global_context_asset   = 'templates/context.js'
  self.name_filter            = lambda { |n|
    parts = n.sub(/^templates\//, '').split('/')
    parts.last.sub!(/^_/, '')
    parts.join('/')
  }
end

Instance Attribute Details

#basenameObject

Ignore path when generate the JST



63
64
65
# File 'lib/haml_coffee_assets/configuration.rb', line 63

def basename
  @basename
end

#cleanValueObject

Clean inline CoffeeScript values



75
76
77
# File 'lib/haml_coffee_assets/configuration.rb', line 75

def cleanValue
  @cleanValue
end

#contextObject

Custom global context to merge



127
128
129
# File 'lib/haml_coffee_assets/configuration.rb', line 127

def context
  @context
end

#customCleanValueObject

Custom global code clean value function



91
92
93
# File 'lib/haml_coffee_assets/configuration.rb', line 91

def customCleanValue
  @customCleanValue
end

#customFindAndPreserveObject

Custom find and preserve function



115
116
117
# File 'lib/haml_coffee_assets/configuration.rb', line 115

def customFindAndPreserve
  @customFindAndPreserve
end

#customHtmlEscapeObject

Custom global HTML escaping function



87
88
89
# File 'lib/haml_coffee_assets/configuration.rb', line 87

def customHtmlEscape
  @customHtmlEscape
end

#customPrecedeObject

Custom global precede function



103
104
105
# File 'lib/haml_coffee_assets/configuration.rb', line 103

def customPrecede
  @customPrecede
end

#customPreserveObject

Custom preserve function



107
108
109
# File 'lib/haml_coffee_assets/configuration.rb', line 107

def customPreserve
  @customPreserve
end

#customReferenceObject

Custom object reference function



111
112
113
# File 'lib/haml_coffee_assets/configuration.rb', line 111

def customReference
  @customReference
end

#customSucceedObject

Custom global succeed function



99
100
101
# File 'lib/haml_coffee_assets/configuration.rb', line 99

def customSucceed
  @customSucceed
end

#customSurroundObject

Custom global surround function



95
96
97
# File 'lib/haml_coffee_assets/configuration.rb', line 95

def customSurround
  @customSurround
end

#dependenciesObject

Define the global amd module dependencies



83
84
85
# File 'lib/haml_coffee_assets/configuration.rb', line 83

def dependencies
  @dependencies
end

#escapeAttributesObject

Escape template code output for attributes



71
72
73
# File 'lib/haml_coffee_assets/configuration.rb', line 71

def escapeAttributes
  @escapeAttributes
end

#escapeHtmlObject

Escape template code output



67
68
69
# File 'lib/haml_coffee_assets/configuration.rb', line 67

def escapeHtml
  @escapeHtml
end

#formatObject

Template format, either html5, html4 or xhtml



55
56
57
# File 'lib/haml_coffee_assets/configuration.rb', line 55

def format
  @format
end

#global_context_assetObject

Path to custom helpers shared by Rails and JS.



141
142
143
# File 'lib/haml_coffee_assets/configuration.rb', line 141

def global_context_asset
  @global_context_asset
end

#name_filterObject

A proc that is called to modify the template name used as the JST key. The proc is passed the name as an argument and should return the modified name (or unmodified) name.



133
134
135
# File 'lib/haml_coffee_assets/configuration.rb', line 133

def name_filter
  @name_filter
end

#namespaceObject

Template namespace



51
52
53
# File 'lib/haml_coffee_assets/configuration.rb', line 51

def namespace
  @namespace
end

#placementObject

Define the function placement, either ‘global` or `amd`



79
80
81
# File 'lib/haml_coffee_assets/configuration.rb', line 79

def placement
  @placement
end

#preserveTagsObject

List of tags to preserve



119
120
121
# File 'lib/haml_coffee_assets/configuration.rb', line 119

def preserveTags
  @preserveTags
end

#selfCloseTagsObject

List of self closing tags



123
124
125
# File 'lib/haml_coffee_assets/configuration.rb', line 123

def selfCloseTags
  @selfCloseTags
end

#templates_pathObject

Path to templates shared by Rails and JS.



137
138
139
# File 'lib/haml_coffee_assets/configuration.rb', line 137

def templates_path
  @templates_path
end

#uglifyObject

Uglify HTML output by skip indention



59
60
61
# File 'lib/haml_coffee_assets/configuration.rb', line 59

def uglify
  @uglify
end