Class: Image
Class Method Summary collapse
- .<<(file, txt = nil, options = {}) ⇒ Object
- .>>(file, txt = nil) ⇒ Object
- .menu ⇒ Object
- .menu_before(*args) ⇒ Object
Class Method Details
.<<(file, txt = nil, options = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/xiki/image.rb', line 36 def self.<< file, txt=nil, ={} txt ||= "@img/#{file}" # Copy to place with unique name, so a cached version doesn't get displayed... tmp_dir = "/tmp/img_tmp/" Dir.mkdir tmp_dir if ! File.directory? tmp_dir # Copy to place with unique name, so a cached version doesn't get displayed. unique_tmp_file = "#{tmp_dir}#{File.basename(file).sub /.+\./, "\\0#{rand(99999)}."}" File.copy file, unique_tmp_file Notes.enter_junior if [:enter_junior] $el.insert_image $el.create_image(unique_tmp_file), txt end |
.>>(file, txt = nil) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/xiki/image.rb', line 29 def self.>> file, txt=nil txt ||= "@img/#{file}" Move.to_end self.<< file, txt, :enter_junior=>1 Move.backward end |
.menu ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/xiki/image.rb', line 16 def self. %` .log/ docs/ > Show image underneath @image//tmp/draw_rect.gif api/ > Examples | Insert an image: @Image << "/tmp/draw_rect.gif" ` end |