number_to_indian_currency 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b43b3ab79554ee45bf952178385b162a071c83a
4
+ data.tar.gz: 14d8e4ace161a92d95f128b0e8bf87db3ca4b033
5
+ SHA512:
6
+ metadata.gz: f1309dc020999a2bf7ffc1bec1f57acadddfb9cbf1b81c6e0edbf1bf9047a8d474d2af6ee38fb7759262d8bebf4fda2f8992deb8ea74a9da729d0902e5b72bf3
7
+ data.tar.gz: 1023b0c0d0958af0047c99282542608b029aab1b1e02ac2bba346884072c94dda82519613b125c21d5ebf5e49bbcce62bcb0b4529ade5aa88d32ea683fd479d3
data/.gitignore CHANGED
@@ -1,3 +1,9 @@
1
- pkg/*
2
- *.gem
3
- .bundle
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in number_to_indian_currency.gemspec
4
4
  gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Sandip Ransing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,25 +1,29 @@
1
1
  ## Number To Indian Currency Helper
2
2
 
3
- Helper method which adds indian currency format to number
3
+ This gem adds `number_to_indian_currency` helper method which formats number to the indian style.
4
+ Also provides css support to show rupee symbol along-with the formatted number.
4
5
 
5
6
  ### Installation
6
-
7
- ### Rails 2.X
8
- gem install number_to_indian_currency
9
-
7
+ ```
8
+ gem install number_to_indian_currency
9
+ ```
10
10
  ### Using Bundler
11
-
12
- gem 'number_to_indian_currency'
13
-
14
- ### Add following line to application layout
15
- stylesheet_link_tag 'rupees'
16
-
17
- ### Usage
18
- number_to_indian_currency(2000, false) => "Rs.2,000"
19
- number_to_indian_currency(2040.50, false) => "Rs.2,040.5"
20
- number_to_indian_currency(1222040.54, false) => "Rs.12,22,040.54"
21
- number_to_indian_currency(9921) => "<span class="WebRupee">Rs.</span> 9,921"
11
+ ```
12
+ gem 'number_to_indian_currency'
13
+ ```
14
+ ### Add following line to the layout
15
+ ```
16
+ stylesheet_link_tag 'rupees'
17
+ ```
18
+
19
+ ### Example Usage
20
+ ```
21
+ number_to_indian_currency(2000) => "Rs.2,000"
22
+ number_to_indian_currency(2040.50, text: 'Rs. ') => "Rs. 2,040.5"
23
+ number_to_indian_currency(1222040.54, text: 'Rupee: ') => "Rupee: 12,22,040.54"
24
+ number_to_indian_currency(9921, web_rupee: true) => "<span class="WebRupee">Rs.</span> 9,921"
25
+ ```
22
26
 
23
27
  thats, all
24
28
 
25
- any sugestions? **sandip at funonrails.com** or **sandip at joshsoftware.com** released under the MIT license
29
+ any sugestions? email me **sandip at funonrails.com** released under the MIT license
data/Rakefile CHANGED
@@ -1,2 +1,10 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "number_to_indian_currency"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -1,16 +1,21 @@
1
+ require "number_to_indian_currency/version"
2
+
1
3
  module NumberToIndianCurrency
2
4
  def self.initialize
3
5
  return if @intialized
4
- raise "ActionView is not available." unless defined?(ActionView)
5
- ActionView::Base.send :include, CurrencyHelper
6
- NumberToIndianCurrency.install
7
- @intialized = true
6
+ if defined?(ActionView)
7
+ ActionView::Base.send :include, CurrencyHelper
8
+ NumberToIndianCurrency.install
9
+ @intialized = true
10
+ else
11
+ puts "ActionView is not available."
12
+ end
8
13
  end
9
14
 
10
15
  def self.install
11
16
  require 'fileutils'
12
- orig = File.join(File.dirname(__FILE__), '../public/stylesheets/.')
13
- dest = 'public/stylesheets'
17
+ orig = File.join(File.dirname(__FILE__), '../app/assets/stylesheets/.')
18
+ dest = 'lib/assets/stylesheets'
14
19
  rupees_css = File.join(dest, 'rupees.css')
15
20
  unless File.exists?(rupees_css) && FileUtils.identical?(File.join(orig, 'rupees.css'), rupees_css)
16
21
  if File.exists?(rupees_css)
@@ -33,9 +38,12 @@ module NumberToIndianCurrency
33
38
  end
34
39
 
35
40
  module CurrencyHelper
36
- def number_to_indian_currency(number, html=true)
37
- txt = html ? content_tag(:span, 'Rs.', :class => :WebRupee) : 'Rs.'
38
- "#{txt} #{number.to_s.gsub(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/, "\\1,")}"
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
39
47
  end
40
48
  end
41
49
  end
@@ -1,3 +1,3 @@
1
1
  module NumberToIndianCurrency
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -1,21 +1,33 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "number_to_indian_currency/version"
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'number_to_indian_currency/version'
4
5
 
5
- Gem::Specification.new do |s|
6
- s.name = "number_to_indian_currency"
7
- s.version = NumberToIndianCurrency::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Sandip Ransing"]
10
- s.email = ["sandip@funonrails.com"]
11
- s.homepage = ""
12
- s.summary = %q{Helper that coverts number to indian currency with rupees symbol with css}
13
- s.description = "Converts number to indian currency with rupee style"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "number_to_indian_currency"
8
+ spec.version = NumberToIndianCurrency::VERSION
9
+ spec.authors = ["Sandip Ransing"]
10
+ spec.email = ["sandip@funonrails.com"]
14
11
 
15
- s.rubyforge_project = "number_to_indian_currency"
12
+ spec.summary = %q{Helper that coverts number to indian currency with rupees symbol with css}
13
+ spec.description = "number_to_indian_currency helper converts given number to the indian currency format (also displays Rupees symbol)"
14
+ spec.homepage = "https://github.com/sandipransing/number_to_indian_currency"
15
+ spec.license = "MIT"
16
16
 
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib"]
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "minitest"
21
33
  end
metadata CHANGED
@@ -1,76 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: number_to_indian_currency
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 4
10
- version: 1.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.5
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Sandip Ransing
14
8
  autorequire:
15
- bindir: bin
9
+ bindir: exe
16
10
  cert_chain: []
17
-
18
- date: 2011-04-12 00:00:00 +05:30
19
- default_executable:
20
- dependencies: []
21
-
22
- description: Converts number to indian currency with rupee style
23
- email:
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: number_to_indian_currency helper converts given number to the indian
56
+ currency format (also displays Rupees symbol)
57
+ email:
24
58
  - sandip@funonrails.com
25
59
  executables: []
26
-
27
60
  extensions: []
28
-
29
61
  extra_rdoc_files: []
30
-
31
- files:
32
- - .gitignore
62
+ files:
63
+ - ".gitignore"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
33
66
  - Gemfile
67
+ - LICENSE.txt
34
68
  - README.md
35
69
  - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/assets/stylesheets/rupees.css
36
73
  - lib/number_to_indian_currency.rb
37
74
  - lib/number_to_indian_currency/version.rb
38
75
  - number_to_indian_currency.gemspec
39
- - public/stylesheets/rupees.css
40
76
  - tasks/currency.rake
41
- has_rdoc: true
42
- homepage: ""
43
- licenses: []
44
-
77
+ homepage: https://github.com/sandipransing/number_to_indian_currency
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
45
81
  post_install_message:
46
82
  rdoc_options: []
47
-
48
- require_paths:
83
+ require_paths:
49
84
  - lib
50
- required_ruby_version: !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
53
87
  - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
59
- required_rubygems_version: !ruby/object:Gem::Requirement
60
- none: false
61
- requirements:
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
62
92
  - - ">="
63
- - !ruby/object:Gem::Version
64
- hash: 3
65
- segments:
66
- - 0
67
- version: "0"
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
68
95
  requirements: []
69
-
70
- rubyforge_project: number_to_indian_currency
71
- rubygems_version: 1.3.7
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.5
72
98
  signing_key:
73
- specification_version: 3
99
+ specification_version: 4
74
100
  summary: Helper that coverts number to indian currency with rupees symbol with css
75
101
  test_files: []
76
-