Class: Bbs::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/bbiff/bbs_reader.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(no, name, mail, date, body) ⇒ Post

Returns a new instance of Post.



21
22
23
24
25
26
27
# File 'lib/bbiff/bbs_reader.rb', line 21

def initialize(no, name, mail, date, body)
  @no = no.to_i
  @name = name
  @mail = mail
  @date = date
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



19
20
21
# File 'lib/bbiff/bbs_reader.rb', line 19

def body
  @body
end

#dateObject (readonly)

Returns the value of attribute date.



19
20
21
# File 'lib/bbiff/bbs_reader.rb', line 19

def date
  @date
end

#mailObject (readonly)

Returns the value of attribute mail.



19
20
21
# File 'lib/bbiff/bbs_reader.rb', line 19

def mail
  @mail
end

#nameObject (readonly)

Returns the value of attribute name.



19
20
21
# File 'lib/bbiff/bbs_reader.rb', line 19

def name
  @name
end

#noObject (readonly)

Returns the value of attribute no.



19
20
21
# File 'lib/bbiff/bbs_reader.rb', line 19

def no
  @no
end

Class Method Details

.from_s(str) ⇒ Object



14
15
16
# File 'lib/bbiff/bbs_reader.rb', line 14

def from_s(str)
  Post.new(*str.split('<>', 5))
end

Instance Method Details

#to_sObject

削除された時のフィールドの値は、掲示板の設定によるなぁ。def deleted?

@date == '<削除>'

end



34
35
36
# File 'lib/bbiff/bbs_reader.rb', line 34

def to_s
  [no, name, mail, date, body].join('<>')
end