diff options
author | ara.t.howard <ara.t.howard@gmail.com> | 2010-05-20 13:16:55 -0600 |
---|---|---|
committer | ara.t.howard <ara.t.howard@gmail.com> | 2010-05-20 13:16:55 -0600 |
commit | b464fd82d324eb88c38bdb9c9ecf3c02ed3efdcb (patch) | |
tree | ff5d49b33382ab497c66686cf80ddcdbdfaace0a | |
parent | 0ff13d7f3547fcce760004fc3071612a4866114d (diff) | |
download | systemu-b464fd82d324eb88c38bdb9c9ecf3c02ed3efdcb.tar.gz |
updates for ruby 1.9.1
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | README.erb | 3 | ||||
-rw-r--r-- | Rakefile | 16 | ||||
-rw-r--r-- | lib/systemu.rb | 6 | ||||
-rw-r--r-- | systemu.gemspec | 2 |
5 files changed, 24 insertions, 14 deletions
@@ -16,6 +16,9 @@ INSTALL gem install systemu HISTORY + 1.3.1 + - updates for ruby 1.9.1 + 1.3.0 - move to github @@ -47,7 +50,7 @@ SAMPLES ~ > ruby samples/a.rb - [#<Process::Status: pid=5138,exited(0)>, "Thu Jan 07 13:19:37 -0700 2010\n", "Thu Jan 07 13:19:37 -0700 2010\n"] + [#<Process::Status: pid=2891,exited(0)>, "Thu May 20 13:16:02 -0600 2010\n", "Thu May 20 13:16:02 -0600 2010\n"] <========< samples/b.rb >========> @@ -69,7 +72,7 @@ SAMPLES ~ > ruby samples/b.rb - [#<Process::Status: pid=5143,exited(0)>, "Thu Jan 07 13:19:38 -0700 2010\n", "Thu Jan 07 13:19:38 -0700 2010\n"] + [#<Process::Status: pid=2896,exited(0)>, "Thu May 20 13:16:02 -0600 2010\n", "Thu May 20 13:16:02 -0600 2010\n"] <========< samples/c.rb >========> @@ -157,7 +160,7 @@ SAMPLES ~ > ruby samples/f.rb - #<Process::Status: pid=5163,signaled(SIGKILL=9)> - "1262895578\n1262895579\n1262895580\n" + #<Process::Status: pid=2916,signaled(SIGKILL=9)> + "1274382962\n1274382963\n1274382964\n" @@ -16,6 +16,9 @@ INSTALL gem install systemu HISTORY + 1.3.1 + - updates for ruby 1.9.1 + 1.3.0 - move to github @@ -208,23 +208,27 @@ BEGIN { def unindent(s) indent = nil - s.each do |line| - next if line =~ %r/^\s*$/ - indent = line[%r/^\s*/] and break + s.each_line do |line| + next if line =~ %r/^\s*$/ + indent = line[%r/^\s*/] and break + end + indent ? s.gsub(%r/^#{ indent }/, "") : s end - indent ? s.gsub(%r/^#{ indent }/, "") : s - end + extend self end class Template def initialize(&block) @block = block + @binding = @block.respond_to?(:binding) ? @block.binding : @block @template = block.call.to_s end + def expand(b=nil) - ERB.new(Util.unindent(@template)).result(b||@block) + ERB.new(Util.unindent(@template)).result(b||@binding) end + alias_method 'to_s', 'expand' end def Template(*args, &block) Template.new(*args, &block) end diff --git a/lib/systemu.rb b/lib/systemu.rb index a29087c..bf5e829 100644 --- a/lib/systemu.rb +++ b/lib/systemu.rb @@ -14,7 +14,7 @@ class SystemUniversal # # constants # - SystemUniversal::VERSION = '1.3.0' unless defined? SystemUniversal::VERSION + SystemUniversal::VERSION = '1.4.0' unless defined? SystemUniversal::VERSION def SystemUniversal.version() SystemUniversal::VERSION end def version() SystemUniversal::VERSION end # @@ -235,10 +235,10 @@ class SystemUniversal def getopts opts = {} lambda do |*args| keys, default, ignored = args - catch('opt') do + catch(:opt) do [keys].flatten.each do |key| [key, key.to_s, key.to_s.intern].each do |key| - throw 'opt', opts[key] if opts.has_key?(key) + throw :opt, opts[key] if opts.has_key?(key) end end default diff --git a/systemu.gemspec b/systemu.gemspec index 1f38a94..bc8841b 100644 --- a/systemu.gemspec +++ b/systemu.gemspec @@ -8,7 +8,7 @@ Gem::Specification::new do |spec| spec.summary = "systemu" spec.description = "description: systemu kicks the ass" - spec.files = ["lib", "lib/systemu.rb", "LICENSE", "Rakefile", "README.erb", "samples", "samples/a.rb", "samples/b.rb", "samples/c.rb", "samples/d.rb", "samples/e.rb", "samples/f.rb", "systemu.gemspec"] + spec.files = ["lib", "lib/systemu.rb", "LICENSE", "Rakefile", "README", "README.erb", "samples", "samples/a.rb", "samples/b.rb", "samples/c.rb", "samples/d.rb", "samples/e.rb", "samples/f.rb", "systemu.gemspec"] spec.executables = [] spec.require_path = "lib" |