rdoba 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -7
  2. data/.gitignore +4 -0
  3. data/.travis.yml +28 -0
  4. data/CHANGES.md +6 -0
  5. data/Gemfile +5 -0
  6. data/README.md +75 -90
  7. data/Rakefile +61 -55
  8. data/TODO +6 -0
  9. data/features/log.feature +100 -29
  10. data/features/mixin.feature +85 -0
  11. data/features/step_definitions/log_steps.rb +58 -22
  12. data/features/step_definitions/mixin_steps.rb +266 -0
  13. data/features/support/env.rb +48 -24
  14. data/features/support/fulltest_as_log.rb.in +143 -0
  15. data/features/support/fulltest_as_self.rb.in +144 -0
  16. data/features/support/mixin_support.rb +13 -0
  17. data/html/.keep +0 -0
  18. data/html/created.rid +28 -0
  19. data/html/css/fonts.css +167 -0
  20. data/html/css/rdoc.css +590 -0
  21. data/html/fonts/Lato-Light.ttf +0 -0
  22. data/html/fonts/Lato-LightItalic.ttf +0 -0
  23. data/html/fonts/Lato-Regular.ttf +0 -0
  24. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  25. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  26. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  27. data/html/images/add.png +0 -0
  28. data/html/images/arrow_up.png +0 -0
  29. data/html/images/brick.png +0 -0
  30. data/html/images/brick_link.png +0 -0
  31. data/html/images/bug.png +0 -0
  32. data/html/images/bullet_black.png +0 -0
  33. data/html/images/bullet_toggle_minus.png +0 -0
  34. data/html/images/bullet_toggle_plus.png +0 -0
  35. data/html/images/date.png +0 -0
  36. data/html/images/delete.png +0 -0
  37. data/html/images/find.png +0 -0
  38. data/html/images/loadingAnimation.gif +0 -0
  39. data/html/images/macFFBgHack.png +0 -0
  40. data/html/images/package.png +0 -0
  41. data/html/images/page_green.png +0 -0
  42. data/html/images/page_white_text.png +0 -0
  43. data/html/images/page_white_width.png +0 -0
  44. data/html/images/plugin.png +0 -0
  45. data/html/images/ruby.png +0 -0
  46. data/html/images/tag_blue.png +0 -0
  47. data/html/images/tag_green.png +0 -0
  48. data/html/images/transparent.png +0 -0
  49. data/html/images/wrench.png +0 -0
  50. data/html/images/wrench_orange.png +0 -0
  51. data/html/images/zoom.png +0 -0
  52. data/html/js/darkfish.js +161 -0
  53. data/html/js/jquery.js +4 -0
  54. data/html/js/navigation.js +142 -0
  55. data/html/js/navigation.js.gz +0 -0
  56. data/html/js/search.js +109 -0
  57. data/html/js/search_index.js +1 -0
  58. data/html/js/search_index.js.gz +0 -0
  59. data/html/js/searcher.js +228 -0
  60. data/html/js/searcher.js.gz +0 -0
  61. data/lib/rdoba/_version_.rb +1 -1
  62. data/lib/rdoba/common.rb +0 -15
  63. data/lib/rdoba/debug.rb +5 -1
  64. data/lib/rdoba/log.rb +360 -189
  65. data/lib/rdoba/merge.rb +21 -0
  66. data/lib/rdoba/mixin/time.rb +11 -0
  67. data/lib/rdoba/mixin/try.rb +6 -0
  68. data/lib/rdoba/mixin/try_1_9_0.rb +4 -0
  69. data/lib/rdoba/mixin/wait_if.rb +21 -0
  70. data/lib/rdoba/mixin.rb +270 -6
  71. data/lib/rdoba/strings.rb +4 -141
  72. data/lib/rdoba.rb +13 -19
  73. data/rdoba.gemspec +30 -24
  74. data/tddium.yml +11 -0
  75. metadata +260 -65
  76. data/features/bcd.feature +0 -29
  77. data/features/step_definitions/bcd_steps.rb +0 -69
  78. data/test/helper.rb +0 -18
  79. data/test/rdoba_test.rb.stub +0 -59
  80. data/test/test_rdoba.rb +0 -7
data/html/js/search.js ADDED
@@ -0,0 +1,109 @@
1
+ Search = function(data, input, result) {
2
+ this.data = data;
3
+ this.$input = $(input);
4
+ this.$result = $(result);
5
+
6
+ this.$current = null;
7
+ this.$view = this.$result.parent();
8
+ this.searcher = new Searcher(data.index);
9
+ this.init();
10
+ }
11
+
12
+ Search.prototype = $.extend({}, Navigation, new function() {
13
+ var suid = 1;
14
+
15
+ this.init = function() {
16
+ var _this = this;
17
+ var observer = function(e) {
18
+ switch(e.originalEvent.keyCode) {
19
+ case 38: // Event.KEY_UP
20
+ case 40: // Event.KEY_DOWN
21
+ return;
22
+ }
23
+ _this.search(_this.$input[0].value);
24
+ };
25
+ this.$input.keyup(observer);
26
+ this.$input.click(observer); // mac's clear field
27
+
28
+ this.searcher.ready(function(results, isLast) {
29
+ _this.addResults(results, isLast);
30
+ })
31
+
32
+ this.initNavigation();
33
+ this.setNavigationActive(false);
34
+ }
35
+
36
+ this.search = function(value, selectFirstMatch) {
37
+ value = jQuery.trim(value).toLowerCase();
38
+ if (value) {
39
+ this.setNavigationActive(true);
40
+ } else {
41
+ this.setNavigationActive(false);
42
+ }
43
+
44
+ if (value == '') {
45
+ this.lastQuery = value;
46
+ this.$result.empty();
47
+ this.$result.attr('aria-expanded', 'false');
48
+ this.setNavigationActive(false);
49
+ } else if (value != this.lastQuery) {
50
+ this.lastQuery = value;
51
+ this.$result.attr('aria-busy', 'true');
52
+ this.$result.attr('aria-expanded', 'true');
53
+ this.firstRun = true;
54
+ this.searcher.find(value);
55
+ }
56
+ }
57
+
58
+ this.addResults = function(results, isLast) {
59
+ var target = this.$result.get(0);
60
+ if (this.firstRun && (results.length > 0 || isLast)) {
61
+ this.$current = null;
62
+ this.$result.empty();
63
+ }
64
+
65
+ for (var i=0, l = results.length; i < l; i++) {
66
+ var item = this.renderItem.call(this, results[i]);
67
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
68
+ target.appendChild(item);
69
+ };
70
+
71
+ if (this.firstRun && results.length > 0) {
72
+ this.firstRun = false;
73
+ this.$current = $(target.firstChild);
74
+ this.$current.addClass('search-selected');
75
+ }
76
+ if (jQuery.browser.msie) this.$element[0].className += '';
77
+
78
+ if (isLast) this.$result.attr('aria-busy', 'false');
79
+ }
80
+
81
+ this.move = function(isDown) {
82
+ if (!this.$current) return;
83
+ var $next = this.$current[isDown ? 'next' : 'prev']();
84
+ if ($next.length) {
85
+ this.$current.removeClass('search-selected');
86
+ $next.addClass('search-selected');
87
+ this.$input.attr('aria-activedescendant', $next.attr('id'));
88
+ this.scrollIntoView($next[0], this.$view[0]);
89
+ this.$current = $next;
90
+ this.$input.val($next[0].firstChild.firstChild.text);
91
+ this.$input.select();
92
+ }
93
+ return true;
94
+ }
95
+
96
+ this.hlt = function(html) {
97
+ return this.escapeHTML(html).
98
+ replace(/\u0001/g, '<em>').
99
+ replace(/\u0002/g, '</em>');
100
+ }
101
+
102
+ this.escapeHTML = function(html) {
103
+ return html.replace(/[&<>]/g, function(c) {
104
+ return '&#' + c.charCodeAt(0) + ';';
105
+ });
106
+ }
107
+
108
+ });
109
+
@@ -0,0 +1 @@
1
+ var search_data = {"index":{"searchIndex":["array","bcd","converterror","parseerror","bcdstring","fixnum","hash","each","kernel","nilclass","numeric","object","rdoba","log","classfunctions","debugcompat","error","functions","merge","mixin","casestring","comparestring","emptynilclass","emptyobject","invalidoption","reversestring","split_byarray","time","to_harray","tryobject","wait_ifkernel","string","+()","-()","<<()","<=()","<=()","<=>()","=~()","=~()",">=()",">=()",">>()","[]()","[]=()","__dup__()","__dup__()","__each__()","__each_key__()","__each_pair__()","__each_value__()","__get__()","__match__()","__rdoba_mixin_changecase__()","__rdoba_mixin_downcase__()","__rdoba_mixin_reverse__()","__rdoba_mixin_upcase__()","__require__()","__scanf__()","__set__()","__sprintf__()","_rdoba_to_i()","_rdoba_to_s()","apply_opts()","atime()","change_case_char()","co()","compare_to()","consolize()","crop_diacritics()","ctime()","dbc()","dbg()","dbgl()","dbgl=()","dbp()","debug()","deep_merge()","define_methods()","deploy()","deploy!()","deploy_value()","disorder()","downcase_char()","dup()","dup()","e()","each()","each_comby()","each_key()","each_pair()","each_value()","empty?()","empty?()","empty?()","enabled?()","encoding()","fe()","fenc()","force_encoding()","gemroot()","get_stack_function_data_at_level()","geta()","geta()","geta_value()","hexdump()","log()","log()","log_class_setup()","log_functions_get()","log_functions_set()","log_init_io_m()","log_init_prefix()","log_instance_setup()","log_link_for()","log_prefix_get()","make_code()","mixin()","mtime()","new()","new()","new()","new()","ord()","ord()","order=()","os()","parse()","parse_opts()","pow()","purge()","rdoba()","require()","reverse()","reverse!()","rmatch()","rom()","scanf()","scanf_re()","seta()","size()","split_by()","sprintf()","sub_dup()","sub_dup()","to_bcd()","to_h()","to_i()","to_i()","to_i()","to_p()","to_re()","to_res()","to_rom()","to_s()","to_sym()","to_yml()","try()","try_define_compat()","up_char()","update_functions()","wait_if()","xor()","|()","readme"],"longSearchIndex":["array","bcd","bcd::converterror","bcd::parseerror","bcdstring","fixnum","hash","hash::each","kernel","nilclass","numeric","object","rdoba","rdoba::log","rdoba::log::classfunctions","rdoba::log::debugcompat","rdoba::log::error","rdoba::log::functions","rdoba::merge","rdoba::mixin","rdoba::mixin::casestring","rdoba::mixin::comparestring","rdoba::mixin::emptynilclass","rdoba::mixin::emptyobject","rdoba::mixin::invalidoption","rdoba::mixin::reversestring","rdoba::mixin::split_byarray","rdoba::mixin::time","rdoba::mixin::to_harray","rdoba::mixin::tryobject","rdoba::mixin::wait_ifkernel","string","nilclass#+()","string#-()","nilclass#<<()","rdoba::log::classfunctions#<=()","rdoba::log::functions#<=()","nilclass#<=>()","nilclass#=~()","string#=~()","rdoba::log::classfunctions#>=()","rdoba::log::functions#>=()","array#>>()","array#[]()","array#[]=()","array#__dup__()","hash#__dup__()","hash#__each__()","hash#__each_key__()","hash#__each_pair__()","hash#__each_value__()","array#__get__()","string#__match__()","rdoba::mixin::casestring#__rdoba_mixin_changecase__()","rdoba::mixin::casestring#__rdoba_mixin_downcase__()","rdoba::mixin::reversestring#__rdoba_mixin_reverse__()","rdoba::mixin::casestring#__rdoba_mixin_upcase__()","kernel#__require__()","string#__scanf__()","array#__set__()","kernel#__sprintf__()","string#_rdoba_to_i()","fixnum#_rdoba_to_s()","object#apply_opts()","rdoba::mixin::time#atime()","rdoba::mixin::casestring::change_case_char()","object#co()","rdoba::mixin::comparestring#compare_to()","string#consolize()","rdoba::mixin::comparestring#crop_diacritics()","rdoba::mixin::time#ctime()","rdoba::log::debugcompat#dbc()","rdoba::log::debugcompat#dbg()","rdoba::log::debugcompat#dbgl()","rdoba::log::debugcompat#dbgl=()","rdoba::log::debugcompat#dbp()","rdoba::debug()","rdoba::merge#deep_merge()","rdoba::log::define_methods()","hash#deploy()","hash#deploy!()","hash#deploy_value()","hash#disorder()","rdoba::mixin::casestring::downcase_char()","array#dup()","hash#dup()","rdoba::log::functions#e()","hash#each()","array#each_comby()","hash#each_key()","hash#each_pair()","hash#each_value()","nilclass#empty?()","rdoba::mixin::emptynilclass#empty?()","rdoba::mixin::emptyobject#empty?()","rdoba::log::enabled?()","rdoba::mixin::casestring#encoding()","string#fe()","string#fenc()","rdoba::mixin::casestring#force_encoding()","rdoba::gemroot()","rdoba::log::functions#get_stack_function_data_at_level()","array#geta()","hash#geta()","hash#geta_value()","string#hexdump()","rdoba::log()","rdoba::log::log()","rdoba::log::log_class_setup()","rdoba::log::log_functions_get()","rdoba::log::log_functions_set()","rdoba::log::log_init_io_m()","rdoba::log::log_init_prefix()","rdoba::log::log_instance_setup()","rdoba::log::log_link_for()","rdoba::log::log_prefix_get()","rdoba::log::make_code()","rdoba::mixin()","rdoba::mixin::time#mtime()","bcd::converterror::new()","bcd::parseerror::new()","bcdstring::new()","rdoba::log::error::new()","nilclass#ord()","rdoba::mixin::casestring#ord()","hash#order=()","rdoba::os()","bcd::parse()","object#parse_opts()","bcd#pow()","array#purge()","kernel#rdoba()","kernel#require()","hash#reverse()","hash#reverse!()","string#rmatch()","string#rom()","string#scanf()","string#scanf_re()","hash#seta()","nilclass#size()","rdoba::mixin::split_byarray#split_by()","kernel#sprintf()","array#sub_dup()","hash#sub_dup()","numeric#to_bcd()","rdoba::mixin::to_harray#to_h()","bcd#to_i()","nilclass#to_i()","string#to_i()","numeric#to_p()","string#to_re()","string#to_res()","numeric#to_rom()","fixnum#to_s()","object#to_sym()","object#to_yml()","rdoba::mixin::tryobject#try()","rdoba::log::try_define_compat()","rdoba::mixin::casestring::up_char()","rdoba::log::update_functions()","rdoba::mixin::wait_ifkernel#wait_if()","object#xor()","hash#|()",""],"info":[["Array","","Array.html","",""],["BCD","","BCD.html","",""],["BCD::ConvertError","","BCD/ConvertError.html","",""],["BCD::ParseError","","BCD/ParseError.html","",""],["BCDString","","BCDString.html","",""],["Fixnum","","Fixnum.html","",""],["Hash","","Hash.html","",""],["Hash::Each","","Hash/Each.html","",""],["Kernel","","Kernel.html","",""],["NilClass","","NilClass.html","",""],["Numeric","","Numeric.html","",""],["Object","","Object.html","",""],["Rdoba","","Rdoba.html","","<p>Author &mdash; Malo Skrylevo &lt;majioa@yandex.ru&gt;\n<p>License &mdash; MIT\n\n<p>TODO add enum of options hash to convert values …\n"],["Rdoba::Log","","Rdoba/Log.html","",""],["Rdoba::Log::ClassFunctions","","Rdoba/Log/ClassFunctions.html","",""],["Rdoba::Log::DebugCompat","","Rdoba/Log/DebugCompat.html","",""],["Rdoba::Log::Error","","Rdoba/Log/Error.html","",""],["Rdoba::Log::Functions","","Rdoba/Log/Functions.html","",""],["Rdoba::Merge","","Rdoba/Merge.html","",""],["Rdoba::Mixin","","Rdoba/Mixin.html","",""],["Rdoba::Mixin::CaseString","","Rdoba/Mixin/CaseString.html","",""],["Rdoba::Mixin::CompareString","","Rdoba/Mixin/CompareString.html","",""],["Rdoba::Mixin::EmptyNilClass","","Rdoba/Mixin/EmptyNilClass.html","",""],["Rdoba::Mixin::EmptyObject","","Rdoba/Mixin/EmptyObject.html","",""],["Rdoba::Mixin::InvalidOption","","Rdoba/Mixin/InvalidOption.html","",""],["Rdoba::Mixin::ReverseString","","Rdoba/Mixin/ReverseString.html","",""],["Rdoba::Mixin::Split_byArray","","Rdoba/Mixin/Split_byArray.html","",""],["Rdoba::Mixin::Time","","Rdoba/Mixin/Time.html","",""],["Rdoba::Mixin::To_hArray","","Rdoba/Mixin/To_hArray.html","",""],["Rdoba::Mixin::TryObject","","Rdoba/Mixin/TryObject.html","",""],["Rdoba::Mixin::Wait_ifKernel","","Rdoba/Mixin/Wait_ifKernel.html","",""],["String","","String.html","",""],["+","NilClass","NilClass.html#method-i-2B","(value)",""],["-","String","String.html#method-i-2D","(str)",""],["<<","NilClass","NilClass.html#method-i-3C-3C","(value)",""],["<=","Rdoba::Log::ClassFunctions","Rdoba/Log/ClassFunctions.html#method-i-3C-3D","(functions)",""],["<=","Rdoba::Log::Functions","Rdoba/Log/Functions.html#method-i-3C-3D","(functions = [])",""],["<=>","NilClass","NilClass.html#method-i-3C-3D-3E","(value)",""],["=~","NilClass","NilClass.html#method-i-3D-7E","(value)",""],["=~","String","String.html#method-i-3D-7E","(value)",""],[">=","Rdoba::Log::ClassFunctions","Rdoba/Log/ClassFunctions.html#method-i-3E-3D","(functions)",""],[">=","Rdoba::Log::Functions","Rdoba/Log/Functions.html#method-i-3E-3D","(functions = [])",""],[">>","Array","Array.html#method-i-3E-3E","(value = nil)",""],["[]","Array","Array.html#method-i-5B-5D","(index, *args)",""],["[]=","Array","Array.html#method-i-5B-5D-3D","(index, value, *args)",""],["__dup__","Array","Array.html#method-i-__dup__","(opts = {})",""],["__dup__","Hash","Hash.html#method-i-__dup__","(opts = {})",""],["__each__","Hash","Hash.html#method-i-__each__","(&block)",""],["__each_key__","Hash","Hash.html#method-i-__each_key__","(&block)",""],["__each_pair__","Hash","Hash.html#method-i-__each_pair__","(&block)",""],["__each_value__","Hash","Hash.html#method-i-__each_value__","(&block)",""],["__get__","Array","Array.html#method-i-__get__","(index, *args)",""],["__match__","String","String.html#method-i-__match__","(value)",""],["__rdoba_mixin_changecase__","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-i-__rdoba_mixin_changecase__","(reg, options = {})",""],["__rdoba_mixin_downcase__","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-i-__rdoba_mixin_downcase__","(options = {})",""],["__rdoba_mixin_reverse__","Rdoba::Mixin::ReverseString","Rdoba/Mixin/ReverseString.html#method-i-__rdoba_mixin_reverse__","(step = 1)",""],["__rdoba_mixin_upcase__","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-i-__rdoba_mixin_upcase__","(options = {})",""],["__require__","Kernel","Kernel.html#method-i-__require__","(name, *opts)",""],["__scanf__","String","String.html#method-i-__scanf__","(format, &block)",""],["__set__","Array","Array.html#method-i-__set__","(index, value, *args)",""],["__sprintf__","Kernel","Kernel.html#method-i-__sprintf__","(format, *args)",""],["_rdoba_to_i","String","String.html#method-i-_rdoba_to_i","(base = 10, *opts)",""],["_rdoba_to_s","Fixnum","Fixnum.html#method-i-_rdoba_to_s","(base = 10, *opts)",""],["apply_opts","Object","Object.html#method-i-apply_opts","(opts)",""],["atime","Rdoba::Mixin::Time","Rdoba/Mixin/Time.html#method-i-atime","(file)",""],["change_case_char","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-c-change_case_char","(dest, char)",""],["co","Object","Object.html#method-i-co","(method, *args)",""],["compare_to","Rdoba::Mixin::CompareString","Rdoba/Mixin/CompareString.html#method-i-compare_to","(value, opts = {})",""],["consolize","String","String.html#method-i-consolize","()",""],["crop_diacritics","Rdoba::Mixin::CompareString","Rdoba/Mixin/CompareString.html#method-i-crop_diacritics","(x)","<p>TODO verify composite range\n"],["ctime","Rdoba::Mixin::Time","Rdoba/Mixin/Time.html#method-i-ctime","(file)",""],["dbc","Rdoba::Log::DebugCompat","Rdoba/Log/DebugCompat.html#method-i-dbc","(level)",""],["dbg","Rdoba::Log::DebugCompat","Rdoba/Log/DebugCompat.html#method-i-dbg","(level, code, vars = {})",""],["dbgl","Rdoba::Log::DebugCompat","Rdoba/Log/DebugCompat.html#method-i-dbgl","()",""],["dbgl=","Rdoba::Log::DebugCompat","Rdoba/Log/DebugCompat.html#method-i-dbgl-3D","(level)",""],["dbp","Rdoba::Log::DebugCompat","Rdoba/Log/DebugCompat.html#method-i-dbp","(level, text)",""],["debug","Rdoba","Rdoba.html#method-c-debug","(options = {})",""],["deep_merge","Rdoba::Merge","Rdoba/Merge.html#method-i-deep_merge","(source, dest)",""],["define_methods","Rdoba::Log","Rdoba/Log.html#method-c-define_methods","(obj, list)",""],["deploy","Hash","Hash.html#method-i-deploy","(vars = {})",""],["deploy!","Hash","Hash.html#method-i-deploy-21","(vars = {})",""],["deploy_value","Hash","Hash.html#method-i-deploy_value","(value, vars)",""],["disorder","Hash","Hash.html#method-i-disorder","()",""],["downcase_char","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-c-downcase_char","(char)",""],["dup","Array","Array.html#method-i-dup","(opts = {})",""],["dup","Hash","Hash.html#method-i-dup","(opts = {})",""],["e","Rdoba::Log::Functions","Rdoba/Log/Functions.html#method-i-e","(*args)",""],["each","Hash","Hash.html#method-i-each","(&block)",""],["each_comby","Array","Array.html#method-i-each_comby","(*args)",""],["each_key","Hash","Hash.html#method-i-each_key","(&block)",""],["each_pair","Hash","Hash.html#method-i-each_pair","(&block)",""],["each_value","Hash","Hash.html#method-i-each_value","(&block)",""],["empty?","NilClass","NilClass.html#method-i-empty-3F","()",""],["empty?","Rdoba::Mixin::EmptyNilClass","Rdoba/Mixin/EmptyNilClass.html#method-i-empty-3F","()",""],["empty?","Rdoba::Mixin::EmptyObject","Rdoba/Mixin/EmptyObject.html#method-i-empty-3F","()",""],["enabled?","Rdoba::Log","Rdoba/Log.html#method-c-enabled-3F","()",""],["encoding","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-i-encoding","()",""],["fe","String","String.html#method-i-fe","()",""],["fenc","String","String.html#method-i-fenc","()",""],["force_encoding","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-i-force_encoding","(*args)",""],["gemroot","Rdoba","Rdoba.html#method-c-gemroot","(name = nil, path = '')",""],["get_stack_function_data_at_level","Rdoba::Log::Functions","Rdoba/Log/Functions.html#method-i-get_stack_function_data_at_level","( level )",""],["geta","Array","Array.html#method-i-geta","(index, options = {})",""],["geta","Hash","Hash.html#method-i-geta","(index, options = {})",""],["geta_value","Hash","Hash.html#method-i-geta_value","(cid, options = {})",""],["hexdump","String","String.html#method-i-hexdump","()",""],["log","Rdoba","Rdoba.html#method-c-log","(options = {})","<p>Adds a Log instance to the specified object as a variable or directly into\nthe object itself. It returns …\n"],["log","Rdoba::Log","Rdoba/Log.html#method-c-log","(io_m, prefix, params)",""],["log_class_setup","Rdoba::Log","Rdoba/Log.html#method-c-log_class_setup","(obj)",""],["log_functions_get","Rdoba::Log","Rdoba/Log.html#method-c-log_functions_get","(obj)",""],["log_functions_set","Rdoba::Log","Rdoba/Log.html#method-c-log_functions_set","(obj, functions)",""],["log_init_io_m","Rdoba::Log","Rdoba/Log.html#method-c-log_init_io_m","(options = {})",""],["log_init_prefix","Rdoba::Log","Rdoba/Log.html#method-c-log_init_prefix","(obj, is_self = false)",""],["log_instance_setup","Rdoba::Log","Rdoba/Log.html#method-c-log_instance_setup","(obj)",""],["log_link_for","Rdoba::Log","Rdoba/Log.html#method-c-log_link_for","(target, obj, funcname)",""],["log_prefix_get","Rdoba::Log","Rdoba/Log.html#method-c-log_prefix_get","(obj)",""],["make_code","Rdoba::Log","Rdoba/Log.html#method-c-make_code","(functions, pfx)",""],["mixin","Rdoba","Rdoba.html#method-c-mixin","(options)",""],["mtime","Rdoba::Mixin::Time","Rdoba/Mixin/Time.html#method-i-mtime","(file)",""],["new","BCD::ConvertError","BCD/ConvertError.html#method-c-new","(msg = \"Invalid number has given\";)",""],["new","BCD::ParseError","BCD/ParseError.html#method-c-new","(msg = \"Invalid positive integer value\";)",""],["new","BCDString","BCDString.html#method-c-new","(value = nil)",""],["new","Rdoba::Log::Error","Rdoba/Log/Error.html#method-c-new","(options = {})",""],["ord","NilClass","NilClass.html#method-i-ord","()",""],["ord","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-i-ord","()",""],["order=","Hash","Hash.html#method-i-order-3D","(order)",""],["os","Rdoba","Rdoba.html#method-c-os","()",""],["parse","BCD","BCD.html#method-c-parse","(value)",""],["parse_opts","Object","Object.html#method-i-parse_opts","(opts)",""],["pow","BCD","BCD.html#method-i-pow","(value, mul)",""],["purge","Array","Array.html#method-i-purge","()",""],["rdoba","Kernel","Kernel.html#method-i-rdoba","(*options)",""],["require","Kernel","Kernel.html#method-i-require","(name, *opts)",""],["reverse","Hash","Hash.html#method-i-reverse","()",""],["reverse!","Hash","Hash.html#method-i-reverse-21","()",""],["rmatch","String","String.html#method-i-rmatch","(value)",""],["rom","String","String.html#method-i-rom","()",""],["scanf","String","String.html#method-i-scanf","(format, &block)",""],["scanf_re","String","String.html#method-i-scanf_re","(format)",""],["seta","Hash","Hash.html#method-i-seta","(index, value, options = {})",""],["size","NilClass","NilClass.html#method-i-size","()",""],["split_by","Rdoba::Mixin::Split_byArray","Rdoba/Mixin/Split_byArray.html#method-i-split_by","(&block)","<p><code>split_by</code> method splits the <code>self</code> array by a\ncondition, which is evaliated in a passed block, in two versions …\n"],["sprintf","Kernel","Kernel.html#method-i-sprintf","(format, *args)",""],["sub_dup","Array","Array.html#method-i-sub_dup","(value)",""],["sub_dup","Hash","Hash.html#method-i-sub_dup","(value)",""],["to_bcd","Numeric","Numeric.html#method-i-to_bcd","()",""],["to_h","Rdoba::Mixin::To_hArray","Rdoba/Mixin/To_hArray.html#method-i-to_h","(options = {})",""],["to_i","BCD","BCD.html#method-i-to_i","()",""],["to_i","NilClass","NilClass.html#method-i-to_i","()",""],["to_i","String","String.html#method-i-to_i","(base = 10, *opts)",""],["to_p","Numeric","Numeric.html#method-i-to_p","(*opts)",""],["to_re","String","String.html#method-i-to_re","()",""],["to_res","String","String.html#method-i-to_res","()",""],["to_rom","Numeric","Numeric.html#method-i-to_rom","()",""],["to_s","Fixnum","Fixnum.html#method-i-to_s","(base = 10, *opts)",""],["to_sym","Object","Object.html#method-i-to_sym","()",""],["to_yml","Object","Object.html#method-i-to_yml","( o = {} )",""],["try","Rdoba::Mixin::TryObject","Rdoba/Mixin/TryObject.html#method-i-try","(method, *args, default: nil)",""],["try_define_compat","Rdoba::Log","Rdoba/Log.html#method-c-try_define_compat","(functions, target)",""],["up_char","Rdoba::Mixin::CaseString","Rdoba/Mixin/CaseString.html#method-c-up_char","(char)",""],["update_functions","Rdoba::Log","Rdoba/Log.html#method-c-update_functions","(functions, obj, method)",""],["wait_if","Rdoba::Mixin::Wait_ifKernel","Rdoba/Mixin/Wait_ifKernel.html#method-i-wait_if","(timeout = 6)","<p><code>wait_if</code> waits for <code>timeout</code> second to the condition\npassed via block, and in case if it failed, returns …\n"],["xor","Object","Object.html#method-i-xor","(val1)",""],["|","Hash","Hash.html#method-i-7C","(inval)",""],["README","","README_md.html","","<p>Rdoba\n<p><img src=\"http://i44.tinypic.com/29fs129.png\">\n<p><img src=\"https://gemnasium.com/majioa/rdoba.png\"> …\n"]]}}
Binary file
@@ -0,0 +1,228 @@
1
+ Searcher = function(data) {
2
+ this.data = data;
3
+ this.handlers = [];
4
+ }
5
+
6
+ Searcher.prototype = new function() {
7
+ // search is performed in chunks of 1000 for non-blocking user input
8
+ var CHUNK_SIZE = 1000;
9
+ // do not try to find more than 100 results
10
+ var MAX_RESULTS = 100;
11
+ var huid = 1;
12
+ var suid = 1;
13
+ var runs = 0;
14
+
15
+ this.find = function(query) {
16
+ var queries = splitQuery(query);
17
+ var regexps = buildRegexps(queries);
18
+ var highlighters = buildHilighters(queries);
19
+ var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
20
+ var _this = this;
21
+
22
+ this.currentSuid = state.n;
23
+
24
+ if (!query) return;
25
+
26
+ var run = function() {
27
+ // stop current search thread if new search started
28
+ if (state.n != _this.currentSuid) return;
29
+
30
+ var results =
31
+ performSearch(_this.data, regexps, queries, highlighters, state);
32
+ var hasMore = (state.limit > 0 && state.pass < 4);
33
+
34
+ triggerResults.call(_this, results, !hasMore);
35
+ if (hasMore) {
36
+ setTimeout(run, 2);
37
+ }
38
+ runs++;
39
+ };
40
+ runs = 0;
41
+
42
+ // start search thread
43
+ run();
44
+ }
45
+
46
+ /* ----- Events ------ */
47
+ this.ready = function(fn) {
48
+ fn.huid = huid;
49
+ this.handlers.push(fn);
50
+ }
51
+
52
+ /* ----- Utilities ------ */
53
+ function splitQuery(query) {
54
+ return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) {
55
+ return string.match(/\S/);
56
+ });
57
+ }
58
+
59
+ function buildRegexps(queries) {
60
+ return jQuery.map(queries, function(query) {
61
+ return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
62
+ });
63
+ }
64
+
65
+ function buildHilighters(queries) {
66
+ return jQuery.map(queries, function(query) {
67
+ return jQuery.map(query.split(''), function(l, i) {
68
+ return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
69
+ }).join('');
70
+ });
71
+ }
72
+
73
+ // function longMatchRegexp(index, longIndex, regexps) {
74
+ // for (var i = regexps.length - 1; i >= 0; i--){
75
+ // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
76
+ // };
77
+ // return true;
78
+ // }
79
+
80
+
81
+ /* ----- Mathchers ------ */
82
+
83
+ /*
84
+ * This record matches if the index starts with queries[0] and the record
85
+ * matches all of the regexps
86
+ */
87
+ function matchPassBeginning(index, longIndex, queries, regexps) {
88
+ if (index.indexOf(queries[0]) != 0) return false;
89
+ for (var i=1, l = regexps.length; i < l; i++) {
90
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
91
+ return false;
92
+ };
93
+ return true;
94
+ }
95
+
96
+ /*
97
+ * This record matches if the longIndex starts with queries[0] and the
98
+ * longIndex matches all of the regexps
99
+ */
100
+ function matchPassLongIndex(index, longIndex, queries, regexps) {
101
+ if (longIndex.indexOf(queries[0]) != 0) return false;
102
+ for (var i=1, l = regexps.length; i < l; i++) {
103
+ if (!longIndex.match(regexps[i]))
104
+ return false;
105
+ };
106
+ return true;
107
+ }
108
+
109
+ /*
110
+ * This record matches if the index contains queries[0] and the record
111
+ * matches all of the regexps
112
+ */
113
+ function matchPassContains(index, longIndex, queries, regexps) {
114
+ if (index.indexOf(queries[0]) == -1) return false;
115
+ for (var i=1, l = regexps.length; i < l; i++) {
116
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
117
+ return false;
118
+ };
119
+ return true;
120
+ }
121
+
122
+ /*
123
+ * This record matches if regexps[0] matches the index and the record
124
+ * matches all of the regexps
125
+ */
126
+ function matchPassRegexp(index, longIndex, queries, regexps) {
127
+ if (!index.match(regexps[0])) return false;
128
+ for (var i=1, l = regexps.length; i < l; i++) {
129
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
130
+ return false;
131
+ };
132
+ return true;
133
+ }
134
+
135
+
136
+ /* ----- Highlighters ------ */
137
+ function highlightRegexp(info, queries, regexps, highlighters) {
138
+ var result = createResult(info);
139
+ for (var i=0, l = regexps.length; i < l; i++) {
140
+ result.title = result.title.replace(regexps[i], highlighters[i]);
141
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
142
+ };
143
+ return result;
144
+ }
145
+
146
+ function hltSubstring(string, pos, length) {
147
+ return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
148
+ }
149
+
150
+ function highlightQuery(info, queries, regexps, highlighters) {
151
+ var result = createResult(info);
152
+ var pos = 0;
153
+ var lcTitle = result.title.toLowerCase();
154
+
155
+ pos = lcTitle.indexOf(queries[0]);
156
+ if (pos != -1) {
157
+ result.title = hltSubstring(result.title, pos, queries[0].length);
158
+ }
159
+
160
+ result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
161
+ for (var i=1, l = regexps.length; i < l; i++) {
162
+ result.title = result.title.replace(regexps[i], highlighters[i]);
163
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
164
+ };
165
+ return result;
166
+ }
167
+
168
+ function createResult(info) {
169
+ var result = {};
170
+ result.title = info[0];
171
+ result.namespace = info[1];
172
+ result.path = info[2];
173
+ result.params = info[3];
174
+ result.snippet = info[4];
175
+ return result;
176
+ }
177
+
178
+ /* ----- Searching ------ */
179
+ function performSearch(data, regexps, queries, highlighters, state) {
180
+ var searchIndex = data.searchIndex;
181
+ var longSearchIndex = data.longSearchIndex;
182
+ var info = data.info;
183
+ var result = [];
184
+ var i = state.from;
185
+ var l = searchIndex.length;
186
+ var togo = CHUNK_SIZE;
187
+ var matchFunc, hltFunc;
188
+
189
+ while (state.pass < 4 && state.limit > 0 && togo > 0) {
190
+ if (state.pass == 0) {
191
+ matchFunc = matchPassBeginning;
192
+ hltFunc = highlightQuery;
193
+ } else if (state.pass == 1) {
194
+ matchFunc = matchPassLongIndex;
195
+ hltFunc = highlightQuery;
196
+ } else if (state.pass == 2) {
197
+ matchFunc = matchPassContains;
198
+ hltFunc = highlightQuery;
199
+ } else if (state.pass == 3) {
200
+ matchFunc = matchPassRegexp;
201
+ hltFunc = highlightRegexp;
202
+ }
203
+
204
+ for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
205
+ if (info[i].n == state.n) continue;
206
+ if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
207
+ info[i].n = state.n;
208
+ result.push(hltFunc(info[i], queries, regexps, highlighters));
209
+ state.limit--;
210
+ }
211
+ };
212
+ if (searchIndex.length <= i) {
213
+ state.pass++;
214
+ i = state.from = 0;
215
+ } else {
216
+ state.from = i;
217
+ }
218
+ }
219
+ return result;
220
+ }
221
+
222
+ function triggerResults(results, isLast) {
223
+ jQuery.each(this.handlers, function(i, fn) {
224
+ fn.call(this, results, isLast)
225
+ })
226
+ }
227
+ }
228
+
Binary file
@@ -1,3 +1,3 @@
1
1
  module Rdoba
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
data/lib/rdoba/common.rb CHANGED
@@ -37,21 +37,6 @@ class Object
37
37
  end
38
38
  end
39
39
 
40
- module Kernel
41
- def wait_if(timeout = 30)
42
- require 'timeout'
43
-
44
- begin
45
- Timeout::timeout(timeout) do
46
- while yield(); end
47
- end
48
- true
49
- rescue Timeout::Error
50
- false
51
- end
52
- end
53
- end
54
-
55
40
  class NilClass
56
41
  def =~(value)
57
42
  value == nil
data/lib/rdoba/debug.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
- STDERR.puts "Warning: the module has kept only for backward compatibility\n" +
3
+ STDERR.puts "Warning: the module has kept only for backward compatibility\n" \
4
4
  "Please use 'rdoba :log' form instead"
5
+
5
6
  require 'rdoba/log'
6
7
 
8
+ module Rdoba
9
+ def self.debug options = {}
10
+ Rdoba.log options ; end ; end