Module: Capykit::Base::Util

Defined in:
lib/capykit/base/util.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tasks(*arg) ⇒ Object (readonly)

Returns the value of attribute tasks.



2
3
4
# File 'lib/capykit/base/util.rb', line 2

def tasks
  @tasks
end

Instance Method Details

#x(*arg) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/capykit/base/util.rb', line 4

def x(*arg)
  if arg==[]
    execute_methods.each_with_index do |vv,ii|
      puts "#{ii}. #{vv}"
    end
    nil
  else
    runs=[]
    exec=execute_methods
    arg.each do |oth|
      mul=(oth.to_s[-1,1]=='_')
      rgx=mul ? /#{oth}/ : /#{oth}$/
      runs+=exec.select{|pr|pr=~rgx}
    end
    p runs
    runs.each do|xx|
      met="x_#{xx}"
      puts met
      self.send met
    end
  end
end

#xc(*arg) ⇒ Object



27
28
29
# File 'lib/capykit/base/util.rb', line 27

def xc(*arg)
  tasks_methods(*arg)
end

#xconf(xhash = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/capykit/base/util.rb', line 31

def xconf(xhash=nil)
  if xhash==:clear
    @@xconf={} 
  else
    @@xconf||={}
    @@xconf  =@@xconf.merge xhash if xhash
  end
  @@xconf
end

#xs(rgx) ⇒ Object



41
42
43
44
# File 'lib/capykit/base/util.rb', line 41

def xs(rgx)
  task = tasks.select{|kk,vv|(kk.to_s=~/#{rgx}/)}[0]
  task[1] if task
end