Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit d077d45eebab801ff318850e1fe1896c79f5ce60 @jugyo committed Dec 3, 2011
Showing with 51 additions and 0 deletions.
  1. +4 −0 Gemfile
  2. +1 −0 Rakefile
  3. +19 −0 lib/open_as_text.rb
  4. +3 −0 lib/open_as_text/version.rb
  5. +24 −0 open_as_text.gemspec
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in open_as_text.gemspec
+gemspec
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
+require "open_as_text/version"
+require 'launchy'
+require 'pp'
+require 'tempfile'
+
+module OpenAsText
+ def open_as_text(object = nil)
+ object = object || self
+ tempfile = Tempfile.open("#{object.class.name}-#{object.object_id}-")
+ tempfile.write(object.pretty_inspect)
+ tempfile.flush
+ puts "opening... #{tempfile.path}"
+ Launchy.open(tempfile.path)
+ object
+ end
+ alias_method :ot, :open_as_text
+end
+
+Object.send(:include, OpenAsText)
@@ -0,0 +1,3 @@
+module OpenAsText
+ VERSION = "0.1.0"
+end
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "open_as_text/version"
+
+Gem::Specification.new do |s|
+ s.name = "open_as_text"
+ s.version = OpenAsText::VERSION
+ s.authors = ["jugyo"]
+ s.email = ["jugyo.org@gmail.com"]
+ s.homepage = ""
+ s.summary = %q{Object#open_as_text}
+ s.description = %q{open an object as text}
+
+ s.rubyforge_project = "open_as_text"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ # specify any dependencies here; for example:
+ # s.add_development_dependency "rspec"
+ s.add_runtime_dependency "launchy"
+end

0 comments on commit d077d45

Please sign in to comment.