Class: Pic2ch::Pages::Index
- Inherits:
-
Object
- Object
- Pic2ch::Pages::Index
- Defined in:
- lib/pic2ch/pages/index.rb
Instance Attribute Summary collapse
-
#p ⇒ Object
readonly
Returns the value of attribute p.
Instance Method Summary collapse
-
#html ⇒ Object
Fetch.
-
#initialize(p) ⇒ Index
constructor
A new instance of Index.
-
#parser ⇒ Object
Parsers.
- #path ⇒ Object
-
#url ⇒ Object
Accessors.
Constructor Details
#initialize(p) ⇒ Index
Returns a new instance of Index.
6 7 8 9 |
# File 'lib/pic2ch/pages/index.rb', line 6 def initialize(p) @p = p.to_i @p = 1 if @p < 1 end |
Instance Attribute Details
#p ⇒ Object (readonly)
Returns the value of attribute p.
4 5 6 |
# File 'lib/pic2ch/pages/index.rb', line 4 def p @p end |
Instance Method Details
#html ⇒ Object
Fetch
25 26 27 |
# File 'lib/pic2ch/pages/index.rb', line 25 def html @html ||= open(url).read{} end |
#parser ⇒ Object
Parsers
31 32 33 |
# File 'lib/pic2ch/pages/index.rb', line 31 def parser @parser ||= Parsers::Index.new(html) end |
#path ⇒ Object
18 19 20 |
# File 'lib/pic2ch/pages/index.rb', line 18 def path p == 1 ? '' : "/?p=#{p}" end |
#url ⇒ Object
Accessors
14 15 16 |
# File 'lib/pic2ch/pages/index.rb', line 14 def url Pic2ch.url + path end |