Class: Simple2ch::Res
- Inherits:
-
Object
- Object
- Simple2ch::Res
- Defined in:
- lib/ruby2ch/res.rb
Constant Summary
- KAKO_LOG_INFO =
'過去ログ ★<><>[過去ログ]<><em>■ このスレッドは過去ログ倉庫に格納されています</em><>'
Instance Attribute Summary (collapse)
-
- (String) author
readonly
投稿者名.
-
- (String) author_id
readonly
ID.
-
- (String) contents
readonly
内容.
-
- (Time) date
readonly
書き込み日時.
-
- (String) mail
readonly
メール欄.
-
- (Fixnum) res_num
readonly
レス番号.
Class Method Summary (collapse)
-
+ (Res) parse(res_num, contents)
Datの1行から各項目を分離して、Resオブジェクトを返す.
Instance Method Summary (collapse)
-
- (Res) initialize(res_num, author: '', author_id: '', date: nil, mail: '', contents: '')
constructor
A new instance of Res.
Constructor Details
- (Res) initialize(res_num, author: '', author_id: '', date: nil, mail: '', contents: '')
Returns a new instance of Res
25 26 27 28 29 30 31 32 |
# File 'lib/ruby2ch/res.rb', line 25 def initialize(res_num, author: '', author_id: '', date: nil, mail: '', contents: '') @res_num = res_num @author = @author_id = @date = date @mail = mail @contents = contents end |
Instance Attribute Details
- (String) author (readonly)
Returns 投稿者名
6 7 8 |
# File 'lib/ruby2ch/res.rb', line 6 def @author end |
- (String) author_id (readonly)
Returns ID
8 9 10 |
# File 'lib/ruby2ch/res.rb', line 8 def @author_id end |
- (String) contents (readonly)
Returns 内容
14 15 16 |
# File 'lib/ruby2ch/res.rb', line 14 def contents @contents end |
- (Time) date (readonly)
Returns 書き込み日時
10 11 12 |
# File 'lib/ruby2ch/res.rb', line 10 def date @date end |
- (String) mail (readonly)
Returns メール欄
12 13 14 |
# File 'lib/ruby2ch/res.rb', line 12 def mail @mail end |
- (Fixnum) res_num (readonly)
Returns レス番号
4 5 6 |
# File 'lib/ruby2ch/res.rb', line 4 def res_num @res_num end |
Class Method Details
+ (Res) parse(res_num, contents)
Datの1行から各項目を分離して、Resオブジェクトを返す
39 40 41 42 43 44 45 |
# File 'lib/ruby2ch/res.rb', line 39 def self.parse(res_num, contents) unless contents.strip == KAKO_LOG_INFO self.new res_num, self.parse_dat(contents) else raise KakoLogException end end |