Class: URL
- Inherits:
-
Object
- Object
- URL
- Defined in:
- lib/jiraSOAP/url.rb,
lib/macruby_stuff.rb
Overview
A bit of a hack to support using an NSURL in MacRuby while still supporting MRI by using the URI module.
I suggest not thinking about it too much beyond this point: this is a URI object if you are running on CRuby, but it will be an NSURL if you are running on MacRuby.
Instance Attribute Summary collapse
-
#url ⇒ NSURL, URI::HTTP
The type depends on your RUBY_ENGINE.
Instance Method Summary collapse
-
#initialize(url_string) ⇒ URI::HTTP, NSURL
constructor
Initializes @url with the correct object type.
-
#method_missing(method, *args) ⇒ Object
The magic of the hack, passing everything to the level beneath.
-
#to_s ⇒ String
The to_s method technically exists and so method_missing would not work its magic to redirect it to @url so we manually override.
Constructor Details
#initialize(url_string) ⇒ URI::HTTP, NSURL
Initializes @url with the correct object type.
14 15 16 |
# File 'lib/jiraSOAP/url.rb', line 14 def initialize(url) @url = URI.parse url end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
The magic of the hack, passing everything to the level beneath.
26 27 28 |
# File 'lib/jiraSOAP/url.rb', line 26 def method_missing(method, *args) @url.send method, *args end |
Instance Attribute Details
#url ⇒ NSURL, URI::HTTP
Returns the type depends on your RUBY_ENGINE.
9 10 11 |
# File 'lib/jiraSOAP/url.rb', line 9 def url @url end |
Instance Method Details
#to_s ⇒ String
The to_s method technically exists and so method_missing would not work its magic to redirect it to @url so we manually override.
21 22 23 |
# File 'lib/jiraSOAP/url.rb', line 21 def to_s @url.to_s end |