Module: Rad::Face::Demo::ViewHelper

Defined in:
lib/face/demo/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#demo_metadataObject



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_attachmentObject



26
27
28
# File 'lib/face/demo/view_helper.rb', line 26

def random_attachment
  samples.attachments[rand(samples.attachments.size)]
end

#samplesObject



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, options = {}
  key.to_s
end