number_to_indian_currency 1.0.5 → 1.0.6
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9045858ac6c7ea962143df808e1c592001baf9f2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0445050545c4c5ee206bc4667bdc2e863042cc2c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b1d707bf53cbe86a86c906f3c83d19f7c329ae9a1432f6c591860db902cbec2ff2fb7f7d886d082534ea013efd046eb25c094ba68e97102de291fb88c975b1ad
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a51f4c22f1258e9fbab8181a227aee6f98f9ee80465e1c0cc53a5da7458f3649009c94e69f20736c47a6e03b4e8548977c308f2d202001224771d6bbfebe0b61
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            @font-face { font-family: "WebRupee"; font-style: normal; font-weight: normal; src: local("WebRupee"), url(" 
     | 
| 
      
 1 
     | 
    
         
            +
            @font-face { font-family: "WebRupee"; font-style: normal; font-weight: normal; src: local("WebRupee"), url("https://cdnjs.cloudflare.com/ajax/libs/WebRupee/2.0/WebRupee.V2.0.ttf") format("truetype"), url("https://cdnjs.cloudflare.com/ajax/libs/WebRupee/2.0/WebRupee.V2.0.woff") format("woff"), url("https://cdnjs.cloudflare.com/ajax/libs/WebRupee/2.0/WebRupee.V2.0.svg") format("svg"); } .WebRupee { font-family: 'WebRupee'; }
         
     | 
| 
         @@ -1,4 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "number_to_indian_currency/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "number_to_indian_currency/currency_helper"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            module NumberToIndianCurrency
         
     | 
| 
       4 
6 
     | 
    
         
             
              def self.initialize
         
     | 
| 
         @@ -13,39 +15,19 @@ module NumberToIndianCurrency 
     | 
|
| 
       13 
15 
     | 
    
         
             
              end
         
     | 
| 
       14 
16 
     | 
    
         | 
| 
       15 
17 
     | 
    
         
             
              def self.install
         
     | 
| 
       16 
     | 
    
         
            -
                 
     | 
| 
       17 
     | 
    
         
            -
                 
     | 
| 
       18 
     | 
    
         
            -
                 
     | 
| 
       19 
     | 
    
         
            -
                 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                   
     | 
| 
       22 
     | 
    
         
            -
                     
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                    rescue Exception => e
         
     | 
| 
       27 
     | 
    
         
            -
                      puts e.message
         
     | 
| 
       28 
     | 
    
         
            -
                    end
         
     | 
| 
       29 
     | 
    
         
            -
                  else
         
     | 
| 
       30 
     | 
    
         
            -
                    begin
         
     | 
| 
       31 
     | 
    
         
            -
                      puts "Copying #{rupees_css}..."
         
     | 
| 
       32 
     | 
    
         
            -
                      FileUtils.cp_r orig, dest
         
     | 
| 
       33 
     | 
    
         
            -
                    rescue Exception => e
         
     | 
| 
       34 
     | 
    
         
            -
                      puts e.message
         
     | 
| 
       35 
     | 
    
         
            -
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                filename = 'rupees.css'
         
     | 
| 
      
 19 
     | 
    
         
            +
                sourcefile = File.join('lib/assets/stylesheets', filename)
         
     | 
| 
      
 20 
     | 
    
         
            +
                destfile = File.join(File.dirname(__FILE__), '../app/assets/stylesheets/', filename)
         
     | 
| 
      
 21 
     | 
    
         
            +
                unless File.exists?(destfile) &&
         
     | 
| 
      
 22 
     | 
    
         
            +
                  FileUtils.identical?(destfile, sourcefile)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 24 
     | 
    
         
            +
                    FileUtils.mkdir_p File.dirname(destfile)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    FileUtils.cp sourcefile, destfile
         
     | 
| 
      
 26 
     | 
    
         
            +
                  rescue Exception => e
         
     | 
| 
      
 27 
     | 
    
         
            +
                    puts e.message
         
     | 
| 
       36 
28 
     | 
    
         
             
                  end
         
     | 
| 
       37 
29 
     | 
    
         
             
                end
         
     | 
| 
       38 
30 
     | 
    
         
             
              end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
              module CurrencyHelper
         
     | 
| 
       41 
     | 
    
         
            -
                def number_to_indian_currency(number, options={})
         
     | 
| 
       42 
     | 
    
         
            -
                  web_rupee = options.fetch(:web_rupee, false)
         
     | 
| 
       43 
     | 
    
         
            -
                  text = options.fetch(:text, 'Rs.')
         
     | 
| 
       44 
     | 
    
         
            -
                  text = content_tag(:span, text, class: :WebRupee) if web_rupee
         
     | 
| 
       45 
     | 
    
         
            -
                  formatted_number = number.to_s.gsub(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/, "\\1,")
         
     | 
| 
       46 
     | 
    
         
            -
                  return [text, formatted_number].join
         
     | 
| 
       47 
     | 
    
         
            -
                end
         
     | 
| 
       48 
     | 
    
         
            -
              end
         
     | 
| 
       49 
31 
     | 
    
         
             
            end
         
     | 
| 
       50 
32 
     | 
    
         | 
| 
       51 
33 
     | 
    
         
             
            NumberToIndianCurrency.initialize
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module NumberToIndianCurrency
         
     | 
| 
      
 2 
     | 
    
         
            +
              module CurrencyHelper
         
     | 
| 
      
 3 
     | 
    
         
            +
                def number_to_indian_currency(number, options={})
         
     | 
| 
      
 4 
     | 
    
         
            +
                  web_rupee = options.fetch(:web_rupee, false)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  text = options.fetch(:text, 'Rs.')
         
     | 
| 
      
 6 
     | 
    
         
            +
                  text = content_tag(:span, text, class: :WebRupee) if web_rupee
         
     | 
| 
      
 7 
     | 
    
         
            +
                  formatted_number = number.to_s.gsub(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/, "\\1,")
         
     | 
| 
      
 8 
     | 
    
         
            +
                  return [text, formatted_number].join
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: number_to_indian_currency
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Sandip Ransing
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-08- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-08-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -52,6 +52,20 @@ dependencies: 
     | 
|
| 
       52 
52 
     | 
    
         
             
                - - ">="
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
54 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: mocha
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       55 
69 
     | 
    
         
             
            description: number_to_indian_currency helper converts given number to the indian
         
     | 
| 
       56 
70 
     | 
    
         
             
              currency format (also displays Rupees symbol)
         
     | 
| 
       57 
71 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -71,6 +85,7 @@ files: 
     | 
|
| 
       71 
85 
     | 
    
         
             
            - bin/setup
         
     | 
| 
       72 
86 
     | 
    
         
             
            - lib/assets/stylesheets/rupees.css
         
     | 
| 
       73 
87 
     | 
    
         
             
            - lib/number_to_indian_currency.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - lib/number_to_indian_currency/currency_helper.rb
         
     | 
| 
       74 
89 
     | 
    
         
             
            - lib/number_to_indian_currency/version.rb
         
     | 
| 
       75 
90 
     | 
    
         
             
            - number_to_indian_currency.gemspec
         
     | 
| 
       76 
91 
     | 
    
         
             
            - tasks/currency.rake
         
     |