open_as_text 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in open_as_text.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module OpenAsText
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,19 @@
1
+ require "open_as_text/version"
2
+ require 'launchy'
3
+ require 'pp'
4
+ require 'tempfile'
5
+
6
+ module OpenAsText
7
+ def open_as_text(object = nil)
8
+ object = object || self
9
+ tempfile = Tempfile.open("#{object.class.name}-#{object.object_id}-")
10
+ tempfile.write(object.pretty_inspect)
11
+ tempfile.flush
12
+ puts "opening... #{tempfile.path}"
13
+ Launchy.open(tempfile.path)
14
+ object
15
+ end
16
+ alias_method :ot, :open_as_text
17
+ end
18
+
19
+ Object.send(:include, OpenAsText)
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "open_as_text/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "open_as_text"
7
+ s.version = OpenAsText::VERSION
8
+ s.authors = ["jugyo"]
9
+ s.email = ["jugyo.org@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Object#open_as_text}
12
+ s.description = %q{open an object as text}
13
+
14
+ s.rubyforge_project = "open_as_text"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "launchy"
24
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: open_as_text
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - jugyo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: launchy
16
+ requirement: &70223605093760 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70223605093760
25
+ description: open an object as text
26
+ email:
27
+ - jugyo.org@gmail.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - Gemfile
33
+ - Rakefile
34
+ - lib/open_as_text.rb
35
+ - lib/open_as_text/version.rb
36
+ - open_as_text.gemspec
37
+ homepage: ''
38
+ licenses: []
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project: open_as_text
57
+ rubygems_version: 1.8.11
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Object#open_as_text
61
+ test_files: []