Class: StackOverflowApi::Question

Inherits:
Struct
  • Object
show all
Defined in:
lib/chid/stack_overflow_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#creation_dateObject

Returns the value of attribute creation_date

Returns:

  • (Object)

    the current value of creation_date



3
4
5
# File 'lib/chid/stack_overflow_api.rb', line 3

def creation_date
  @creation_date
end

Returns the value of attribute link

Returns:

  • (Object)

    the current value of link



3
4
5
# File 'lib/chid/stack_overflow_api.rb', line 3

def link
  @link
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



3
4
5
# File 'lib/chid/stack_overflow_api.rb', line 3

def title
  @title
end

Instance Method Details

#summaryObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/chid/stack_overflow_api.rb', line 4

def summary
  published_at = creation_date.nil? ? 'unkown' : creation_date.strftime("%B %d, %Y")
  print "\n"
  print "--- #{title} ---".blue
  print "\n"
  print "  Posted #{published_at} by ".brown
  print "\n"
  print "  Link: "
  print "#{link}".cyan.underline
  print "\n"
end