bidding 0.0.2 → 0.0.3
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 +18 -0
- data/lib/bidding/command.rb +5 -1
- data/lib/bidding/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
|
@@ -105,6 +105,24 @@ Command.parse("nop the_type 12345 awesome%20stuff!").execute()
|
|
|
105
105
|
Each parameter is separated with a space. If you would like to add parameter values that contain spaces I recommend URI encoding them first.
|
|
106
106
|
This allows you to handle strings that might contain spaces.
|
|
107
107
|
|
|
108
|
+
#### Building a command line in ruby
|
|
109
|
+
|
|
110
|
+
Sometimes you want to create a command line in Ruby. This could become a classic point of pain where concatinating strings creates ugly code.
|
|
111
|
+
You might end up with something similar to
|
|
112
|
+
|
|
113
|
+
```ruby
|
|
114
|
+
|
|
115
|
+
command_line = "nop " + my_argument + " " + date.to_s + " " + integer.to_s
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Thats code isnt really nice to look at, so Bidding has a helper method to make prettier
|
|
119
|
+
|
|
120
|
+
```ruby
|
|
121
|
+
|
|
122
|
+
command_line = Command.build("nop", my_argument, date, integer)
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
|
|
108
126
|
### Components
|
|
109
127
|
|
|
110
128
|
Appart from the Command structure bidding has 3 major components. All quite simple in their implementations.
|
data/lib/bidding/command.rb
CHANGED
|
@@ -15,7 +15,11 @@ class Command
|
|
|
15
15
|
command.user = user
|
|
16
16
|
command.arguments = parts
|
|
17
17
|
command.commandline = commandline
|
|
18
|
-
|
|
18
|
+
command
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.build(command, *args)
|
|
22
|
+
args.select {|arg| arg.to_s }.insert(0, command).join " "
|
|
19
23
|
end
|
|
20
24
|
|
|
21
25
|
def self.camel_case(s)
|
data/lib/bidding/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bidding
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
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:
|
|
12
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|