nutella 0.4 → 0.5

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,30 @@
1
+ module Nutella
2
+ class << self
3
+ # Prints the given +prompt+ to STDOUT, then reads text from STDIN until the
4
+ # user presses Enter.
5
+ #
6
+ # @example Comparison of taking input with and without Nutella
7
+ # # Pure Ruby
8
+ # print "Enter your name: "
9
+ # name = STDIN.gets.chomp
10
+ #
11
+ # # Ruby with Nutella
12
+ # name = Nutella::raw_input "Enter your name: "
13
+ #
14
+ # @param [String] prompt the message to display to the user
15
+ # @return [String] the user's input
16
+ def raw_input(prompt)
17
+ print prompt
18
+ STDIN.gets.chomp
19
+ end
20
+
21
+ # Takes input as described in <tt>Nutella#raw_input</tt>, but strips all
22
+ # leading and trailing whitespace.
23
+ #
24
+ # @param [String] prompt the message to display to the user
25
+ # @return [String] the user's input with excess whitespace stripped
26
+ def input(prompt)
27
+ raw_input(prompt).strip
28
+ end
29
+ end
30
+ end
@@ -1,4 +1,4 @@
1
1
  module Nutella
2
2
  # The current version of Nutella.
3
- VERSION = "0.4"
3
+ VERSION = "0.5"
4
4
  end
data/lib/nutella.rb CHANGED
@@ -1 +1,2 @@
1
1
  require "nutella/core_ext"
2
+ require "nutella/input"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutella
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
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: 2012-09-30 00:00:00.000000000 Z
12
+ date: 2012-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -99,6 +99,7 @@ extra_rdoc_files: []
99
99
  files:
100
100
  - lib/nutella.rb
101
101
  - lib/nutella/version.rb
102
+ - lib/nutella/input.rb
102
103
  - lib/nutella/core_ext/string.rb
103
104
  - lib/nutella/core_ext/integer.rb
104
105
  - lib/nutella/core_ext/hash.rb
@@ -135,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
136
  version: '0'
136
137
  segments:
137
138
  - 0
138
- hash: -2685001604496901448
139
+ hash: 3528404014664225441
139
140
  requirements: []
140
141
  rubyforge_project:
141
142
  rubygems_version: 1.8.24