Class: FourchanUrler::Request
- Inherits:
-
Object
- Object
- FourchanUrler::Request
- Defined in:
- lib/fourchan-urler.rb
Instance Attribute Summary collapse
-
#board ⇒ Object
Returns the value of attribute board.
-
#thread_id ⇒ Object
Returns the value of attribute thread_id.
Instance Method Summary collapse
-
#initialize(url) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(url) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fourchan-urler.rb', line 9 def initialize(url) uri = URI(url) if uri.host == "boards.4chan.org" && uri.path.path_check @thread_id = url[/(\d{3,})/].to_i @board = url[/\/[a-z]+\//][/[a-z]+/] else raise ArgumentError, 'URL is incorrect. Please use 4chan thread URL.' end end |
Instance Attribute Details
#board ⇒ Object
Returns the value of attribute board.
7 8 9 |
# File 'lib/fourchan-urler.rb', line 7 def board @board end |
#thread_id ⇒ Object
Returns the value of attribute thread_id.
7 8 9 |
# File 'lib/fourchan-urler.rb', line 7 def thread_id @thread_id end |