Module: Optimacms::PageServices::PageProcessService

Included in:
PageData
Defined in:
lib/optimacms/page_services/page_process_service.rb

Instance Method Summary collapse

Instance Method Details

#compile_content(page_content) ⇒ Object


5
6
7
8
9
10
# File 'lib/optimacms/page_services/page_process_service.rb', line 5

def compile_content(page_content)
  #res.gsub! /\{\{content\}\}/, page_content
  res = page_content

  res
end

#generate_view_nameObject


12
13
14
15
16
17
18
19
20
# File 'lib/optimacms/page_services/page_process_service.rb', line 12

def generate_view_name
  uid =SecureRandom.uuid.to_s
  id = uid.gsub /[^a-z\d]+/,''
  f_path = id+'.html.erb'
  #Digest::SHA1.hexdigest(Time.now.to_s)
  #filename = dir_cache+'/'+f_path
  f_path
  #'pages/2.html.erb'
end

#save_text_to_compiled_view(text) ⇒ Object


22
23
24
25
26
27
# File 'lib/optimacms/page_services/page_process_service.rb', line 22

def save_text_to_compiled_view(text)
  filename = compiled_view_filename
  File.open(filename, "w+") do |f|
    f.write(text)
  end
end