flex_console 0.0.0 → 0.0.1
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.
- checksums.yaml +4 -4
- data/lib/flex_console.rb +12 -8
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 42c6c073973bdbf49119df9fc7aa43148bb2451b
         | 
| 4 | 
            +
              data.tar.gz: c41740b12c33ee5a64aa7bd49d3e42159861b621
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6264581c88cfb3bee88fef7cbb03292bb3ef605daaebc46795a8e50d8dc01104b5554845aac2f7217f5791fbbe8ba094be04343f349caa612ebf625716c5f60f
         | 
| 7 | 
            +
              data.tar.gz: 653760b733d9950d679f78d8ac34a5df94aed5b1254d2654a6f6b7a1d8a6a47dfb6fb79e46c6b1710f8bdf522bc0cdd08a0b70b18d7875492d468253485d0f64
         | 
    
        data/lib/flex_console.rb
    CHANGED
    
    | @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            require 'flex_console/dummy'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module FlexConsole
         | 
| 2 4 |  | 
| 3 5 | 
             
              class << self
         | 
| @@ -5,24 +7,26 @@ module FlexConsole | |
| 5 7 | 
             
                            :test_args
         | 
| 6 8 |  | 
| 7 9 | 
             
                def bind(obj, binding)
         | 
| 10 | 
            +
             | 
| 11 | 
            +
             | 
| 8 12 | 
             
                  @plain_loop = ->(message) {
         | 
| 13 | 
            +
                    commands = []
         | 
| 9 14 | 
             
                    begin
         | 
| 10 15 | 
             
                      puts message
         | 
| 11 16 | 
             
                      quit = false
         | 
| 12 | 
            -
                      counter = 0
         | 
| 13 17 | 
             
                      until quit
         | 
| 14 18 | 
             
                        response = gets.chomp
         | 
| 15 | 
            -
                         | 
| 16 | 
            -
             | 
| 17 | 
            -
                          if counter == 2
         | 
| 18 | 
            -
                            quit = true
         | 
| 19 | 
            -
                          end
         | 
| 20 | 
            -
                        elsif response == 'exit'
         | 
| 19 | 
            +
                        commands << response
         | 
| 20 | 
            +
                        if response == 'q' || response == 'exit'
         | 
| 21 21 | 
             
                          quit = true
         | 
| 22 | 
            +
                        elsif response == ''
         | 
| 23 | 
            +
                          commands[-1] = commands[-2]
         | 
| 24 | 
            +
                          puts 'repeating'
         | 
| 25 | 
            +
                          binding.eval(commands[-2].strip.gsub("\n", ''))
         | 
| 26 | 
            +
                          puts '------------------'
         | 
| 22 27 | 
             
                        else
         | 
| 23 28 | 
             
                          binding.eval(response.strip.gsub("\n", ''))
         | 
| 24 29 | 
             
                          puts '------------------'
         | 
| 25 | 
            -
                          counter = 0
         | 
| 26 30 | 
             
                        end
         | 
| 27 31 | 
             
                      end
         | 
| 28 32 | 
             
                    rescue Exception => e
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: flex_console
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Eugene Lai
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2016-03-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: To do
         | 
| 14 14 | 
             
            email: ejt.lai@gmail.com
         |