Class: CourseraDownloader::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/coursera_downloader/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, body, content_type) ⇒ Document

Returns a new instance of Document.



8
9
10
11
12
# File 'lib/coursera_downloader/document.rb', line 8

def initialize(url, body, content_type)
  @url = url
  @body = body
  @content_type = content_type
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



6
7
8
# File 'lib/coursera_downloader/document.rb', line 6

def body
  @body
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



5
6
7
# File 'lib/coursera_downloader/document.rb', line 5

def content_type
  @content_type
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/coursera_downloader/document.rb', line 5

def url
  @url
end

Instance Method Details

#is_css?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/coursera_downloader/document.rb', line 18

def is_css?
  content_type =~ /text\/css/
end

#is_html?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/coursera_downloader/document.rb', line 14

def is_html?
  content_type =~ /text\/html/
end

#is_javascript?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/coursera_downloader/document.rb', line 22

def is_javascript?
  content_type =~ /javascript/
end