mani_zanec_math 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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 42d0c3af559eb9ad1fde90a8afd0bbb50429c024
4
+ data.tar.gz: 867c724bf1939ac1ed5d5ac78018ed5f9013ebf4
5
+ SHA512:
6
+ metadata.gz: ae8abb5ad06acc444dc6e3b816917cb5ae5ce1688be7bb3653864f4b4b31927f731b9c886b52d48bc6cdbff57eb08c2d2f89b286729f72160fd2c0fea11a103d
7
+ data.tar.gz: bba2308132c8ffeba39e467ee36bb91fd6e97c6b7243a40cb40dccb979232cf115188a2d96088aeccf7251443a1274eef35b07725ac7f88722de6f4bc92fdf71
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 manisiva
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,31 @@
1
+ # ManiZanecMath
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'mani_zanec_math'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mani_zanec_math
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/mani_zanec_math/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,7 @@
1
+ require_relative "mani_zanec_math/version"
2
+ require_relative "mani_zanec_math/array"
3
+ require_relative "mani_zanec_math/fixnum"
4
+
5
+ module ManiZanecMath
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,4 @@
1
+ require_relative 'array/arithmetic_progression'
2
+ require_relative 'array/foobar'
3
+
4
+
@@ -0,0 +1,7 @@
1
+ class Array
2
+ def arithmetic_progression?
3
+ return true if size < 2
4
+ (self.first..self.last).step((self.last-self.first)/(self.size-1)).to_a == self
5
+ end
6
+ end
7
+
@@ -0,0 +1,17 @@
1
+ class Array
2
+ def foobar
3
+ arr = []
4
+ self.each{|x|
5
+ if (x.modulo(3) == 0 && x.modulo(5) == 0)
6
+ arr.push("foobar")
7
+ elsif (x.modulo(5) == 0)
8
+ arr.push("bar")
9
+ elsif (x.modulo(3) == 0 && x.modulo(2) != 0)
10
+ arr.push("foo")
11
+ else
12
+ arr.push(nil)
13
+ end
14
+ }
15
+ return arr
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ require_relative 'fixnum/prime'
2
+ require_relative 'fixnum/fibo'
3
+
@@ -0,0 +1,11 @@
1
+ class Fixnum
2
+ def fibo?
3
+ arr = [0,1]
4
+ while self > arr.last
5
+ x, y = arr.pop(2)
6
+ arr.push(x, y, x + y)
7
+ end
8
+ return true if self == arr.last
9
+ return false
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class Fixnum
2
+ def prime?
3
+ return true if self == 1
4
+ 2.upto(self) do |num|
5
+ if self % num == 0
6
+ return self == num
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,3 @@
1
+ module ManiZanecMath
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mani_zanec_math
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - manisiva
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This gem is used to find prime and fibo for a fixnum and some more functions
14
+ for Array
15
+ email:
16
+ - manisiva19@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE.txt
22
+ - README.md
23
+ - Rakefile
24
+ - lib/mani_zanec_math.rb
25
+ - lib/mani_zanec_math/array.rb
26
+ - lib/mani_zanec_math/array/arithmetic_progression.rb
27
+ - lib/mani_zanec_math/array/foobar.rb
28
+ - lib/mani_zanec_math/fixnum.rb
29
+ - lib/mani_zanec_math/fixnum/fibo.rb
30
+ - lib/mani_zanec_math/fixnum/prime.rb
31
+ - lib/mani_zanec_math/version.rb
32
+ homepage: https://rubygems.org/gems/example
33
+ licenses:
34
+ - MIT
35
+ metadata: {}
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project:
52
+ rubygems_version: 2.2.2
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: '"A simple ruby program"'
56
+ test_files: []