Class: QiitaMatome::Article
- Inherits:
-
Object
- Object
- QiitaMatome::Article
- Defined in:
- lib/models/article.rb
Overview
QiitaMatome::Article
Constant Summary collapse
- YMDHMS_DATETIME_FORMAT =
'%Y/%m/%d %H:%M:%S'.freeze
Instance Attribute Summary collapse
-
#created_at ⇒ Object
rubocop:disable LineLength.
-
#stock_count ⇒ Object
rubocop:disable LineLength.
-
#tags ⇒ Object
rubocop:disable LineLength.
-
#title ⇒ Object
rubocop:disable LineLength.
-
#updated_at ⇒ Object
rubocop:disable LineLength.
-
#user ⇒ Object
rubocop:disable LineLength.
-
#uuid ⇒ Object
rubocop:disable LineLength.
Instance Method Summary collapse
-
#created_at_ymdhms ⇒ Object
rubocop:enable MethodLength.
-
#initialize(options = {}) {|_self| ... } ⇒ Article
constructor
rubocop:disable MethodLength.
- #title_link ⇒ Object
- #updated_at_ymdhms ⇒ Object
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Article
rubocop:disable MethodLength
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/models/article.rb', line 10 def initialize( = {}) @uuid = ['uuid'] @user = ['user'] @title = ['title'] @uuid = ['uuid'] c_at = ['created_at'] u_at = ['updated_at'] @created_at = DateTime.parse(c_at) unless c_at.nil? @updated_at = DateTime.parse(u_at) unless u_at.nil? @tags = ['tags'] @stock_count = ['stock_count'] yield(self) if block_given? end |
Instance Attribute Details
#created_at ⇒ Object
rubocop:disable LineLength
7 8 9 |
# File 'lib/models/article.rb', line 7 def created_at @created_at end |
#stock_count ⇒ Object
rubocop:disable LineLength
7 8 9 |
# File 'lib/models/article.rb', line 7 def stock_count @stock_count end |
#tags ⇒ Object
rubocop:disable LineLength
7 8 9 |
# File 'lib/models/article.rb', line 7 def @tags end |
#title ⇒ Object
rubocop:disable LineLength
7 8 9 |
# File 'lib/models/article.rb', line 7 def title @title end |
#updated_at ⇒ Object
rubocop:disable LineLength
7 8 9 |
# File 'lib/models/article.rb', line 7 def updated_at @updated_at end |
#user ⇒ Object
rubocop:disable LineLength
7 8 9 |
# File 'lib/models/article.rb', line 7 def user @user end |
#uuid ⇒ Object
rubocop:disable LineLength
7 8 9 |
# File 'lib/models/article.rb', line 7 def uuid @uuid end |
Instance Method Details
#created_at_ymdhms ⇒ Object
rubocop:enable MethodLength
25 26 27 |
# File 'lib/models/article.rb', line 25 def created_at_ymdhms @created_at.strftime(YMDHMS_DATETIME_FORMAT) end |
#title_link ⇒ Object
33 34 35 36 |
# File 'lib/models/article.rb', line 33 def title_link url_name = user['url_name'] "[#{title.gsub('|', '')}](http://qiita.com/#{url_name}/items/#{uuid})" end |
#updated_at_ymdhms ⇒ Object
29 30 31 |
# File 'lib/models/article.rb', line 29 def updated_at_ymdhms @updated_at.strftime(YMDHMS_DATETIME_FORMAT) end |