class Byggvir::Multiple
Public Class Methods
commands(inst)
click to toggle source
List existing commands
# File lib/byggvir.rb, line 19 def commands(inst) unless @docs @docs = (inst.methods.to_set - TestObject.new.methods.to_set).map{|meth| [meth,"Options: "+::Byggvir.parameters(inst.instance_eval{self.class.instance_method(meth)}).keys.join(?,)] }.to_h end longest = @docs.keys.map(&:length).max @docs.map{ |k,v| Kernel.sprintf("% #{longest+1}s : %s",k,v)}.join("\n") end
create_binaries()
click to toggle source
# File lib/byggvir.rb, line 7 def create_binaries() directory = File.mkdir(File.basedir($0)+"/bin") list_existing_methods.each{""} end
doc(doc,name=nil)
click to toggle source
# File lib/byggvir.rb, line 12 def doc(doc,name=nil) ::Byggvir.error!("doc has to end with a comma, #{caller[1..1]}") unless name.class == Symbol @docs||={} @docs[name]=doc end
new(*args)
click to toggle source
Instantiate a multiple function object
Calls superclass method
# File lib/byggvir.rb, line 30 def new(*args) inst=super(*args) ::Byggvir.error!("Please specify a method, One of: \n#{commands(inst)}") unless ARGV.length>0 name = ARGV[0].to_sym ARGV.drop(1) begin meth = instance_method(name) rescue NameError => ex ::Byggvir.error!("No method #{name.to_s} defined in #{$0}, try one of \n#{commands(inst)} (#{ex})") else ::Byggvir.wrap(inst,meth) end end