Module: DbSample::Loader

Defined in:
lib/db_sample/loader.rb

Class Method Summary collapse

Class Method Details

.ck_file_path(path) ⇒ Object



9
10
11
12
13
# File 'lib/db_sample/loader.rb', line 9

def ck_file_path(path)
  file = "#{Rails.root}/db/sample/#{path}"
  object = Ckeditor::AttachmentFile.create!(:data => File.new(file))
  object.data.url
end

.ck_image_path(path) ⇒ Object



15
16
17
18
19
# File 'lib/db_sample/loader.rb', line 15

def ck_image_path(path)
  file = "#{Rails.root}/db/sample/#{path}"
  object = Ckeditor::Picture.create!(:data => File.new(file))
  object.data.url(:content)
end

.get_list_value(block, key) ⇒ Object



5
6
7
# File 'lib/db_sample/loader.rb', line 5

def get_list_value(block, key)
  block.split("\n").find {|e| e.split(":")[0] == "#{key}"}.split("#{key}:")[1].strip
end