frubby 0.1 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +4 -4
- data/frubby.gemspec +1 -1
- data/lib/frubby/const_missing.rb +3 -3
- data/lib/frubby/method_missing.rb +4 -4
- data/lib/frubby/respond_to_missing.rb +8 -4
- metadata +2 -3
- data/test.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ee756b4b3eb139632aeb7bcdfec190d6903f7cd
|
4
|
+
data.tar.gz: 0acce9ed215d7e63a2941142da8abc8c27a15ba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3679e9c1c593a2666631fd437f917caef259690f5164b0ceccf8988e7f59a7e33bc3090a33a60b9e5e4e523fe11e7fd00cdd20a06fcff3c2e3749fae63e628dc
|
7
|
+
data.tar.gz: 58b8b2852b3aee6fe446c314caa769c9cd2032eecadbfb15e6473c95a906196cf9bbd48e08b07121db4f1b0558f2a1c4cac428280904cfc701d46b3680a584d1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# frubby
|
2
|
-
Bring fuzzy_match directly into ruby.
|
1
|
+
# frubby [![Build Status](https://travis-ci.org/fazibear/frubby.svg?branch=master)](https://travis-ci.org/fazibear/frubby) [![Code Climate](https://codeclimate.com/github/fazibear/frubby/badges/gpa.svg)](https://codeclimate.com/github/fazibear/frubby)
|
2
|
+
Bring fuzzy_match directly into ruby. Now typos makes no difference.
|
3
3
|
|
4
4
|
### Install
|
5
5
|
|
@@ -26,7 +26,7 @@ class FancyTestClass
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def inc_five
|
29
|
-
@count +=5
|
29
|
+
@count += 5
|
30
30
|
end
|
31
31
|
|
32
32
|
def count
|
@@ -41,7 +41,7 @@ fr.in_fv
|
|
41
41
|
piuts fr.cunt # => 7
|
42
42
|
```
|
43
43
|
|
44
|
-
###
|
44
|
+
### License
|
45
45
|
|
46
46
|
Copyright (c) 2015 Michał Kalbarczyk
|
47
47
|
|
data/frubby.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'frubby'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.3'
|
4
4
|
s.license = 'MIT'
|
5
5
|
s.summary = 'Add color methods to String class'
|
6
6
|
s.description = 'Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences.'
|
data/lib/frubby/const_missing.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module Frubby
|
2
2
|
module ConstMissing
|
3
3
|
def const_missing(const)
|
4
|
-
_constants =
|
4
|
+
_constants = Object.constants + constants
|
5
5
|
_constant = FuzzyMatch.new(_constants).find(const)
|
6
6
|
|
7
|
-
|
7
|
+
warn "[frubby] const_missing: #{const} -> #{_constant}" if $DEBUG
|
8
8
|
|
9
|
-
_constant ? const_get(_constant) :
|
9
|
+
_constant ? const_get(_constant) : super
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -11,14 +11,14 @@ module Frubby
|
|
11
11
|
KERNEL_METHODS = Kernel.methods.delete_if {|m| m.match /^[A-Z]/}
|
12
12
|
|
13
13
|
def method_missing(method_sym, *args, &block)
|
14
|
-
return if EXCLUDED_METHODS.include? method_sym
|
14
|
+
return super if EXCLUDED_METHODS.include? method_sym
|
15
15
|
|
16
|
-
_methods =
|
16
|
+
_methods = KERNEL_METHODS + methods
|
17
17
|
_method = FuzzyMatch.new(_methods).find(method_sym.to_s)
|
18
18
|
|
19
|
-
|
19
|
+
warn "[frubby] method_missing: #{method_sym} -> #{_method}" if $DEBUG
|
20
20
|
|
21
|
-
_method.is_a?(Symbol) ? send(_method.
|
21
|
+
_method.is_a?(Symbol) ? send(_method.to_sym, *args, &block) : super
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -5,19 +5,23 @@ module Frubby
|
|
5
5
|
begin
|
6
6
|
end
|
7
7
|
path
|
8
|
+
to_ary
|
9
|
+
to_io
|
10
|
+
to_hash
|
11
|
+
to_str
|
8
12
|
]
|
9
13
|
|
10
14
|
KERNEL_METHODS = Kernel.methods.delete_if {|m| m.match /^[A-Z]/}
|
11
15
|
|
12
16
|
def respond_to_missing?(method_name, include_private = false)
|
13
|
-
return
|
17
|
+
return super if EXCLUDED_RESPOND_TOS.include? method_name.to_sym
|
14
18
|
|
15
|
-
_methods =
|
19
|
+
_methods = KERNEL_METHODS + methods
|
16
20
|
_method = FuzzyMatch.new(_methods).find(method_name.to_sym)
|
17
21
|
|
18
|
-
|
22
|
+
warn "[frubby] respond_to_missing: #{method_name} ~> #{_method}" if $DEBUG
|
19
23
|
|
20
|
-
_method.is_a?(Symbol)
|
24
|
+
_method.is_a?(Symbol) ? true : super
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frubby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michał Kalbarczyk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fuzzy_match
|
@@ -69,7 +69,6 @@ files:
|
|
69
69
|
- lib/frubby/const_missing.rb
|
70
70
|
- lib/frubby/method_missing.rb
|
71
71
|
- lib/frubby/respond_to_missing.rb
|
72
|
-
- test.rb
|
73
72
|
- test/test.rb
|
74
73
|
- test/test_const_missing.rb
|
75
74
|
- test/test_method_missing.rb
|
data/test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'frubby'
|
2
|
-
|
3
|
-
class FancyTestClass
|
4
|
-
def initialize
|
5
|
-
@count = 0
|
6
|
-
end
|
7
|
-
|
8
|
-
def inc
|
9
|
-
@count += 1
|
10
|
-
end
|
11
|
-
|
12
|
-
def dec
|
13
|
-
@count -= 1
|
14
|
-
end
|
15
|
-
|
16
|
-
def inc_five
|
17
|
-
@count +=5
|
18
|
-
end
|
19
|
-
|
20
|
-
def count
|
21
|
-
@count
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
fr = FncyTstClas.new
|
26
|
-
fr.incc
|
27
|
-
fr.in
|
28
|
-
fr.in_fv
|
29
|
-
piuts fr.cunt # => 7
|