Class: WelltreatStoreFramework::HamlRenderer::Context
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Paths
#asset_path, #image_path, #javascript_path, #sprockets_enabled?, #stylesheet_path
Methods included from Partial
#partial
Methods included from TagsHelper
#content_tag, #image_tag, #javascript_include_tag, #link_to, #strip_tags, #stylesheet_link_tag, #truncate
#lorem
Constructor Details
#initialize(app, request, response, options) ⇒ Context
Returns a new instance of Context.
80
81
82
83
84
85
86
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 80
def initialize(app, request, response, options)
@app = app
@request = request
@response = response
@options = options || { }
@locals = { }
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
78
79
80
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 78
def options
@options
end
|
#request ⇒ Object
Returns the value of attribute request.
78
79
80
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 78
def request
@request
end
|
#response ⇒ Object
Returns the value of attribute response.
78
79
80
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 78
def response
@response
end
|
Instance Method Details
#alert ⇒ Object
116
117
118
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 116
def alert
get_flash :alert
end
|
#app ⇒ Object
88
89
90
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 88
def app;
@app
end
|
#flash ⇒ Object
140
141
142
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 140
def flash
options[:session][:flash] ||= { }
end
|
#flash_exist? ⇒ Boolean
124
125
126
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 124
def flash_exist?
notice || alert || success
end
|
#get_flash(k) ⇒ Object
128
129
130
131
132
133
134
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 128
def get_flash(k)
@flash_values ||= { }
@flash_values[k] ||= flash[k]
flash[k] = nil if @flash_values[k].present?
@flash_values[k]
end
|
#get_local(k) ⇒ Object
96
97
98
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 96
def get_local(k)
@locals[k]
end
|
#local_exists?(k) ⇒ Boolean
100
101
102
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 100
def local_exists?(k)
@locals.include?(k)
end
|
#local_present?(k) ⇒ Boolean
104
105
106
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 104
def local_present?(k)
local_exists?(k) && get_local(k).present?
end
|
#notice ⇒ Object
112
113
114
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 112
def notice
get_flash :notice
end
|
#session ⇒ Object
108
109
110
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 108
def session
options[:session]
end
|
#set_flash(k, v) ⇒ Object
136
137
138
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 136
def set_flash(k, v)
flash[k] = v
end
|
#set_local(k, v) ⇒ Object
92
93
94
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 92
def set_local(k, v)
@locals[k] = v
end
|
#success ⇒ Object
120
121
122
|
# File 'lib/welltreat_store_framework/haml_renderer.rb', line 120
def success
get_flash :success
end
|