Class: IrcLogParser::Log
- Inherits:
-
Object
- Object
- IrcLogParser::Log
- Defined in:
- lib/irc-log-parser/log.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#is_notice ⇒ Object
readonly
Returns the value of attribute is_notice.
-
#network ⇒ Object
readonly
Returns the value of attribute network.
-
#nick ⇒ Object
readonly
Returns the value of attribute nick.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Log
constructor
A new instance of Log.
- #parse ⇒ Object
- #to_json(*args) ⇒ Object
- #to_ltsv ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Log
Returns a new instance of Log.
7 8 9 10 11 12 13 14 |
# File 'lib/irc-log-parser/log.rb', line 7 def initialize(args = {}) @network = args[:network] @channel = args[:channel] @time = args[:time] @nick = args[:nick] @text = args[:text] @is_notice = args[:is_notice] end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
5 6 7 |
# File 'lib/irc-log-parser/log.rb', line 5 def channel @channel end |
#is_notice ⇒ Object (readonly)
Returns the value of attribute is_notice.
5 6 7 |
# File 'lib/irc-log-parser/log.rb', line 5 def is_notice @is_notice end |
#network ⇒ Object (readonly)
Returns the value of attribute network.
5 6 7 |
# File 'lib/irc-log-parser/log.rb', line 5 def network @network end |
#nick ⇒ Object (readonly)
Returns the value of attribute nick.
5 6 7 |
# File 'lib/irc-log-parser/log.rb', line 5 def nick @nick end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/irc-log-parser/log.rb', line 5 def text @text end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/irc-log-parser/log.rb', line 5 def time @time end |
Instance Method Details
#parse ⇒ Object
16 17 18 |
# File 'lib/irc-log-parser/log.rb', line 16 def parse "not implement" end |
#to_json(*args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/irc-log-parser/log.rb', line 29 def to_json(*args) JSON.generate({ network: @network, channel: @channel, time: @time, nick: @nick, text: @text, is_notice: @is_notice, }) end |
#to_ltsv ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/irc-log-parser/log.rb', line 20 def to_ltsv "network:#{@network}\t" + "channel:#{@channel}\t" + "time:#{@time}\t" + "nick:#{@nick}\t" + "text:#{@text}\t" + "is_notice:#{@is_notice}\t" end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/irc-log-parser/log.rb', line 40 def to_s to_json.to_s end |