Class: Carnivore::Http::PointBuilder::Endpoint
- Inherits:
-
Object
- Object
- Carnivore::Http::PointBuilder::Endpoint
- Includes:
- Utils::Logging, Utils::Params, Zoidberg::SoftShell, Zoidberg::Supervise
- Defined in:
- lib/carnivore-http/point_builder.rb
Overview
End point
Instance Attribute Summary collapse
-
#endpoint ⇒ String, Regexp
readonly
Request path matcher.
-
#type ⇒ Symbol
readonly
Request type (:get, :put, etc.).
Instance Method Summary collapse
-
#execute(*args) ⇒ Object
Execute action on match.
-
#initialize(type, endpoint, block) ⇒ Endpoint
constructor
Create new endoint.
-
#inspect ⇒ String
Instance inspection.
-
#to_s ⇒ String
Stringify.
Constructor Details
#initialize(type, endpoint, block) ⇒ Endpoint
Create new endoint
29 30 31 32 33 |
# File 'lib/carnivore-http/point_builder.rb', line 29 def initialize(type, endpoint, block) @endpoint = endpoint @type = type define_singleton_method(:wrapped_execute, &block) end |
Instance Attribute Details
#endpoint ⇒ String, Regexp (readonly)
Returns request path matcher.
20 21 22 |
# File 'lib/carnivore-http/point_builder.rb', line 20 def endpoint @endpoint end |
#type ⇒ Symbol (readonly)
Returns request type (:get, :put, etc.).
22 23 24 |
# File 'lib/carnivore-http/point_builder.rb', line 22 def type @type end |
Instance Method Details
#execute(*args) ⇒ Object
Execute action on match
38 39 40 41 42 43 44 45 46 |
# File 'lib/carnivore-http/point_builder.rb', line 38 def execute(*args) begin wrapped_execute(*args) rescue => e error "Unexpected error encountered! #{e.class}: #{e}" debug "#{e.class}: #{e}\n#{e.backtrace.join("\n")}" abort e end end |
#inspect ⇒ String
Returns instance inspection.
54 55 56 |
# File 'lib/carnivore-http/point_builder.rb', line 54 def inspect "<Endpoint[#{endpoint}] type=#{type} objectid=#{self.object_id}>" end |
#to_s ⇒ String
Returns stringify.
49 50 51 |
# File 'lib/carnivore-http/point_builder.rb', line 49 def to_s "<Endpoint[#{endpoint}]>" end |