measurement_converter 0.0.1

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2E3ZWJjYTczN2UzNmYzYjQ5NmNlNmRjYTlkODM2OGY1NGI1ODFkOQ==
5
+ data.tar.gz: !binary |-
6
+ N2JhZWNkYzg2ZDY3ZWFjNmMwYzEwNjBiNGEzNmY0NDI2NjAyMDVmOA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDA1YTY3ZGQ2NzU4OTE0NzY1MmFjNTBjNzYyMWYxMGY5Y2U2NjQ5YWM0NGJk
10
+ YzYzYTk2YTI0NmI4OTg5Y2Y2YjBlY2ExMjE3YzgzM2I3MTRjNTVlNjJhZTE0
11
+ ZGRiMjcyNWJlMmFmNDVhMWVhMDhlNjRkYTU0MDViNGU4NjMwNzQ=
12
+ data.tar.gz: !binary |-
13
+ ZDY0MDJmMjY2YjcyMDk1YmNiYTM4MzNiYzU3OWQ4NGNhZjYxMGY4YzU0MjZi
14
+ NzJhYWZlMTA5OWViZTdkNjA3OWZmOGZmY2Y0MjVhYWFkOGY4MDRjZGM1ZTcw
15
+ ZTg1MDUxYzZkMzhjY2Y0ODI0YzU3YzFlNDg4MTZiZjQ5OWNiOWI=
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .idea/
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ # uncomment this line if your project needs to run something other than `rake`:
5
+ # script: bundle exec rspec spec
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in measurement_converter.gemspec
4
+ gemspec
5
+ gem 'rspec'
6
+
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Craig Adams
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # MeasurementConverter
2
+
3
+ [![Build Status](https://travis-ci.org/craigadams/measurement_converter.png?branch=master)](https://travis-ci.org/craigadams/measurement_converter)
4
+
5
+ This is a simple gem that converts a fraction of an inch to a decimal. The gem
6
+ contains one Ruby class file and an executable Ruby script that calls a method
7
+ in the class file. For example, it will convert 1/64 to 0.015625.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'measurement_converter'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install measurement_converter
22
+
23
+ ## Usage
24
+
25
+ Execution of the Ruby script:
26
+
27
+ $ measurement-converter {fraction}
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create new Pull Request
@@ -0,0 +1,9 @@
1
+ #require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ end
7
+
8
+ desc "Run tests"
9
+ task :default => :test
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'measurement_converter'
4
+
5
+ # call the method and pass the argument
6
+ MeasurementConverter.frac_to_inch(ARGV[0])
@@ -0,0 +1,24 @@
1
+ #require "measurement_converter/version"
2
+
3
+ # Currently have only one class that has a single method. My
4
+ # intention is to build this out so that this class would drive
5
+ # the output to the console and call other classes/methods.
6
+ # Starting out simple but planning on adding other measurement
7
+ # conversions.
8
+
9
+ class MeasurementConverter
10
+
11
+ # Perform simple measurement conversion of a fraction of an inch
12
+ # to a decimal.
13
+ printf "\nWelcome to Measurement Converter\n"
14
+
15
+ # Method to convert fraction to decimal
16
+ def self.frac_to_inch(fraction)
17
+ printf "Converted #{fraction}\" to "
18
+ numerator, denominator = fraction.split('/').map(&:to_f)
19
+ denominator ||= 1
20
+ printf "#{numerator/denominator} inches\n\n"
21
+ return numerator/denominator
22
+ end
23
+ end
24
+
@@ -0,0 +1,3 @@
1
+ class MeasurementConverter
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'measurement_converter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "measurement_converter"
8
+ spec.version = MeasurementConverter::VERSION
9
+ spec.authors = ["Craig Adams"]
10
+ spec.email = ["craigad1@uw.edu"]
11
+ spec.description = %q{measurement_converter can perform simple measurement conversions for woodworkers like fractions to decimal inches. Lots of work left to do including error handling. More to come.}
12
+ spec.summary = %q{Simple woodworking measurement converter}
13
+ spec.homepage = "http://github.com/craigadams/measurement_converter"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,11 @@
1
+ require 'rspec'
2
+ require_relative '../../lib/measurement_converter'
3
+
4
+ describe MeasurementConverter do
5
+
6
+ describe 'fraction to inches' do
7
+ it 'should should convert fraction string to floating point' do
8
+ MeasurementConverter.frac_to_inch("1/64").should eq 0.015625
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: measurement_converter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Craig Adams
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-10 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: measurement_converter can perform simple measurement conversions for
42
+ woodworkers like fractions to decimal inches. Lots of work left to do including
43
+ error handling. More to come.
44
+ email:
45
+ - craigad1@uw.edu
46
+ executables:
47
+ - measurement-converter
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - .gitignore
52
+ - .travis.yml
53
+ - Gemfile
54
+ - LICENSE.txt
55
+ - README.md
56
+ - Rakefile
57
+ - bin/measurement-converter
58
+ - lib/measurement_converter.rb
59
+ - lib/measurement_converter/version.rb
60
+ - measurement_converter.gemspec
61
+ - test/rspec/measurement_converter_spec.rb
62
+ homepage: http://github.com/craigadams/measurement_converter
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.1.5
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Simple woodworking measurement converter
86
+ test_files:
87
+ - test/rspec/measurement_converter_spec.rb