Class: Craiggy::Post
- Inherits:
-
Object
- Object
- Craiggy::Post
- Defined in:
- lib/craiggy/post.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #has_image? ⇒ Boolean
-
#initialize(page) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(page) ⇒ Post
Returns a new instance of Post.
6 7 8 9 10 11 12 13 14 |
# File 'lib/craiggy/post.rb', line 6 def initialize(page) post_params = PostScraper.new(page).post_params @title = post_params[:title] @image = post_params[:image] @price = post_params[:price] @location = post_params[:location] @description = post_params[:description] @url = post_params[:url] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/craiggy/post.rb', line 4 def description @description end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
4 5 6 |
# File 'lib/craiggy/post.rb', line 4 def image @image end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
4 5 6 |
# File 'lib/craiggy/post.rb', line 4 def location @location end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
4 5 6 |
# File 'lib/craiggy/post.rb', line 4 def price @price end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/craiggy/post.rb', line 4 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/craiggy/post.rb', line 4 def url @url end |
Instance Method Details
#has_image? ⇒ Boolean
16 17 18 |
# File 'lib/craiggy/post.rb', line 16 def has_image? image != "" end |