Module: Capykit::Base::Ref
- Defined in:
- lib/capykit/base/ref.rb
Instance Method Summary collapse
- #auto_methods ⇒ Object
- #base_methods ⇒ Object
- #capy_methods ⇒ Object
- #core_methods ⇒ Object
- #execute_methods(pr = 'x_') ⇒ Object
- #tasks_methods(*arg) ⇒ Object
- #test_methods(pr = 'x_') ⇒ Object
Instance Method Details
#auto_methods ⇒ Object
23 24 25 26 |
# File 'lib/capykit/base/ref.rb', line 23 def auto_methods arr=modules_methods.sort! arr.select{|xx|xx=~/^(aselector_|vsite_)/} end |
#base_methods ⇒ Object
2 3 4 |
# File 'lib/capykit/base/ref.rb', line 2 def base_methods Capybara.methods - Object.methods end |
#capy_methods ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/capykit/base/ref.rb', line 12 def capy_methods arr=modules_methods.sort! a_len1=arr.select{|xx|xx.length==1} a_grt1=arr-a_len1 a_meth=a_grt1.select{|xx|xx=~/_methods$/} a_selc=a_grt1.select{|xx|xx=~/^aselector/} a_site=a_grt1.select{|xx|xx=~/^vsite/} a_rest=a_grt1-(a_meth+a_selc+a_site) a_len1 + a_meth + a_selc + a_site + a_rest end |
#core_methods ⇒ Object
6 7 8 9 10 |
# File 'lib/capykit/base/ref.rb', line 6 def core_methods arr=Capykit::Base::Core.public_instance_methods.sort ar2=arr.select{|xx|xx.length==1} ar2 + (arr-ar2) end |
#execute_methods(pr = 'x_') ⇒ Object
28 29 30 31 |
# File 'lib/capykit/base/ref.rb', line 28 def execute_methods(pr='x_') mo=modules_methods.select{|xx|xx=~/^#{pr}/}.sort! pr=='' ? mo : mo.collect{|xx|xx[pr.to_s.length,99]} end |
#tasks_methods(*arg) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/capykit/base/ref.rb', line 38 def tasks_methods(*arg) task_c='.*' task_m='.*' idx=nil if arg!=[] num =arg.select{|nn|nn.class==Fixnum} cls =arg.select{|nn|nn.to_s[0,2]=='c_'} mth =arg.select{|nn|nn.to_s[0,2]=='m_'} arg -=num arg -=cls arg -=mth idx =num[0] task_c=cls[0].to_s[2,99] if cls[0] task_m=mth[0].to_s[2,99] if mth[0] task_m=arg[0] if !mth[0] && arg[0] end tr=[] p '=-=-=-=-=-=-' p self.class if self.class==Object @tasks.each do|tk,tv| if tk.to_s=~/#{task_c}/ tv.public_methods(nil).each do|tm| tr << [tk,tm] if task_m.class==Fixnum || tm=~/#{task_m}/ end end end else tk=self.class.to_s.split('::')[-1].to_sym self.public_methods(nil).each do|tm| tr << [tk,tm] if task_m.class==Fixnum || tm=~/#{task_m}/ end end if !idx tr.each_with_index do |vv,ii| puts "#{ii}. #{vv.join('.')}" end nil else if self.class==Object tk,tm=tr[idx] eval("tasks[:#{tk}].#{tm}") else eval(tr[idx][1]) end end end |
#test_methods(pr = 'x_') ⇒ Object
33 34 35 36 |
# File 'lib/capykit/base/ref.rb', line 33 def test_methods(pr='x_') mo=modules_methods.select{|xx|xx=~/^#{pr}/}.sort! pr=='' ? mo : mo.collect{|xx|xx[pr.to_s.length,99]} end |