core_extend 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfe501bca93b3229dad2b24120af1d95518b1a5a
4
- data.tar.gz: 528c00e4a6599af2164b108ae06259e95c2694cb
3
+ metadata.gz: 7affb16c4c306cbc66c58037215d1bcdf1ef332b
4
+ data.tar.gz: c6eb4626d0124eb516fc85eb0d2bfdc0bc934e52
5
5
  SHA512:
6
- metadata.gz: e7c91bf1128e3855147e3b8e783ec3ddbcdc31c226d378d8416b96f30bf9a0ef65ea6abcece813403a5b361939ff71333f37dbbad8cab76831028337c493dd1d
7
- data.tar.gz: 49826fea712fa0488d1c33ce68c2280b00bf5321167f7f446fe53fb0b19d8795dbb129adb6856c3c12187b9a4f3bff266b33962bcb4ce5fd69437035392d1bca
6
+ metadata.gz: 257b654f6cb1724d87380e78611ebfb1b7c4e8a7305a0a30cce1616f2f37b1423a17288bf36d445eb771bc8ec3315ab668497c5f6ae933aa9baf141e0ad3bfc5
7
+ data.tar.gz: 6b2365dd77d4d3261e3c9bfe6e01b70cb91f6695b392c26fc7c2888457f8f5b8b13cb52d4e35a5e1ea9ae28e788897dcb2135bafdfda1dad5870dba20b3f1dda
data/.gitignore CHANGED
@@ -8,6 +8,8 @@ capybara-*.html
8
8
  /public/system
9
9
  /coverage/
10
10
  /spec/tmp
11
+ /.idea/
12
+ /pkg/
11
13
  **.orig
12
14
  rerun.txt
13
15
  pickle-email-*.html
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in core_extend.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ core_extend (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.1.1)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.9)
16
+ core_extend!
17
+ rake (~> 10.0)
18
+
19
+ BUNDLED WITH
20
+ 1.10.3
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # CoreExtend
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/core_extend`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'core_extend'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install core_extend
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/core_extend/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "core_extend"
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 ADDED
@@ -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
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'core_extend/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "core_extend"
8
+ spec.version = CoreExtend::VERSION
9
+ spec.authors = ["saxer"]
10
+ spec.email = ["15201280641@qq.com"]
11
+ spec.licenses = ["MIT"]
12
+
13
+ spec.summary = %q{Ruby core extensions}
14
+ spec.description = %q{Ruby core object extensions}
15
+ spec.homepage = "https://github.com/mumaoxi/core_extend"
16
+
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'] = "https://rubygems.org"
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.9"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
@@ -0,0 +1,7 @@
1
+ require "core_extend/version"
2
+
3
+ Dir.glob("#{File.dirname(__FILE__)}/core_extend/*.rb") { |f| require f }
4
+
5
+ module CoreExtend
6
+
7
+ end
@@ -0,0 +1,35 @@
1
+ class Float
2
+
3
+ #保留小数点位数
4
+ def decimal_point(point=2)
5
+ sprintf("%0.#{point}f", self).to_f
6
+ end
7
+
8
+ #显示成钱数
9
+ #===Parameters
10
+ # +type+ enum 'num','text'
11
+ #===Returns
12
+ # +string+
13
+ def to_money(type='num',point=2)
14
+ str = decimal_point(point).to_s
15
+ int_str = str.split('.')[0]
16
+ point_str = str.split('.')[1]
17
+
18
+ if type=='text'
19
+ return "#{int_str}.#{point_str}" if int_str.to_i<10000
20
+
21
+ return "#{(int_str.to_i/10000.0).decimal_point(point)}万" if int_str.to_i<100000000
22
+
23
+ return "#{(int_str.to_i/100000000.0).decimal_point(point)}亿"
24
+ end
25
+
26
+ return "#{int_str}.#{point_str}" if int_str.length<3
27
+ index = -4
28
+ while index.abs < int_str.length+1
29
+ int_str.insert(index, ',')
30
+ index -=4
31
+ end
32
+ "#{int_str}.#{point_str}"
33
+ end
34
+
35
+ end
@@ -0,0 +1,3 @@
1
+ module CoreExtend
2
+ VERSION = '0.1.2'
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core_extend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -46,8 +46,19 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - Gemfile.lock
49
52
  - LICENSE
53
+ - README.md
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/setup
57
+ - core_extend.gemspec
58
+ - lib/core_extend.rb
50
59
  - lib/core_extend/array.rb
60
+ - lib/core_extend/float.rb
61
+ - lib/core_extend/version.rb
51
62
  homepage: https://github.com/mumaoxi/core_extend
52
63
  licenses:
53
64
  - MIT