better_input 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -2
- data/better_input-0.1.1.gem +0 -0
- data/lib/better_input/version.rb +1 -1
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91f6acc7fd325931d683a59962503b1f3fc6dec3a829bb1752b88dcac0e27032
|
4
|
+
data.tar.gz: 17f6a25540c3643f6bf1173db8189489327286749b221accbcbee451cff4cbc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 475f4143667b67e376c2188641d217fde1f3afdca6b14694c4ae51dd3ab226b805ef1753f29ac2297d0a93a681d322d35e7eca1ba242d55d9647d0fa219fbce4
|
7
|
+
data.tar.gz: c49f044e3f1799a619f0d15771a6084d9a8fb2a3ad6692cf1ab520079d124c43474a2d703e1f9ff81b2b0bd15b1f51371ae4bf0d7bf2be9607554154572b7e58
|
data/README.md
CHANGED
@@ -6,7 +6,9 @@ Whenever I tried to make an application that would be based on a command line in
|
|
6
6
|
|
7
7
|
To install this gem just use:
|
8
8
|
|
9
|
-
|
9
|
+
```shell
|
10
|
+
gem install better_input
|
11
|
+
```
|
10
12
|
|
11
13
|
|
12
14
|
## Usage
|
@@ -30,9 +32,27 @@ loop do
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
|
-
puts "
|
35
|
+
puts "User response: #{age}"
|
34
36
|
```
|
35
37
|
Although it requires other approaches like the one I did in the gem. here are some examples of how it works with inputs in ruby using the gem:
|
38
|
+
```ruby
|
39
|
+
require 'better_input'
|
40
|
+
|
41
|
+
age = Bi.input("Digite um número: ", type: "int", show_response: true)
|
42
|
+
# In a single line we asked the question and stored it in a variable,
|
43
|
+
# we made sure it was the type we wanted and we even made the answer appear!
|
44
|
+
```
|
45
|
+
```ruby
|
46
|
+
#Another examples:
|
47
|
+
|
48
|
+
noquestion = Bi.input()
|
49
|
+
retype = Bi.input(show_response: true)
|
50
|
+
onlyfloat = Bi.input(type: float)
|
51
|
+
|
52
|
+
name = Bi.input("What is your name?")
|
53
|
+
puts "Your name is #{name}"
|
54
|
+
```
|
55
|
+
Anyway, use your creativity, now receiving constant user input for CLI has become less laborious!
|
36
56
|
|
37
57
|
## Function before becoming a gem
|
38
58
|
This was more or less the base that I ended up making, I made some small improvements that you can find in the files present in this repository before turning it into a gem.
|
Binary file
|
data/lib/better_input/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_input
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barros Flavio
|
@@ -10,8 +10,18 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
13
|
+
description: |
|
14
|
+
This is an improved input function for Ruby.
|
15
|
+
|
16
|
+
Using this gem, you can easily get user input with real-time type validation, ensuring that the data provided is as expected, among other things.
|
17
|
+
|
18
|
+
If you have any questions, check the documentation: https://github.com/barrosflavio/ruby_better_input
|
19
|
+
|
20
|
+
Features:
|
21
|
+
- Ask, receive and check input in a single line
|
22
|
+
- Support for types such as integer, float and boolean.
|
23
|
+
- Input validation with clear error messages.
|
24
|
+
- Intuitive and easy-to-use function.
|
15
25
|
email:
|
16
26
|
- flaviomarbs@gmail.com
|
17
27
|
executables: []
|
@@ -22,6 +32,7 @@ files:
|
|
22
32
|
- README.md
|
23
33
|
- Rakefile
|
24
34
|
- better_input-0.1.0.gem
|
35
|
+
- better_input-0.1.1.gem
|
25
36
|
- lib/better_input.rb
|
26
37
|
- lib/better_input/version.rb
|
27
38
|
- sig/better_input.rbs
|