g 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/g.gemspec +1 -1
- data/lib/g.rb +12 -11
- data/spec/g_spec.rb +12 -12
- metadata +5 -5
    
        data/g.gemspec
    CHANGED
    
    
    
        data/lib/g.rb
    CHANGED
    
    | @@ -7,23 +7,24 @@ $g_priority ||= 0 | |
| 7 7 | 
             
            $g_sticky ||= true
         | 
| 8 8 |  | 
| 9 9 | 
             
            module Kernel
         | 
| 10 | 
            -
              def g(*args | 
| 11 | 
            -
                 | 
| 10 | 
            +
              def g(*args)
         | 
| 11 | 
            +
                messages = args.dup
         | 
| 12 12 |  | 
| 13 | 
            -
                 | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
                  if args.empty?
         | 
| 17 | 
            -
                    ['g!']
         | 
| 13 | 
            +
                if messages.empty?
         | 
| 14 | 
            +
                  if block_given?
         | 
| 15 | 
            +
                    messages << yield(self)
         | 
| 18 16 | 
             
                  else
         | 
| 19 | 
            -
                     | 
| 17 | 
            +
                    messages << self
         | 
| 20 18 | 
             
                  end
         | 
| 19 | 
            +
                end
         | 
| 21 20 |  | 
| 22 | 
            -
                 | 
| 23 | 
            -
             | 
| 21 | 
            +
                messages.each do |i|
         | 
| 22 | 
            +
                  text = i.is_a?(String) ? i : i.pretty_inspect
         | 
| 23 | 
            +
                  GNTP.notify :app_name => $0, :title => 'g', :text => text, :sticky => $g_sticky
         | 
| 24 | 
            +
                end
         | 
| 24 25 |  | 
| 25 26 | 
             
                if args.empty?
         | 
| 26 | 
            -
                   | 
| 27 | 
            +
                  self
         | 
| 27 28 | 
             
                elsif args.size == 1
         | 
| 28 29 | 
             
                  args.first
         | 
| 29 30 | 
             
                else
         | 
    
        data/spec/g_spec.rb
    CHANGED
    
    | @@ -3,24 +3,24 @@ require 'g' | |
| 3 3 |  | 
| 4 4 | 
             
            describe 'g' do
         | 
| 5 5 | 
             
              it 'calls with a arg' do
         | 
| 6 | 
            -
                GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => "foo" | 
| 6 | 
            +
                GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => "foo", :sticky=>true)
         | 
| 7 7 | 
             
                g('foo').should == 'foo'
         | 
| 8 8 | 
             
              end
         | 
| 9 9 |  | 
| 10 | 
            -
              it 'calls with  | 
| 11 | 
            -
                 | 
| 12 | 
            -
                 | 
| 13 | 
            -
                g(&block).should == block
         | 
| 10 | 
            +
              it 'calls with args' do
         | 
| 11 | 
            +
                GNTP.should_receive(:notify).exactly(2).times
         | 
| 12 | 
            +
                g('foo', 1).should == ['foo', 1]
         | 
| 14 13 | 
             
              end
         | 
| 15 14 |  | 
| 16 | 
            -
              it 'calls  | 
| 17 | 
            -
                 | 
| 18 | 
            -
                GNTP.should_receive(:notify). | 
| 19 | 
            -
                g | 
| 15 | 
            +
              it 'calls for instance' do
         | 
| 16 | 
            +
                object = Object.new
         | 
| 17 | 
            +
                GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => object.pretty_inspect, :sticky=>true)
         | 
| 18 | 
            +
                object.g.should == object
         | 
| 20 19 | 
             
              end
         | 
| 21 20 |  | 
| 22 | 
            -
              it 'calls  | 
| 23 | 
            -
                 | 
| 24 | 
            -
                 | 
| 21 | 
            +
              it 'calls with &block' do
         | 
| 22 | 
            +
                object = "foo"
         | 
| 23 | 
            +
                GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => "FOO", :sticky=>true)
         | 
| 24 | 
            +
                object.g {|i| i.upcase}.should == object
         | 
| 25 25 | 
             
              end
         | 
| 26 26 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: g
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.6.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,11 +9,11 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2012-01-13 00:00:00.000000000Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: ruby_gntp
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &70154826525400 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ! '>='
         | 
| @@ -21,7 +21,7 @@ dependencies: | |
| 21 21 | 
             
                    version: '0'
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *70154826525400
         | 
| 25 25 | 
             
            description: It works like Kernel.p with growl :)
         | 
| 26 26 | 
             
            email:
         | 
| 27 27 | 
             
            - jugyo.org@gmail.com
         | 
| @@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 57 57 | 
             
                  version: '0'
         | 
| 58 58 | 
             
            requirements: []
         | 
| 59 59 | 
             
            rubyforge_project: g
         | 
| 60 | 
            -
            rubygems_version: 1.8. | 
| 60 | 
            +
            rubygems_version: 1.8.10
         | 
| 61 61 | 
             
            signing_key: 
         | 
| 62 62 | 
             
            specification_version: 3
         | 
| 63 63 | 
             
            summary: The Kernel.g
         |