Class: Trample::Configuration
- Inherits:
-
Object
- Object
- Trample::Configuration
- Defined in:
- lib/trample/configuration.rb
Instance Attribute Summary collapse
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #concurrency(*value) ⇒ Object
- #get(url, &block) ⇒ Object
-
#initialize(&block) ⇒ Configuration
constructor
A new instance of Configuration.
- #iterations(*value) ⇒ Object
- #login ⇒ Object
- #post(url, params = nil, &block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 |
# File 'lib/trample/configuration.rb', line 5 def initialize(&block) @pages = [] instance_eval(&block) end |
Instance Attribute Details
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
3 4 5 |
# File 'lib/trample/configuration.rb', line 3 def pages @pages end |
Instance Method Details
#==(other) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/trample/configuration.rb', line 37 def ==(other) other.is_a?(Configuration) && other.pages == pages && other.concurrency == concurrency && other.iterations == iterations end |
#concurrency(*value) ⇒ Object
10 11 12 13 |
# File 'lib/trample/configuration.rb', line 10 def concurrency(*value) @concurrency = value.first unless value.empty? @concurrency end |
#get(url, &block) ⇒ Object
20 21 22 |
# File 'lib/trample/configuration.rb', line 20 def get(url, &block) @pages << Page.new(:get, url, block || {}) end |
#iterations(*value) ⇒ Object
15 16 17 18 |
# File 'lib/trample/configuration.rb', line 15 def iterations(*value) @iterations = value.first unless value.empty? @iterations end |
#login ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/trample/configuration.rb', line 28 def login if block_given? yield @login = pages.pop end @login end |