Module: LgtmCreator::Util

Defined in:
lib/lgtm_creator/util.rb

Class Method Summary collapse

Class Method Details

.autoname(filename) ⇒ Object



17
18
19
20
21
# File 'lib/lgtm_creator/util.rb', line 17

def autoname(filename)
  paths = filename.split('/')
  paths[paths.size - 1] = 'lgtm_' + paths.last
  paths.join('/')
end

.root_pathObject



11
12
13
14
15
# File 'lib/lgtm_creator/util.rb', line 11

def root_path
  paths = caller.select { |line| line.include?('lgtm_creator') && line.include?('core.rb') }[0][/^([^:]+):\d+:in `[^']*'$/, 1].split('/')
  3.times { paths.pop }
  paths.join('/')
end

.split(file) ⇒ Object



5
6
7
8
9
# File 'lib/lgtm_creator/util.rb', line 5

def split(file)
  list = []
  Magick::ImageList.new(file).each { |x| list.push(x) }
  list
end