Module: Rad::Face::Demo::ViewHelper
- Defined in:
- lib/face/demo/view_helper.rb
Instance Method Summary collapse
- #demo_metadata ⇒ Object
- #random_attachment ⇒ Object
- #samples ⇒ Object
- #t(key, options = {}) ⇒ Object
Instance Method Details
#demo_metadata ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/face/demo/view_helper.rb', line 10 def unless @demo_metadata logger.info "RAD complex calculation :demo_metadata called!" @demo_metadata = {} name = "#{template.directory_name}#{rad.face.themes_path}/#{theme.name}/demo_metadata.rb" if rad.environment.file_exist? name, rad.template.paths fname = rad.environment.find_file! name, rad.template.paths code = File.read fname @demo_metadata = eval code @demo_metadata.must_be.a Hash end @demo_metadata = @demo_metadata.to_openobject end @demo_metadata end |
#random_attachment ⇒ Object
26 27 28 |
# File 'lib/face/demo/view_helper.rb', line 26 def samples.[rand(samples..size)] end |
#samples ⇒ Object
2 3 4 |
# File 'lib/face/demo/view_helper.rb', line 2 def samples @samples end |
#t(key, options = {}) ⇒ Object
6 7 8 |
# File 'lib/face/demo/view_helper.rb', line 6 def t key, = {} key.to_s end |