continued_fractions 1.5.0 → 1.5.1

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: f0122ca9d3d5652ed7b6ae7d91e569d50b7ef1bd
4
- data.tar.gz: 1e83d11105ddcb0d59076526a87e994bcaef4341
3
+ metadata.gz: 415a29ad4c2573cd6fe71d75bf85da9e9d1b1ae8
4
+ data.tar.gz: 33669301eb84bfffe3d257d6ab865aa3326a3fb3
5
5
  SHA512:
6
- metadata.gz: a99457b5cb78d9b4dbc55bd2301b546ecf08e21c359eece3683abfbf2d3d2cf91294c5ab9afb94615ceb62757587a138fdb02194dde442da25ca0dbd7e6b082f
7
- data.tar.gz: ea78b244bbee7ac1def880af96b5fc9fa786df525da0419e50c1d4d8c98c7f036311d99ad96be698c9f1459ec77f2acf984552552237dc620dad156c0c59b936
6
+ metadata.gz: ebe93ef1e534aa2e5b79c7c7035617b9781167bd8d0ee88f4e94bb719dc56ad8e0da3d4f50315ac924f4490322eb94f9efcdaf7ce4cf374f3c048f4a3748aba8
7
+ data.tar.gz: d1fc5b4f88547d95a4572d4365b5dd643dc87f8efe969058bb8fe2e848fdadbde4cc2b8ef54706a847eb026759397fa4a5a10af3326484f2bc23cb3f3aa5ec08
data/CHANGELOG CHANGED
@@ -0,0 +1,3 @@
1
+ v1.5.1 Use attribute accessors where possible
2
+
3
+ v1.5.0 Remove ContinuedFractions module; Move its methods into ContinuedFraction class
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('continued_fractions', '1.5.0') do |config|
5
+ Echoe.new('continued_fractions', '1.5.1') do |config|
6
6
  config.summary = 'Generate continued fractions'
7
7
  config.description = 'Class for working with continued fractions'
8
8
 
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: continued_fractions 1.5.0 ruby lib
2
+ # stub: continued_fractions 1.5.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "continued_fractions"
6
- s.version = "1.5.0"
6
+ s.version = "1.5.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
@@ -8,7 +8,6 @@
8
8
  #
9
9
  class ContinuedFraction
10
10
  attr_accessor :number, :quotients, :limit
11
- attr_writer :convergents
12
11
 
13
12
  # For a given number calculate its continued fraction quotients and convergents up to limit.
14
13
  #
@@ -79,25 +78,25 @@ class ContinuedFraction
79
78
 
80
79
  def +(other)
81
80
  number_of(other) do |num,prec|
82
- evaluate("#{@number} + #{num}",prec)
81
+ evaluate("#{number} + #{num}",prec)
83
82
  end
84
83
  end
85
84
 
86
85
  def -(other)
87
86
  number_of(other) do |num,prec|
88
- evaluate("#{@number} - #{num}",prec)
87
+ evaluate("#{number} - #{num}",prec)
89
88
  end
90
89
  end
91
90
 
92
91
  def /(other)
93
92
  number_of(other) do |num,prec|
94
- evaluate("#{@number} / #{num}",prec)
93
+ evaluate("#{number} / #{num}",prec)
95
94
  end
96
95
  end
97
96
 
98
97
  def *(other)
99
98
  number_of(other) do |num,prec|
100
- evaluate("#{@number} * #{num}",prec)
99
+ evaluate("#{number} * #{num}",prec)
101
100
  end
102
101
  end
103
102
 
@@ -126,7 +125,7 @@ class ContinuedFraction
126
125
 
127
126
  def calculate_quotients #:nodoc:
128
127
  qs = Array.new(limit)
129
- n = @number
128
+ n = number
130
129
  limit.times do |i|
131
130
  qs[i] = n.to_i
132
131
  n = 1.0/(n-qs[i])
@@ -1,4 +1,4 @@
1
- $LOAD_PATH << File.join(File.dirname(__FILE__), "/../lib")
2
- require 'rubygems'
3
- require 'rspec'
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "/../lib")
2
+ require 'rubygems'
3
+ require 'rspec'
4
4
  require 'continued_fractions'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: continued_fractions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Hales-Garcia