yaih 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in yaih.gemspec
4
+ gemspec
data/README ADDED
@@ -0,0 +1 @@
1
+ I'm currently writing it
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/lib/yaih.rb ADDED
@@ -0,0 +1 @@
1
+ require "yaih/kernel"
@@ -0,0 +1,38 @@
1
+ module Kernel
2
+
3
+ def history_a(n=Readline::HISTORY.size)
4
+ size=Readline::HISTORY.size
5
+ Readline::HISTORY.to_a[(size - n)..size-1]
6
+ end
7
+
8
+ def decorate_h(n)
9
+ size=Readline::HISTORY.size
10
+ ((size - n)..size-1).zip(history_a(n)).map {|e| e.join(" ")}
11
+ end
12
+
13
+ def h(n=10)
14
+ entries = decorate_h(n)
15
+ puts entries
16
+ entries.size
17
+ end
18
+
19
+ def hgrep(word)
20
+ matched=decorate_h(Readline::HISTORY.size - 1).select {|h| h.match(word)}
21
+ puts matched
22
+ matched.size
23
+ end
24
+
25
+ def h!(start, stop=nil)
26
+ stop=start unless stop
27
+ code = history_a[start..stop]
28
+ code.each_with_index { |e,i|
29
+ irb_context.evaluate(e,i)
30
+ }
31
+ Readline::HISTORY.pop
32
+ code.each { |l|
33
+ Readline::HISTORY.push l
34
+ }
35
+ puts code
36
+ end
37
+
38
+ end
@@ -0,0 +1,3 @@
1
+ module Yaih
2
+ VERSION = "0.0.1"
3
+ end
data/yaih.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "yaih/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "yaih"
7
+ s.version = Yaih::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["lucapette"]
10
+ s.email = ["lucapette@gmail.com"]
11
+ s.homepage = "https://github.com/lucapette/yaih"
12
+ s.summary = %q{Yet Another IRB History}
13
+ s.description = %q{a bash like history}
14
+
15
+ s.rubyforge_project = "yaih"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yaih
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - lucapette
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-03-16 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: a bash like history
22
+ email:
23
+ - lucapette@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - README
34
+ - Rakefile
35
+ - lib/yaih.rb
36
+ - lib/yaih/kernel.rb
37
+ - lib/yaih/version.rb
38
+ - yaih.gemspec
39
+ has_rdoc: true
40
+ homepage: https://github.com/lucapette/yaih
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project: yaih
67
+ rubygems_version: 1.3.7
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Yet Another IRB History
71
+ test_files: []
72
+