acts_as_learnable 0.1.2 → 0.2.0

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
- SHA1:
3
- metadata.gz: 9da5b966e48e9b1c72f0bd09c4ecfa368c741701
4
- data.tar.gz: 1aeee4b6a3cef0942f695d1ab36e7ae10fc8cb7f
2
+ SHA256:
3
+ metadata.gz: 6e65eaf9f25b641df9f9377c40997cadfeec15a64d28686c84ae1c1cb37d44e8
4
+ data.tar.gz: 5b76d804d68b1e557580b044cd56e93866aa5720544c5867b68be9ded5fd9a45
5
5
  SHA512:
6
- metadata.gz: 987b9f12e12b96188cc242c44df43d123b5e7fdd3b65c5fa47ff848f67ad6326d9722b84688e5636cb49cc562b0529ead589cd2dce1e307338e4145cdcedc1f1
7
- data.tar.gz: 6a588898060364332170aa0afeb91824c4ea5e72ca52e55b01aba0d5d511cfab84e8d7b74b6e1fdb1265b5d11f9ee0477541471a8d62ba23188f2e1354b58aa0
6
+ metadata.gz: fd561ac48b1c65675addbda453947414e7d063a2d1defc67fbf096658626334576dc36cdb0b125d8ce3b282eb2c918c98649bb260496d07d419c7a418bfe0db1
7
+ data.tar.gz: 8548a28b5433b4a7a7f0c1bac89377026a9cdcc94b43747ce631e01463fb04062c002f491100d3f58f9b89c37a4bb649a4baaec5ad5b9e5ffed39cc30dcffeeb
data/README.md CHANGED
@@ -1,10 +1,5 @@
1
1
  # ActsAsLearnable
2
2
 
3
- [![Build Status](https://img.shields.io/travis/dankimio/acts_as_learnable.svg?style=flat)](https://travis-ci.org/dankimio/acts_as_learnable)
4
- [![Gem Version](https://img.shields.io/gem/v/acts_as_learnable.svg?style=flat&color=brightgreen)](https://rubygems.org/gems/acts_as_learnable)
5
- [![License](https://img.shields.io/:license-mit-blue.svg?style=flat)](https://dankimio.mit-license.org)
6
-
7
-
8
3
  ActsAsLearnable is a Ruby gem for ActiveRecord models. It provides a simple way to create flashcards in your app. It automatically schedules flashcards for review depending on recall quality (1 to 5). You can easily create a Spaced Repetition System (SRS) using this gem. Flashcards are scheduled using SuperMemo 2 algorithm.
9
4
 
10
5
  ## Installation
@@ -54,13 +49,8 @@ card.repetitions # => 1
54
49
 
55
50
  ## Contributing
56
51
 
57
- 1. Fork it ( https://github.com/itsdan/acts_as_learnable/fork )
52
+ 1. Fork it ( https://github.com/dankimio/acts_as_learnable/fork )
58
53
  2. Create your feature branch (`git checkout -b my-new-feature`)
59
54
  3. Commit your changes (`git commit -am 'Add some feature'`)
60
55
  4. Push to the branch (`git push origin my-new-feature`)
61
56
  5. Create a new Pull Request
62
-
63
- ## TODO
64
-
65
- - [ ] More detailed README
66
- - [ ] Other repetition algorithms (Anki)
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'activerecord', '>= 4.2'
22
- spec.add_dependency 'activesupport', '>= 4.2'
21
+ spec.add_dependency 'activerecord', '>= 5.2'
22
+ spec.add_dependency 'activesupport', '>= 5.2'
23
23
 
24
24
  spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'rake'
@@ -15,7 +15,7 @@ module ActsAsLearnable
15
15
 
16
16
  module InstanceMethods
17
17
  def review(recall_quality)
18
- fail unless (1..5).include?(recall_quality)
18
+ raise unless (1..5).include?(recall_quality)
19
19
 
20
20
  # If the quality of response was lower than 3, then start repetitions from the beginning
21
21
  reset and return if recall_quality <= 2
@@ -65,13 +65,12 @@ module ActsAsLearnable
65
65
 
66
66
  # Update interval according to the formula
67
67
  def update_interval
68
- # TODO: Extract magic numbers
69
68
  self.interval =
70
69
  case repetitions
71
70
  when 1 then 1
72
71
  when 2 then 6
73
72
  else
74
- interval(repetitions - 1) * easiness_factor
73
+ (repetitions - 1) * easiness_factor
75
74
  end
76
75
  end
77
76
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsLearnable
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -3,7 +3,5 @@ require 'acts_as_learnable/base'
3
3
 
4
4
  module ActsAsLearnable
5
5
  # Extend ActiveRecord if defined
6
- if defined?(ActiveRecord::Base)
7
- ActiveRecord::Base.extend(ActsAsLearnable::Base)
8
- end
6
+ ActiveRecord::Base.extend(ActsAsLearnable::Base) if defined?(ActiveRecord::Base)
9
7
  end
@@ -6,10 +6,10 @@ class FlashcardGenerator < ActiveRecord::Generators::Base
6
6
 
7
7
  desc 'This generator creates a migration file with flashcard fields.'
8
8
 
9
- source_root File.expand_path('../templates', __FILE__)
9
+ source_root File.expand_path('templates', __dir__)
10
10
 
11
11
  def install_flashcards
12
- if schema_exists? && File.read("#{destination_root}/db/schema.rb") =~ /create_table \"#{table_name}\"/
12
+ if schema_exists? && File.read("#{destination_root}/db/schema.rb") =~ /create_table "#{table_name}"/
13
13
  migration_template('add_fields_migration.rb', "db/migrate/add_flashcard_fields_to_#{table_name}.rb")
14
14
  else
15
15
  migration_template('create_table_migration.rb', "db/migrate/create_#{table_name}.rb")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_learnable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Kim
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2022-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: '5.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.2'
33
+ version: '5.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '4.2'
40
+ version: '5.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -105,7 +105,6 @@ extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
107
107
  - ".gitignore"
108
- - ".travis.yml"
109
108
  - Gemfile
110
109
  - LICENSE.txt
111
110
  - README.md
@@ -123,7 +122,7 @@ homepage: https://github.com/itsdn/acts_as_learnable
123
122
  licenses:
124
123
  - MIT
125
124
  metadata: {}
126
- post_install_message:
125
+ post_install_message:
127
126
  rdoc_options: []
128
127
  require_paths:
129
128
  - lib
@@ -138,9 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
137
  - !ruby/object:Gem::Version
139
138
  version: '0'
140
139
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.6.11
143
- signing_key:
140
+ rubygems_version: 3.3.7
141
+ signing_key:
144
142
  specification_version: 4
145
143
  summary: A simple way to create flashcards in your app.
146
144
  test_files:
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.3.4
5
- - 2.4.1