Module: Littlestitious
- Defined in:
- lib/littlestitious.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #includes_non_printing_characters? ⇒ Boolean
- #includes_weird_spaces? ⇒ Boolean
- #includes_zero_width_characters? ⇒ Boolean
- #strange_character_count ⇒ Object (also: #count_strange_characters, #count_strange_chars, #count_strange, #strange_count, #strange_char_count)
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/littlestitious.rb', line 4 def self.included(base) base.instance_eval do extend(ClassMethods) initialize_littlestitious_vars(base) end end |
Instance Method Details
#includes_non_printing_characters? ⇒ Boolean
169 170 171 172 173 174 175 |
# File 'lib/littlestitious.rb', line 169 def includes_non_printing_characters? self.class.non_printing_chars.each do | char_type, char | return true if self.include? char end false end |
#includes_weird_spaces? ⇒ Boolean
161 162 163 164 165 166 167 |
# File 'lib/littlestitious.rb', line 161 def includes_weird_spaces? self.class.weird_space_chars.each do | char_type, char | return true if self.include? char end false end |
#includes_zero_width_characters? ⇒ Boolean
153 154 155 156 157 158 159 |
# File 'lib/littlestitious.rb', line 153 def includes_zero_width_characters? self.class.zero_width_chars.each do | char_type, char | return true if self.include? char end false end |
#strange_character_count ⇒ Object Also known as: count_strange_characters, count_strange_chars, count_strange, strange_count, strange_char_count
177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/littlestitious.rb', line 177 def strange_character_count char_count = Hash.new(0) self.each_char do |char| char_type = self.class.char_lookup[char] next unless char_type char_count[char_type] += 1 end char_count end |