Class: F2h::InsertTags

Inherits:
Object
  • Object
show all
Defined in:
lib/insert_tags.rb

Instance Method Summary collapse

Constructor Details

#initializeInsertTags

Returns a new instance of InsertTags.



4
5
6
7
8
# File 'lib/insert_tags.rb', line 4

def initialize
  @get_current_dir = Dir.getwd
  @get_current_foldername = File.basename(@get_current_dir)
  @bp = Boilerplate.new
end

Instance Method Details

#insert_img_css(filenames, location) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/insert_tags.rb', line 24

def insert_img_css(filenames,location)
  text_to_be_inserted = ""
  filenames.each do |f|
    text_to_be_inserted << @bp.img_css(f)
  end
  read = File.read("css/"+@get_current_foldername+"_#{location}.css")
  first_part, second_part, third_part = read.split(/(\/\* Start-of-the-ISI \*\/)/)
  first_part << text_to_be_inserted
  everything = first_part + second_part + third_part
  File.open("css/" + @get_current_foldername+"_#{location}.css", "w+") do |f|
    f.write(everything)
  end
end

#insert_img_html(filenames, location) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/insert_tags.rb', line 10

def insert_img_html(filenames,location)
  text_to_be_inserted = ""
  filenames.each do |f|
    text_to_be_inserted << @bp.img_html(f,location)
  end
  read = File.read(@get_current_foldername+"_#{location}.html")
  first_part, second_part, third_part = read.split(/(<!-- End-of-the-Image-Tags -->)/)
  first_part << text_to_be_inserted
  everything = first_part + second_part + third_part
  File.open(@get_current_foldername+"_#{location}.html", "w+") do |f|
    f.write(everything)
  end
end

#insert_img_js(filenames, location) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/insert_tags.rb', line 38

def insert_img_js(filenames,location)
  text_to_be_inserted = ""
  filenames.each do |f|
    text_to_be_inserted << @bp.img_js(f)
  end
  read = File.read("js/"+@get_current_foldername+"_#{location}.js")
  first_part, second_part, third_part = read.split(/(\/\/End-of-the-animation-code)/)
  first_part << text_to_be_inserted
  everything = first_part + second_part + third_part
  File.open("js/" + @get_current_foldername+"_#{location}.js", "w+") do |f|
    f.write(everything)
  end
end