zhrb 0.1.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.
- checksums.yaml +7 -0
 - data/bin/zhrb +4 -0
 - data/lib/mapping.yml +9 -0
 - data/lib/zhrb.rb +19 -0
 - metadata +48 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e80440f335ada544a3cea6c2bd3286a523240e2e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2e86199711f7d6a2b759fe129224e027b8171967
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 972be351a9505c1488f81964d42e3af12efef3362b158e96e561f74ce947eac39fc76e8c79d633aac5aa94725d24e7b59a54bd677955fe580aa11d146b733d83
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cc657fb9b1705fb00498b4adbf54f2e705059ae455b0d8770e8cfce64e850a932fbb18cf2e6ed58c865b3b3047ab81baac67304c792d9c4ecf2a92cc49c5ca8f
         
     | 
    
        data/bin/zhrb
    ADDED
    
    
    
        data/lib/mapping.yml
    ADDED
    
    
    
        data/lib/zhrb.rb
    ADDED
    
    | 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module ZHRB
         
     | 
| 
      
 4 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 5 
     | 
    
         
            +
                def eval code
         
     | 
| 
      
 6 
     | 
    
         
            +
                  super compile(code)
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def compile code
         
     | 
| 
      
 10 
     | 
    
         
            +
                  code.scan(/類\s+(\S+)/m).each do |matched|
         
     | 
| 
      
 11 
     | 
    
         
            +
                    matched = matched.first
         
     | 
| 
      
 12 
     | 
    
         
            +
                    code.gsub!(/(\s)(#{matched}[\.\s])/, '\1C\2')
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @mapping ||= YAML.load(File.read(File.join(__dir__, 'mapping.yml')))
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @mapping.each{|key, value| code.gsub!(key, value) }
         
     | 
| 
      
 16 
     | 
    
         
            +
                  code
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,48 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: zhrb
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Tony
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Jian
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-12-27 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 14 
     | 
    
         
            +
            description: Program Ruby in Chinese
         
     | 
| 
      
 15 
     | 
    
         
            +
            email: tonytonyjan@gmail.com
         
     | 
| 
      
 16 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 17 
     | 
    
         
            +
            - zhrb
         
     | 
| 
      
 18 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 19 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 20 
     | 
    
         
            +
            files:
         
     | 
| 
      
 21 
     | 
    
         
            +
            - bin/zhrb
         
     | 
| 
      
 22 
     | 
    
         
            +
            - lib/mapping.yml
         
     | 
| 
      
 23 
     | 
    
         
            +
            - lib/zhrb.rb
         
     | 
| 
      
 24 
     | 
    
         
            +
            homepage: http://tonytonyjan.net
         
     | 
| 
      
 25 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 26 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 27 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 28 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 29 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 30 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 31 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 32 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 33 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 34 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 35 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 36 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 37 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 38 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 39 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 40 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 41 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 42 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 43 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 44 
     | 
    
         
            +
            rubygems_version: 2.2.0.rc.1
         
     | 
| 
      
 45 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 46 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 47 
     | 
    
         
            +
            summary: Program Ruby in Chinese
         
     | 
| 
      
 48 
     | 
    
         
            +
            test_files: []
         
     |