Class: Hootenanny::Topic
- Inherits:
-
Object
- Object
- Hootenanny::Topic
- Defined in:
- lib/hootenanny/topic.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.from_url(url, options = {}) ⇒ Object
Private: Creates a topic from a String representing the URL of the topic.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Topic
constructor
A new instance of Topic.
Constructor Details
#initialize(options = {}) ⇒ Topic
Returns a new instance of Topic.
8 9 10 |
# File 'lib/hootenanny/topic.rb', line 8 def initialize( = {}) self.url = Hootenanny::URI.parse(.fetch(:url)) end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/hootenanny/topic.rb', line 6 def url @url end |
Class Method Details
.from_url(url, options = {}) ⇒ Object
Private: Creates a topic from a String representing the URL of the topic
url - A String representing the URL of the topic
Examples:
Hootenanny::Topic.from_url('http://example.com')
Returns a Hootenanny::Topic Raises a Hootenanny::URI::InvalidError if the URI cannot be parsed Raises a Hootenanny::URI::InvalidSchemeError if the URI is not either HTTP
or HTTPS
26 27 28 29 30 31 32 |
# File 'lib/hootenanny/topic.rb', line 26 def self.from_url(url, = {}) topic = allocate topic.send(:initialize, .merge(:url => url)) topic end |