miserable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a400bab7979678cc1e09925ec74a2404b9d5b6df
4
+ data.tar.gz: 902aa7d04ea92de1ce2dad889549a930d3343856
5
+ SHA512:
6
+ metadata.gz: 8ba5544ed2615a806586f749b7561cef4ff01c3fbabde3db7d84ab573d94720b77f7ca75776fd60d0c30fae1d6795033b1beca7a05d77a2344115db0c6b03479
7
+ data.tar.gz: 31476d92d71f0a476b81683fd0469b1a90e1d59313ac7d4163da4dee93eb9b5c573d1492c54c9161dc2abfdb7f73a12eb866812bb688c7c20f9c3d6bb54b299e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in miserable.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 WAKASUGI Mubae
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.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ [![Gem Version](https://badge.fury.io/rb/miserable.svg)](http://badge.fury.io/rb/miserable)
2
+ [![Build Status](https://travis-ci.org/5t111111/miserable.svg)](https://travis-ci.org/5t111111/miserable)
3
+ [![Coverage Status](https://coveralls.io/repos/5t111111/miserable/badge.png?branch=master)](https://coveralls.io/r/5t111111/miserable?branch=master)
4
+
5
+ =======
6
+
7
+ # BPM to Msec
8
+
9
+ Convert BPM (beats-per-minute) to millisecond.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'miserable'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install miserable
26
+
27
+ ## Usage
28
+
29
+ ```ruby
30
+ require 'miserable'
31
+
32
+ bpm2ms = Miserable.new(120)
33
+ puts bpm2ms.quarter_note #=> 500.0
34
+ puts bpm2ms.eighth_note #=> 250.0
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/5t111111/miserable/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,3 @@
1
+ module BpmToMsec
2
+ VERSION = "0.0.1"
3
+ end
data/lib/miserable.rb ADDED
@@ -0,0 +1,40 @@
1
+ require "miserable/version"
2
+
3
+ #
4
+ # Convert BPM (beats-per-minute) to millisecond
5
+ #
6
+ class Miserable
7
+ attr_reader :quarter_note
8
+
9
+ def initialize(bpm)
10
+ @quarter_note = (((60 / bpm.to_f) * 1000) * 100_000) / 100_000
11
+ end
12
+
13
+ def whole_note
14
+ @quarter_note * 4
15
+ end
16
+
17
+ def half_note
18
+ @quarter_note * 2
19
+ end
20
+
21
+ def eighth_note
22
+ @quarter_note / 2
23
+ end
24
+
25
+ def sixteenth_note
26
+ @quarter_note / 4
27
+ end
28
+
29
+ def thirtysecond_note
30
+ @quarter_note / 8
31
+ end
32
+
33
+ def sixtyfourth_note
34
+ @quarter_note / 16
35
+ end
36
+
37
+ def sixth_note
38
+ whole_note / 6
39
+ end
40
+ end
data/miserable.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'miserable/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "miserable"
8
+ spec.version = BpmToMsec::VERSION
9
+ spec.authors = ["Hirofumi Wakasugi"]
10
+ spec.email = ["baenej@gmail.com"]
11
+ spec.summary = %q{Convert BPM (beats-per-minute) to millisecond.}
12
+ spec.description = %q{Convert BPM (beats-per-minute) to millisecond.}
13
+ spec.homepage = "https://github.com/5t111111/miserable"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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.6"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "coveralls"
25
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe BpmToMsec do
4
+ it 'has a version number' do
5
+ expect(BpmToMsec::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'returns correct quarter note' do
9
+ b2ms = Miserable.new(120)
10
+ expect(b2ms.quarter_note).to eq(500)
11
+ end
12
+
13
+ it 'returns correct whole note' do
14
+ b2ms = Miserable.new(120)
15
+ expect(b2ms.whole_note).to eq(2000)
16
+ end
17
+
18
+ it 'returns correct half note' do
19
+ b2ms = Miserable.new(120)
20
+ expect(b2ms.half_note).to eq(1000)
21
+ end
22
+
23
+ it 'returns correct eighth note' do
24
+ b2ms = Miserable.new(120)
25
+ expect(b2ms.eighth_note).to eq(250)
26
+ end
27
+
28
+ it 'returns correct sixteenth note' do
29
+ b2ms = Miserable.new(120)
30
+ expect(b2ms.sixteenth_note).to eq(125)
31
+ end
32
+
33
+ it 'returns correct thirtysecond_note note' do
34
+ b2ms = Miserable.new(120)
35
+ expect(b2ms.thirtysecond_note).to eq(62.5)
36
+ end
37
+
38
+ it 'returns correct sixtyfourth_note note' do
39
+ b2ms = Miserable.new(120)
40
+ expect(b2ms.sixtyfourth_note).to eq(31.25)
41
+ end
42
+
43
+ it 'returns correct sixth_note note' do
44
+ b2ms = Miserable.new(120)
45
+ expect(b2ms.sixth_note.round(5)).to eq(333.33333)
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
5
+ require 'miserable'
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: miserable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hirofumi Wakasugi
8
+ autorequire:
9
+ bindir: bin
10
+ 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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
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: rspec
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
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Convert BPM (beats-per-minute) to millisecond.
70
+ email:
71
+ - baenej@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - lib/miserable.rb
84
+ - lib/miserable/version.rb
85
+ - miserable.gemspec
86
+ - spec/miserable_spec.rb
87
+ - spec/spec_helper.rb
88
+ homepage: https://github.com/5t111111/miserable
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.4.5
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Convert BPM (beats-per-minute) to millisecond.
112
+ test_files:
113
+ - spec/miserable_spec.rb
114
+ - spec/spec_helper.rb