capykit 0.0.32 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,31 +5,29 @@ module Capykit::Base::Ref
5
5
 
6
6
  def core_methods
7
7
  arr=Capykit::Base::Core.public_instance_methods.sort
8
- ar2=arr.select{|x|x.length==1}
8
+ ar2=arr.select{|xx|xx.length==1}
9
9
  ar2 + (arr-ar2)
10
10
  end
11
11
 
12
12
  def capy_methods
13
13
  arr=modules_methods.sort!
14
- ar2=arr.select{|x|x.length==1}
14
+ ar2=arr.select{|xx|xx.length==1}
15
15
  ar2 + (arr-ar2)
16
16
  end
17
17
 
18
18
  def auto_methods
19
19
  arr=modules_methods.sort!
20
- arr.select{|m|m=~/^(aselector_|vsite_)/}
20
+ arr.select{|xx|xx=~/^(aselector_|vsite_)/}
21
21
  end
22
22
 
23
- def execute_methods(pr='')
24
- ym="x_#{pr}"
25
- mo=modules_methods.select{|x|x[0,ym.length]==ym}.sort!
26
- pr=='' ? mo : mo.collect{|x|x[ym.length,99]}
23
+ def execute_methods(pr='x_')
24
+ mo=modules_methods.select{|xx|xx=~/^#{pr}/}.sort!
25
+ pr=='' ? mo : mo.collect{|xx|xx[pr.to_s.length,99]}
27
26
  end
28
27
 
29
- def test_methods(pr='')
30
- ym="t_#{pr}"
31
- mo=modules_methods.select{|x|x[0,ym.length]==ym}.sort!
32
- pr=='' ? mo : mo.collect{|x|x[ym.length,99]}
28
+ def test_methods(pr='x_')
29
+ mo=modules_methods.select{|xx|xx=~/^#{pr}/}.sort!
30
+ pr=='' ? mo : mo.collect{|xx|xx[pr.to_s.length,99]}
33
31
  end
34
32
 
35
33
  def tasks_methods(*arg)
@@ -37,14 +35,22 @@ module Capykit::Base::Ref
37
35
  task_m='.*'
38
36
  idx=nil
39
37
  if arg!=[]
40
- task_m=arg[0]
41
- idx =arg[1]
38
+ num =arg.select{|nn|nn.class==Fixnum}
39
+ cls =arg.select{|nn|nn.to_s[0,2]=='c_'}
40
+ mth =arg.select{|nn|nn.to_s[0,2]=='m_'}
41
+ arg -=num
42
+ arg -=cls
43
+ arg -=mth
44
+ idx =num[0]
45
+ task_c=cls[0].to_s[2,99] if cls[0]
46
+ task_m=mth[0].to_s[2,99] if mth[0]
47
+ task_m=arg[0] if !mth[0] && arg[0]
42
48
  end
43
49
  tr=[]
44
50
  @tasks.each do|tk,tv|
45
51
  if tk.to_s=~/#{task_c}/
46
52
  tv.public_methods(nil).each do|tm|
47
- tr << [tk,tm] if tm=~/#{task_m}/
53
+ tr << [tk,tm] if task_m.class==Fixnum || tm=~/#{task_m}/
48
54
  #tasks_run << "tasks[:#{tk}].#{tm}" if tm=~/#{task_m}/
49
55
  end
50
56
  end
@@ -1,30 +1,42 @@
1
1
  module Capykit::Base::Util
2
2
  attr_reader :tasks
3
3
 
4
- def x(sym,*arg)
5
- runs=[]
6
- exec=execute_methods(sym)
7
- arg.each do |oth|
8
- mul=(oth.to_s[-1,1]=='_')
9
- rgx=mul ? /#{oth}/ : /#{oth}$/
10
- runs+=exec.select{|pr|pr=~rgx}
11
- end
12
- p runs
13
- runs.each do|xx|
14
- met="x_k#{xx}"
15
- puts met
16
- self.send met
4
+ def x(*arg)
5
+ if arg==[]
6
+ execute_methods.each_with_index do |vv,ii|
7
+ puts "#{ii}. #{vv}"
8
+ end
9
+ nil
10
+ else
11
+ runs=[]
12
+ sym=arg.shift
13
+ exec=execute_methods(sym)
14
+ arg.each do |oth|
15
+ mul=(oth.to_s[-1,1]=='_')
16
+ rgx=mul ? /#{oth}/ : /#{oth}$/
17
+ runs+=exec.select{|pr|pr=~rgx}
18
+ end
19
+ p runs
20
+ runs.each do|xx|
21
+ met="x_#{xx}"
22
+ puts met
23
+ self.send met
24
+ end
17
25
  end
18
26
  end
19
27
 
28
+ def xc(*arg)
29
+ tasks_methods(*arg)
30
+ end
31
+
20
32
  def xconf(xhash=nil)
21
33
  if xhash==:clear
22
- @xconf={}
34
+ @@xconf={}
23
35
  else
24
- @xconf||={}
25
- @xconf =@xconf.merge xhash if xhash
36
+ @@xconf||={}
37
+ @@xconf =@@xconf.merge xhash if xhash
26
38
  end
27
- @xconf
39
+ @@xconf
28
40
  end
29
41
 
30
42
  #def x_se_go(kwd,sym=:g)
@@ -1,3 +1,3 @@
1
1
  module Capykit
2
- VERSION = "0.0.32"
2
+ VERSION = "0.0.36"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capykit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 95
4
+ hash: 87
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 32
10
- version: 0.0.32
9
+ - 36
10
+ version: 0.0.36
11
11
  platform: ruby
12
12
  authors:
13
13
  - Widi Harsojo