module LSL::ShellLike::Inner
Public Instance Methods
cc(*args)
click to toggle source
# File lib/lsl/shell.rb, line 52 def cc(*args) puts "cc args #{args.inspect}" args.reverse.join("") end
cd(d)
click to toggle source
# File lib/lsl/shell.rb, line 59 def cd(d) Dir.chdir(d) end
column(arr,a,b)
click to toggle source
# File lib/lsl/shell.rb, line 91 def column(arr,a,b) arr.map { |x| x[a.to_i..b.to_i].andand.strip } end
crop_top(arr,i)
click to toggle source
# File lib/lsl/shell.rb, line 88 def crop_top(arr,i) arr[i.to_i..-1] end
echo(*args)
click to toggle source
# File lib/lsl/shell.rb, line 21 def echo(*args) #puts args.inspect ops = (args.last.kind_of?(Hash) ? args.pop : {}) str = args.join(" ") str = str.upcase if ops.has_key?('upper') #puts str str end
echot(*args)
click to toggle source
# File lib/lsl/shell.rb, line 29 def echot(*args) echo(*args) echo(*args) end
eval(*args)
click to toggle source
# File lib/lsl/shell.rb, line 66 def eval(*args) Kernel.eval(args.join(" ")) end
exit(*args)
click to toggle source
# File lib/lsl/shell.rb, line 62 def exit(*args) puts "Exiting" Kernel.exit(*args) end
foo()
click to toggle source
# File lib/lsl/shell.rb, line 41 def foo ["foo"] end
get(url)
click to toggle source
# File lib/lsl/shell.rb, line 75 def get(url) require 'open-uri' open(url).read end
la(*args)
click to toggle source
# File lib/lsl/shell.rb, line 56 def la(*args) ::File.append("spec/mock_dir/log.txt","LOG #{Time.now} " + args.join(",") + "\n") end
longest(*args)
click to toggle source
# File lib/lsl/shell.rb, line 44 def longest(*args) res = args.sort_by { |x| x.size }.last #puts "Longest: #{res}" res end
ls(d=".")
click to toggle source
# File lib/lsl/shell.rb, line 33 def ls(d=".") ec_array "ls #{d}" end
p(*args)
click to toggle source
# File lib/lsl/shell.rb, line 79 def p(*args) ec "python -c " + args.join(" ") end
pf(f)
click to toggle source
# File lib/lsl/shell.rb, line 36 def pf(f) str = ::File.read(f) $printed << str puts str end
pipe(*args)
click to toggle source
# File lib/lsl/shell.rb, line 18 def pipe(*args) args end
pm(a,b)
click to toggle source
# File lib/lsl/shell.rb, line 49 def pm(a,b) puts a.length * b.length end
pt(a,b)
click to toggle source
# File lib/lsl/shell.rb, line 72 def pt(a,b) puts a==b end
rand()
click to toggle source
# File lib/lsl/shell.rb, line 69 def rand Kernel.rand() end
remove(str,c)
click to toggle source
# File lib/lsl/shell.rb, line 100 def remove(str,c) str.gsub(c,"").strip end
sub(a,b,arg)
click to toggle source
# File lib/lsl/shell.rb, line 85 def sub(a,b,arg) arg[a.to_i..b.to_i] end
sum(*args)
click to toggle source
# File lib/lsl/shell.rb, line 94 def sum(*args) args.flatten.inject(0.0) { |s,i| s + i.to_f } end
sumt(*args)
click to toggle source
# File lib/lsl/shell.rb, line 97 def sumt(*args) args.flatten.inject { |s,i| s + (i.kind_of?(String) ? i.to_f : i) } end
without_left(n,arg)
click to toggle source
# File lib/lsl/shell.rb, line 82 def without_left(n,arg) arg[n.to_i..-1] end