ifilter 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01696dcf09c5878f8c3ec8a42507fb0cbe5c4509
4
- data.tar.gz: 6537d31ec9da4eb91613e65bf61cb88903f57338
3
+ metadata.gz: dd5b9e238a172630648a09b8f877f01e34ed7dcb
4
+ data.tar.gz: e2bd0c6f2b356090160235e53ccc673efc5119b7
5
5
  SHA512:
6
- metadata.gz: 168780c7facb09fae521aa83f92cb35cb785cee7114ad2339830ab5b92fd1407718d1fcac7204264b3e4bdcc61d06ad6575c60e40a7861c170b932c36d57a0b6
7
- data.tar.gz: 9f9eb1baf566ff3b2e582683171c8bcd56e67b08487f26c2493863edbff864781784e02c653c24b9f60ac92e3ab569ebf045dd4efcfdf5494ebecad1f298ea8c
6
+ metadata.gz: b3b909015cdcfb9bd667004e61be6b3dbcf98a91a6aef17abcfd4a848cf1157f2bf0fe0915f2b1b19c6a1e04a1c91345f31b64c206fdb5e03d4611847c0a4f38
7
+ data.tar.gz: e9e9f8032730b9f5122a1cb60c8b79e1fdf72d61e3858eacf170b9c66f496ba9cbba418c22c9307d16dfeec7465ef1ef39b9c47039d42c2a762adef97c3028b0
data/README.md CHANGED
@@ -32,9 +32,9 @@ Or install it yourself as:
32
32
  $ ps aux | ifilter
33
33
  ```
34
34
 
35
- ![execute](http://kaihar4.com/images/github.com/kaihar4/ifilter/execute.gif)
35
+ ![execute](http://file.kaihar4.com/images/github.com/kaihar4/ifilter/execute.gif)
36
36
 
37
- ### Module Style
37
+ ### Module/Class
38
38
 
39
39
  ```ruby
40
40
  # test.rb
@@ -44,7 +44,21 @@ array = ['foo', 'bar', 'hoge', 'fuga']
44
44
  puts Ifilter.filtering(array)
45
45
  ```
46
46
 
47
- ![module](http://kaihar4.com/images/github.com/kaihar4/ifilter/module.gif)
47
+ ![module](http://file.kaihar4.com/images/github.com/kaihar4/ifilter/module.gif)
48
+
49
+ ```ruby
50
+ # test2.rb
51
+ require 'ifilter'
52
+
53
+ array = ['Small', 'Medium', 'Large']
54
+
55
+ client = Ifilter::Client.new('Please choose a size')
56
+ result = client.execute(array)
57
+
58
+ puts result
59
+ ```
60
+
61
+ ![class](http://file.kaihar4.com/images/github.com/kaihar4/ifilter/class.gif)
48
62
 
49
63
  ## Development
50
64
 
@@ -30,7 +30,7 @@ module Ifilter
30
30
  @filtered_result = nil
31
31
  @page_number = 1
32
32
 
33
- elsif key == 127 # <BS>
33
+ elsif key == 127 || key == 263 # <BS>
34
34
  @input.backspace!
35
35
  @filtered_result = nil
36
36
  @page_number = 1
@@ -102,7 +102,7 @@ module Ifilter
102
102
  @window << match_string
103
103
  @window.attrunset(Curses.color_pair(3))
104
104
 
105
- @window << word[match_pos + match_string.monospaced_bytesize, (@window.maxx - 1) - (match_pos + @input.monospaced_bytesize)]
105
+ @window << word[match_pos + match_string.monospaced_size, (@window.maxx - 1) - (match_pos + @input.monospaced_size)]
106
106
  else
107
107
  @window << word[0, @window.maxx - 1]
108
108
  end
@@ -116,7 +116,7 @@ module Ifilter
116
116
  @window.setpos(0, @window.maxx)
117
117
 
118
118
  word = "[#{@page_number}/#{max_page_number.zero? ? 1 : max_page_number}]"
119
- @window << (' ' * (@window.maxx - @prompt.monospaced_bytesize - @input.monospaced_bytesize - word.monospaced_bytesize)) + word
119
+ @window << (' ' * (@window.maxx - @prompt.monospaced_size - @input.monospaced_size - word.monospaced_size)) + word
120
120
  end
121
121
 
122
122
  def up_cursor_position
@@ -16,8 +16,8 @@ module Ifilter
16
16
  @text.size
17
17
  end
18
18
 
19
- def monospaced_bytesize
20
- @text.monospaced_bytesize
19
+ def monospaced_size
20
+ @text.monospaced_size
21
21
  end
22
22
 
23
23
  def backspace!
@@ -1,6 +1,6 @@
1
1
  module MonospacedString
2
2
  refine String do
3
- def monospaced_bytesize
3
+ def monospaced_size
4
4
  self.chars.map {|c| c.bytesize == 1 ? 1 : 2 }.reduce(&:+).to_i
5
5
  end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module Ifilter
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifilter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaihar4
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-18 00:00:00.000000000 Z
11
+ date: 2016-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.4.5.1
140
+ rubygems_version: 2.5.1
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Interactive Filter