sixarm_ruby_metric_names 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gemtest ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # SixArm.com » Ruby » <br > Numeric extensions for metric names
2
+
3
+ * Docs: <http://sixarm.com/sixarm_ruby_metric_names/doc>
4
+ * Repo: <http://github.com/sixarm/sixarm_ruby_metric_names>
5
+ * Email: Joel Parker Henderson, <joel@sixarm.com>
6
+
7
+
8
+ ## Introduction
9
+
10
+ Numeric extensions for metric names.
11
+
12
+ For docs go to <http://sixarm.com/sixarm_ruby_metric_names/doc>
13
+
14
+ Want to help? We're happy to get pull requests.
15
+
16
+
17
+ ## Quickstart
18
+
19
+ Install:
20
+
21
+ gem install sixarm_ruby_metric_names
22
+
23
+ Bundler:
24
+
25
+ gem "sixarm_ruby_metric_names", "=1.0.0"
26
+
27
+ Require:
28
+
29
+ require "sixarm_ruby_metric_names"
30
+
31
+
32
+ ## High Security (Optional)
33
+
34
+ To enable high security for all our gems:
35
+
36
+ wget http://sixarm.com/sixarm.pem
37
+ gem cert --add sixarm.pem
38
+ gem sources --add http://sixarm.com
39
+
40
+ To install with high security:
41
+
42
+ gem install sixarm_ruby_metric_names --test --trust-policy HighSecurity
43
+
44
+
45
+ ## Example
46
+
47
+ Convert a number to its metric name equivalent:
48
+
49
+ 8.kilo #=> 5000
50
+ 800.centi #=> 8
51
+
52
+
53
+ ## Changes
54
+
55
+ * 2012-03-17 1.1.0 Upgrade for Ruby 1.9.3, minitest/spec, and improved docs.
56
+
57
+
58
+ ## License
59
+
60
+ You may choose any of these open source licenses:
61
+
62
+ * Apache License
63
+ * BSD License
64
+ * CreativeCommons License, Non-commercial Share Alike
65
+ * GNU General Public License Version 2 (GPL 2)
66
+ * GNU Lesser General Public License (LGPL)
67
+ * MIT License
68
+ * Perl Artistic License
69
+ * Ruby License
70
+
71
+ The software is provided "as is", without warranty of any kind,
72
+ express or implied, including but not limited to the warranties of
73
+ merchantability, fitness for a particular purpose and noninfringement.
74
+
75
+ In no event shall the authors or copyright holders be liable for any
76
+ claim, damages or other liability, whether in an action of contract,
77
+ tort or otherwise, arising from, out of or in connection with the
78
+ software or the use or other dealings in the software.
79
+
80
+ This license is for the included software that is created by SixArm;
81
+ some of the included software may have its own licenses, copyrights,
82
+ authors, etc. and these do take precedence over the SixArm license.
83
+
84
+ Copyright (c) 2005-2012 Joel Parker Henderson
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,69 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ class Numeric
7
+
8
+ # Return self * 10^15
9
+ def peta
10
+ self*1000000000000000
11
+ end
12
+
13
+ # Return self * 10^12
14
+ def tera
15
+ self*1000000000000
16
+ end
17
+
18
+ # Return self * 10^9
19
+ def giga
20
+ self*1000000000
21
+ end
22
+
23
+ # Return self * 10^6
24
+ def mega
25
+ self*1000000
26
+ end
27
+
28
+ # Return self * 10^3
29
+ def kilo
30
+ self*1000
31
+ end
32
+
33
+ # Return self * 10^2
34
+ def hecto
35
+ self*100
36
+ end
37
+
38
+ # Return self * 10
39
+ def deka
40
+ self*10
41
+ end
42
+
43
+ # Return self / 10
44
+ def deci
45
+ self.fdiv 10
46
+ end
47
+
48
+ # Return self / 10^2
49
+ def centi
50
+ self.fdiv 100
51
+ end
52
+
53
+ # Return self / 10^3
54
+ def milli
55
+ self.fdiv 1000
56
+ end
57
+
58
+ # Return self / 10^6
59
+ def micro
60
+ self.fdiv 1000000
61
+ end
62
+
63
+ # Return self / 10^9
64
+ def nano
65
+ self.fdiv 1000000000
66
+ end
67
+
68
+
69
+ end
@@ -0,0 +1,70 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'sixarm_ruby_metric_names'
6
+
7
+ describe Numeric do
8
+
9
+ it "#peta" do
10
+ 1.peta.must_equal 1000000000000000
11
+ end
12
+
13
+
14
+ it "#tera" do
15
+ 1.tera.must_equal 1000000000000
16
+ end
17
+
18
+
19
+ it "#giga" do
20
+ 1.giga.must_equal 1000000000
21
+ end
22
+
23
+
24
+ it "#mega" do
25
+ 1.mega.must_equal 1000000
26
+ end
27
+
28
+
29
+ it "#kilo" do
30
+ 1.kilo.must_equal 1000
31
+ end
32
+
33
+
34
+ it "#hecto" do
35
+ 1.hecto.must_equal 100
36
+ end
37
+
38
+
39
+ it "#deka" do
40
+ 1.deka.must_equal 10
41
+ end
42
+
43
+
44
+ it "#deci" do
45
+ 1.deci.must_equal 0.1
46
+ end
47
+
48
+
49
+ it "#centi" do
50
+ 1.centi.must_equal 0.01
51
+ end
52
+
53
+
54
+ it "#milli" do
55
+ 1.milli.must_equal 0.001
56
+ end
57
+
58
+
59
+ it "#micro" do
60
+ 1.micro.must_equal 0.000001
61
+ end
62
+
63
+
64
+ it "#nano" do
65
+ 1.nano.must_equal 0.000000001
66
+ end
67
+
68
+
69
+ end
70
+
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_metric_names
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - SixArm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCRENDQW0yZ0F3SUJB
14
+ Z0lKQUtQd0VFVFU1YkhvTUEwR0NTcUdTSWIzRFFFQkJRVUFNR0F4Q3pBSkJn
15
+ TlYKQkFZVEFsVlRNUk13RVFZRFZRU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p0TG1OdmJZSUpBS1B3RUVU
32
+ VTViSG9NQXdHQTFVZEV3UUYKTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVGQlFB
33
+ RGdZRUFvb0VleFAvb1BhbTFUUDcxU3l1aHhNYit1VHJaYlNRZQpqVkIrRXhS
34
+ d1dhZEd3YU5QVUE1NmQzOXF3YXZ3UCtpdSszSnBlb25OTVZ2YldYRjVuYUNY
35
+ L2RORkllUkVIekVSClpEUlFZTXFydTlURU1uYTZIRDl6cGNzdEY3dndUaEdv
36
+ dmxPUSszWTZwbFE0bk16aXBYY1o5VEhxczY1UElMMHEKZWFid3BDYkFvcG89
37
+ Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
38
+ date: 2012-03-17 00:00:00.000000000 Z
39
+ dependencies: []
40
+ description:
41
+ email: sixarm@sixarm.com
42
+ executables: []
43
+ extensions: []
44
+ extra_rdoc_files: []
45
+ files:
46
+ - .gemtest
47
+ - Rakefile
48
+ - README.md
49
+ - VERSION
50
+ - lib/sixarm_ruby_metric_names.rb
51
+ - test/sixarm_ruby_metric_names_test.rb
52
+ homepage: http://sixarm.com/gems/sixarm_ruby_metric_names
53
+ licenses: []
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 1.8.11
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: sixarm_ruby_metric_names
76
+ test_files:
77
+ - test/sixarm_ruby_metric_names_test.rb
78
+ has_rdoc: true
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �6T�m�Bq�eV��3q9����]�q*�b_�'IS������6��-�'W,�A�W���U�����Ve�ien���bg�\� F4�:��{�޿��8{�߳���R2�Ҥ��=c��ȕ���iC��@8�