Class: Pic2ch::Thread

Inherits:
Struct
  • Object
show all
Defined in:
lib/pic2ch/thread.rb,
lib/pic2ch/thread.rb,
lib/pic2ch/thread/static.rb,
lib/pic2ch/thread/element_parser.rb

Direct Known Subclasses

Static

Defined Under Namespace

Modules: ElementParser Classes: Static

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#createdObject

Returns the value of attribute created

Returns:

  • (Object)

    the current value of created



5
6
7
# File 'lib/pic2ch/thread.rb', line 5

def created
  @created
end

Returns the value of attribute link

Returns:

  • (Object)

    the current value of link



5
6
7
# File 'lib/pic2ch/thread.rb', line 5

def link
  @link
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/pic2ch/thread.rb', line 5

def name
  @name
end

#starObject

Returns the value of attribute star

Returns:

  • (Object)

    the current value of star



5
6
7
# File 'lib/pic2ch/thread.rb', line 5

def star
  @star
end

Instance Method Details

#codeObject



14
15
16
# File 'lib/pic2ch/thread.rb', line 14

def code
  link.to_s.scan(/\d+/).flatten.first.to_i
end

#downloadObject



34
35
36
37
38
# File 'lib/pic2ch/thread.rb', line 34

def download
  Dir.chdir(Pic2ch.root) do
    downloader.execute
  end
end

#downloaderObject

Downloader



30
31
32
# File 'lib/pic2ch/thread.rb', line 30

def downloader
  Downloaders::Thread.new(self)
end

#parserObject

Parser



21
22
23
# File 'lib/pic2ch/thread.rb', line 21

def parser
  @parser ||= Parsers::Thread.new(self)
end

#urlObject

Accessors



10
11
12
# File 'lib/pic2ch/thread.rb', line 10

def url
  Pic2ch.url + link
end