Class: Firecracker::Base
- Inherits:
-
Object
- Object
- Firecracker::Base
- Defined in:
- lib/firecracker/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#debug? ⇒ Boolean
Should we print debug ouput?.
- #hashes ⇒ Object
-
#initialize(args = {}) ⇒ Base
constructor
Example: { tracker: “tracker.ccc.de”, hashes: [“2bbf3d63e6b313ecf2655067b51e93f17eeeb135”], debug: false }.
-
#timeout ⇒ Object
Integer Global timeout limit.
-
#valid? ⇒ Boolean
Do we have everyting that’s needed to do the request.
Constructor Details
#initialize(args = {}) ⇒ Base
Example:
{
tracker: "tracker.ccc.de",
hashes: ["2bbf3d63e6b313ecf2655067b51e93f17eeeb135"],
debug: false
}
15 16 17 18 19 20 21 22 |
# File 'lib/firecracker/base.rb', line 15 def initialize(args = {}) @options = { debug: false, timeout: 2, tracker: nil, hashes: [] }.merge(args) end |
Instance Method Details
#debug? ⇒ Boolean
Returns Should we print debug ouput?.
38 39 40 |
# File 'lib/firecracker/base.rb', line 38 def debug? @options[:debug] end |
#hashes ⇒ Object
45 46 47 |
# File 'lib/firecracker/base.rb', line 45 def hashes @options[:hashes] end |
#timeout ⇒ Object
Returns Integer Global timeout limit.
52 53 54 |
# File 'lib/firecracker/base.rb', line 52 def timeout @options[:timeout] end |
#valid? ⇒ Boolean
Returns Do we have everyting that’s needed to do the request.
28 29 30 31 32 33 |
# File 'lib/firecracker/base.rb', line 28 def valid? [ @options[:tracker], @options[:hashes].count.between?(1, 72) ].all? end |