number_to_indian_currency 0.1.0 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,9 +1,3 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in number_to_indian_currency.gemspec
4
4
  gemspec
data/Rakefile CHANGED
@@ -1,10 +1,2 @@
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
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -1,3 +1,3 @@
1
1
  module NumberToIndianCurrency
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0"
3
3
  end
@@ -1,51 +1,43 @@
1
- require "number_to_indian_currency/version"
2
-
3
1
  module NumberToIndianCurrency
4
- def self.initialize
5
- return if @intialized
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
13
- end
2
+ def self.initialize
3
+ return if @intialized
4
+ raise "ActionView is not available." unless defined?(ActionView)
5
+ ActionView::Base.send :include, CurrencyHelper
6
+ NumberToIndianCurrency.install
7
+ @intialized = true
8
+ end
14
9
 
15
- def self.install
16
- require 'fileutils'
17
- orig = File.join(File.dirname(__FILE__), '../app/assets/stylesheets/.')
18
- dest = 'lib/assets/stylesheets'
19
- rupees_css = File.join(dest, 'rupees.css')
20
- unless File.exists?(rupees_css) && FileUtils.identical?(File.join(orig, 'rupees.css'), rupees_css)
21
- if File.exists?(rupees_css)
22
- begin
23
- puts "Removing..."
24
- FileUtils.rm rupees_css
25
- FileUtils.cp_r orig, dest
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
36
- end
37
- end
38
- end
10
+ def self.install
11
+ require 'fileutils'
12
+ orig = File.join(File.dirname(__FILE__), '..', 'public', 'stylesheets')
13
+ dest = File.join(Rails.root.to_s, 'public', 'stylesheets')
14
+ rupees_css = File.join(dest, 'rupees.css')
15
+ unless File.exists?(rupees_css) && FileUtils.identical?(File.join(orig, 'rupees.css'), rupees_css)
16
+ if File.exists?(rupees_css)
17
+ begin
18
+ puts "Removing..."
19
+ FileUtils.rm rupees_css
20
+ FileUtils.cp_r "#{orig}/.", dest
21
+ rescue Exception => e
22
+ puts e.message
23
+ end
24
+ else
25
+ begin
26
+ puts "Adding..."
27
+ FileUtils.cp_r "#{orig}/.", dest
28
+ rescue Exception => e
29
+ puts e.message
30
+ end
31
+ end
32
+ end
33
+ end
39
34
 
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
35
+ module CurrencyHelper
36
+ def number_to_indian_currency(number, html=false)
37
+ txt = html ? content_tag(:span, 'Rs.', :class => :WebRupee) : 'Rs.' "#{txt}
38
+ #{number.to_s.gsub(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/, "\\1,")}"
39
+ end
40
+ end
49
41
  end
50
42
 
51
43
  NumberToIndianCurrency.initialize
@@ -1,33 +1,33 @@
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'
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "number_to_indian_currency/version"
5
4
 
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"]
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 = %q{
14
+ Number to Indian Currency with rupees symbol
11
15
 
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
+ Example Usage
17
+ --------------------------------------------------------
18
+ >> number_to_indian_currency(400)
19
+ => "<span class="WebRupee">Rs.</span> 400"
20
+ >> number_to_indian_currency(5921, false)
21
+ => "Rs. 5,921" >> helper.number_to_indian_currency(9921)
22
+ => "<span class="WebRupee">Rs.</span> 9,921"
23
+ >> number_to_indian_currency(1222040.54, false)
24
+ => "Rs.12,22,040.54"
25
+ }
16
26
 
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
27
+ s.rubyforge_project = "number_to_indian_currency"
24
28
 
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"
29
+ s.files = `git ls-files`.split("\n")
30
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
31
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
32
+ s.require_paths = ["lib"]
33
33
  end
File without changes
metadata CHANGED
@@ -1,101 +1,75 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: number_to_indian_currency
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ version: "1.0"
5
10
  platform: ruby
6
- authors:
11
+ authors:
7
12
  - Sandip Ransing
8
13
  autorequire:
9
- bindir: exe
14
+ bindir: bin
10
15
  cert_chain: []
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:
16
+
17
+ date: 2011-03-18 00:00:00 +05:30
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: "\n Number to Indian Currency with rupees symbol\n\n Example Usage\n --------------------------------------------------------\n >> number_to_indian_currency(400)\n => \"<span class=\"WebRupee\">Rs.</span> 400\" \n >> number_to_indian_currency(5921, false)\n => \"Rs. 5,921\" >> helper.number_to_indian_currency(9921)\n => \"<span class=\"WebRupee\">Rs.</span> 9,921\"\n >> number_to_indian_currency(1222040.54, false) \n => \"Rs.12,22,040.54\"\n "
22
+ email:
58
23
  - sandip@funonrails.com
59
24
  executables: []
25
+
60
26
  extensions: []
27
+
61
28
  extra_rdoc_files: []
62
- files:
63
- - ".gitignore"
64
- - ".travis.yml"
65
- - CODE_OF_CONDUCT.md
29
+
30
+ files:
31
+ - .gitignore
66
32
  - Gemfile
67
- - LICENSE.txt
68
33
  - README.md
69
34
  - Rakefile
70
- - bin/console
71
- - bin/setup
72
- - lib/assets/stylesheets/rupees.css
73
35
  - lib/number_to_indian_currency.rb
74
36
  - lib/number_to_indian_currency/version.rb
75
37
  - number_to_indian_currency.gemspec
38
+ - public/stylesheets/rupees.css
76
39
  - tasks/currency.rake
77
- homepage: https://github.com/sandipransing/number_to_indian_currency
78
- licenses:
79
- - MIT
80
- metadata: {}
40
+ has_rdoc: true
41
+ homepage: ""
42
+ licenses: []
43
+
81
44
  post_install_message:
82
45
  rdoc_options: []
83
- require_paths:
46
+
47
+ require_paths:
84
48
  - lib
85
- required_ruby_version: !ruby/object:Gem::Requirement
86
- requirements:
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
87
52
  - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- required_rubygems_version: !ruby/object:Gem::Requirement
91
- requirements:
53
+ - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
92
61
  - - ">="
93
- - !ruby/object:Gem::Version
94
- version: '0'
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
95
67
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.4.5
68
+
69
+ rubyforge_project: number_to_indian_currency
70
+ rubygems_version: 1.3.7
98
71
  signing_key:
99
- specification_version: 4
72
+ specification_version: 3
100
73
  summary: Helper that coverts number to indian currency with rupees symbol with css
101
74
  test_files: []
75
+
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 6c8302a37ae441482d0bcdf4fe17dc6425a19a21
4
- data.tar.gz: 6fe71765aff8cb67bbe537a189a73ce5977b8aae
5
- SHA512:
6
- metadata.gz: b1e9ab77c59e93bb9666d154a6e3031dea39c48f5911281728cb2d3af5d093acf6ac14fc6e839fa776e0f524d7c4c9eeedd31fcd9ec71696d6ab05be24d22ac2
7
- data.tar.gz: 5d6d132dda67419417e60cb6680be96988b14507eaebbb2a6113fddf95eda0cffe2f320e0035f727b3746af1274779cbc39bf7d8607e0ba85cef3d00408c20fc
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.2
4
- before_install: gem install bundler -v 1.10.6
data/CODE_OF_CONDUCT.md DELETED
@@ -1,13 +0,0 @@
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/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
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/bin/console DELETED
@@ -1,14 +0,0 @@
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
data/bin/setup DELETED
@@ -1,7 +0,0 @@
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