maths 0.0.9 → 0.0.10

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/README.md CHANGED
@@ -74,6 +74,28 @@ maths> exit
74
74
 
75
75
  Variables persist in maths between runs of the command, so feel free to exit and reopen maths all you want - those variables will stick around between executions.
76
76
 
77
+ If you'd like to list all defined variables, use the `vars` command:
78
+
79
+ ```
80
+ maths> vars
81
+
82
+ Defined Variables:
83
+ s: 10
84
+ $: 12345
85
+ z: 25
86
+ y: 25
87
+ x: 0.4
88
+ ```
89
+
90
+ You can also copy your last result to your system clipboard with the `copy` command:
91
+
92
+ ```
93
+ maths> 5 + 5
94
+ = 10
95
+ maths> copy
96
+ Copied 10 to your system clipboard.
97
+ ```
98
+
77
99
  ## Tell Us More, Bob
78
100
 
79
101
  Maths can do all sorts of great math!
data/bin/maths CHANGED
@@ -18,9 +18,23 @@ end
18
18
 
19
19
  prompt = "maths> "
20
20
  while command = Readline.readline(prompt, true)
21
- break if /exit/i =~ command
21
+ command.strip!
22
22
 
23
- if command == "vars" || command == "variables"
23
+ if /exit/i =~ command
24
+ break
25
+ elsif /copy/i =~ command
26
+ begin
27
+ if Clipboard.implementation
28
+ Clipboard.copy(Maths::Formatter.format(Maths::Brain.lookup("$")))
29
+ puts "Copied #{Clipboard.paste} to your system clipboard."
30
+ puts
31
+ end
32
+ rescue
33
+ puts "Sorry, but clipboard support isn't enabled on your system."
34
+ puts
35
+ end
36
+
37
+ elsif command == "vars" || command == "variables"
24
38
  puts
25
39
  puts "Defined Variables:"
26
40
  Maths::Brain.read.each do |key, value|
data/lib/maths/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Maths
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
data/lib/maths.rb CHANGED
@@ -2,6 +2,7 @@ $:.unshift(File.dirname(__FILE__))
2
2
 
3
3
  require "readline"
4
4
  require "json"
5
+ require "clipboard"
5
6
  require "bigdecimal"
6
7
 
7
8
  require "maths/version"
data/maths.gemspec CHANGED
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_runtime_dependency "json_pure", "~> 1.7.6"
21
+ gem.add_runtime_dependency "clipboard", "~> 1.0.1"
21
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maths
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-24 00:00:00.000000000 Z
12
+ date: 2013-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_pure
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.7.6
30
+ - !ruby/object:Gem::Dependency
31
+ name: clipboard
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.0.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.1
30
46
  description: Your friendly neighborhood console calculator
31
47
  email:
32
48
  - alan@commondream.net
@@ -75,3 +91,4 @@ signing_key:
75
91
  specification_version: 3
76
92
  summary: Your friendly neighborhood console calculator
77
93
  test_files: []
94
+ has_rdoc: