Module: Unigrep
- Defined in:
- lib/unigrep.rb,
lib/unigrep/version.rb
Constant Summary collapse
- VERSION =
'1.0.0'
Class Method Summary collapse
Class Method Details
.data ⇒ Object
17 18 19 |
# File 'lib/unigrep.rb', line 17 def data @data ||= File.read(__FILE__).sub(/.+__END__\n/m, '').lines end |
.grep(regexp) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/unigrep.rb', line 10 def grep regexp data.grep(regexp).map{ |l| d, c = l.split(';') [c.rstrip, [c.to_i(16)].pack('U'), d] } end |
.unigrep(string) ⇒ Object
4 5 6 7 8 |
# File 'lib/unigrep.rb', line 4 def unigrep string grep(/#{string}/i).map{ |u, c, d| sprintf("%6s %s %s", u, c, d) } end |