mathcha 0.4.7 → 0.5.0

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.
data/Rakefile CHANGED
@@ -11,6 +11,8 @@ begin
11
11
  gemspec.email = "coryjwilkerson@gmail.com"
12
12
  gemspec.homepage = "http://github.com/corywilkerson/mathcha"
13
13
  gemspec.authors = ["Cory Wilkerson"]
14
+
15
+ gemspec.add_dependency('Linguistics', '> 1.0.5')
14
16
  end
15
17
  rescue LoadError
16
18
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.7
1
+ 0.5.0
@@ -1,3 +1,5 @@
1
+ require 'linguistics'
2
+
1
3
  module Mathcha
2
4
 
3
5
  # Helper included in ActionView::Base. Use mathcha_tag in your views to
@@ -39,13 +41,13 @@ module Mathcha
39
41
  result, eq = nil, nil
40
42
 
41
43
  while result.nil? or !result.is_a?(Integer) or result < 0
42
- result, eq = generate_solv(SOLV_OPS[rand(SOLV_OPS.size)], options[:seed_one], options[:seed_two])
44
+ result, eq, eq_slick = generate_solv(SOLV_OPS[rand(SOLV_OPS.size)], options[:seed_one], options[:seed_two])
43
45
  end
44
46
 
45
47
  session[:solv] = [solv_key, eval(eq)]
46
48
 
47
49
  html = ''
48
- html << %{#{eq} = <input type="text" name="solv" />\n}
50
+ html << %{#{eq_slick.titlecase} = <input type="text" name="solv" />\n}
49
51
  html << %{<input type="hidden" name="solv_key" value="#{solv_key}" />\n}
50
52
  html
51
53
  end
@@ -58,12 +60,14 @@ module Mathcha
58
60
  # want to bail on division by zero, just cut it off.
59
61
  return [nil, nil] if (op == DIV and op2 == 0)
60
62
 
63
+ eq_slick = "#{Linguistics::EN.numwords(op1)} #{op} #{Linguistics::EN.numwords(op2)}"
64
+
61
65
  sol = eval(eq = "#{op1.to_f} #{op} #{op2.to_f}")
62
66
  sol = (sol == sol.floor) ? sol.to_i : sol
63
67
 
64
- return [sol, eq]
68
+ return [sol, eq, eq_slick]
65
69
  end
66
70
 
67
71
  private :generate_solv
68
72
  end
69
- end
73
+ end
data/mathcha.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mathcha}
8
- s.version = "0.4.7"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Cory Wilkerson"]
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
  "pkg/mathcha-0.4.4.gem",
35
35
  "pkg/mathcha-0.4.5.gem",
36
36
  "pkg/mathcha-0.4.6.gem",
37
+ "pkg/mathcha-0.4.7.gem",
37
38
  "rails/init.rb",
38
39
  "tasks/mathcha_tasks.rake",
39
40
  "test/mathcha_test.rb",
@@ -55,8 +56,11 @@ Gem::Specification.new do |s|
55
56
  s.specification_version = 3
56
57
 
57
58
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
59
+ s.add_runtime_dependency(%q<Linguistics>, ["> 1.0.5"])
58
60
  else
61
+ s.add_dependency(%q<Linguistics>, ["> 1.0.5"])
59
62
  end
60
63
  else
64
+ s.add_dependency(%q<Linguistics>, ["> 1.0.5"])
61
65
  end
62
66
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Wilkerson
@@ -11,8 +11,17 @@ cert_chain: []
11
11
 
12
12
  date: 2009-10-16 00:00:00 -05:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: Linguistics
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.5
24
+ version:
16
25
  description: Quick little arithmetic plain-text captcha
17
26
  email: coryjwilkerson@gmail.com
18
27
  executables: []
@@ -40,6 +49,7 @@ files:
40
49
  - pkg/mathcha-0.4.4.gem
41
50
  - pkg/mathcha-0.4.5.gem
42
51
  - pkg/mathcha-0.4.6.gem
52
+ - pkg/mathcha-0.4.7.gem
43
53
  - rails/init.rb
44
54
  - tasks/mathcha_tasks.rake
45
55
  - test/mathcha_test.rb