Class: Httpify::Httpifier
- Inherits:
-
Object
- Object
- Httpify::Httpifier
- Defined in:
- lib/httpify/httpifier.rb
Instance Method Summary collapse
-
#initialize(url, options = {}) ⇒ Httpifier
constructor
A new instance of Httpifier.
- #perform! ⇒ Object
Constructor Details
#initialize(url, options = {}) ⇒ Httpifier
Returns a new instance of Httpifier.
5 6 7 8 |
# File 'lib/httpify/httpifier.rb', line 5 def initialize(url, = {}) @url = url @options = .symbolize_keys! end |
Instance Method Details
#perform! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/httpify/httpifier.rb', line 10 def perform! return @url if @url.blank? if !@url.match(/^http[s]?:\/\//) url = "http" url << "s" if @options[:https] url << "://#{@url}" url << "/" if @options[:trailing_slash] url else @url end end |