littlestitious 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/littlestitious.rb +19 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b8b4c89b5ba54b975101372b296c5c81e496ec9
4
- data.tar.gz: cdd9e1d8facb2223f57af1a0d74452204a20d0ac
3
+ metadata.gz: a419ab2a100ca955c223403c37f2312711d457e0
4
+ data.tar.gz: a1957d07e5c8de375e1e1fb2a8c6088adf1f5613
5
5
  SHA512:
6
- metadata.gz: 158d605eca9bd448bd08ca806fa0e0bd218526c4d0e8dd6745f4551df6e849ffad8b98bdfb825143b1d5f0a2d06efa1f40eb5dfcb8c90c3429d488833bd8055b
7
- data.tar.gz: b43decf710be858ce0dfb662a77935bf88da369afff7d80bc68146e7c8441f7f1befff84d5f54d10a5c35688dad43eb17d9126248944f4b0f049216ab254dc4a
6
+ metadata.gz: 4d5dad3852cd941882e59ec82b307e23a7f206d4d2744bae181677a309ef5d73f09087dd91ebb45a090683ff17c7758fc9c26b456516e42a8c9d054b380f626d
7
+ data.tar.gz: '0028164d184e4fae62bb0e70f1754532ace803473d0f4733876223fd8f879597e5a3f27e2fad14bc2e76c64445113a66ec22d20517de2d96204ea2e16ec40326'
@@ -138,7 +138,7 @@ module Littlestitious
138
138
  @all_chars.map { |k, v| @char_lookup[v] = k }
139
139
 
140
140
  size_ok = @char_lookup.size == @all_chars.size
141
- message = "Mismatched charater mapping"
141
+ message = "Mismatched charater mapping".freeze
142
142
  raise AssertionError, message unless size_ok
143
143
 
144
144
  class_instance_vars = \
@@ -151,6 +151,8 @@ module Littlestitious
151
151
  end
152
152
 
153
153
  def includes_zero_width_characters?
154
+ return false if self.boring?
155
+
154
156
  self.class.zero_width_chars.each do | char_type, char |
155
157
  return true if self.include? char
156
158
  end
@@ -159,6 +161,8 @@ module Littlestitious
159
161
  end
160
162
 
161
163
  def includes_weird_spaces?
164
+ return false if self.boring?
165
+
162
166
  self.class.weird_space_chars.each do | char_type, char |
163
167
  return true if self.include? char
164
168
  end
@@ -167,6 +171,8 @@ module Littlestitious
167
171
  end
168
172
 
169
173
  def includes_non_printing_characters?
174
+ return false if self.boring?
175
+
170
176
  self.class.non_printing_chars.each do | char_type, char |
171
177
  return true if self.include? char
172
178
  end
@@ -174,10 +180,22 @@ module Littlestitious
174
180
  false
175
181
  end
176
182
 
183
+ def boring?
184
+ # Matches ascii character 10 and 32 to 126
185
+ # (newline + space + all visible)
186
+ regex_string = '[^\n -~]'.freeze
187
+
188
+ @boring_regex ||= Regexp.new regex_string
189
+
190
+ @boring_regex.match(self).nil?
191
+ end
192
+
177
193
  def strange_character_count
178
194
 
179
195
  char_count = Hash.new(0)
180
196
 
197
+ return char_count if self.boring?
198
+
181
199
  self.each_char do |char|
182
200
  char_type = self.class.char_lookup[char]
183
201
  next unless char_type
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: littlestitious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Aysan