Class: Shaf::MethodBuilder
- Inherits:
-
Object
- Object
- Shaf::MethodBuilder
- Defined in:
- lib/shaf/extensions/resource_uris.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name, uri) ⇒ MethodBuilder
constructor
A new instance of MethodBuilder.
Constructor Details
#initialize(name, uri) ⇒ MethodBuilder
Returns a new instance of MethodBuilder.
198 199 200 201 |
# File 'lib/shaf/extensions/resource_uris.rb', line 198 def initialize(name, uri) @name = name @uri = uri.dup.freeze end |
Class Method Details
.query_string(query) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/shaf/extensions/resource_uris.rb', line 186 def self.query_string(query) return '' unless query&.any? fragment_id = query.delete(:fragment_id) fragment_str = "##{fragment_id}" if fragment_id query_str = query.map { |a| a.join('=') }.join('&') query_str = "?#{query_str}" unless query_str.empty? [query_str, fragment_str].join end |
Instance Method Details
#call ⇒ Object
203 204 205 206 207 208 209 210 |
# File 'lib/shaf/extensions/resource_uris.rb', line 203 def call if UriHelper.respond_to? uri_method_name exception = ResourceUris::UriHelperMethodAlreadyExistError raise exception.new(name, uri_method_name) end build_methods end |