Class: IrcLogParser::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/irc-log-parser/log.rb

Direct Known Subclasses

Tiarra, Znc

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#channelObject (readonly)

Returns the value of attribute channel.



5
6
7
# File 'lib/irc-log-parser/log.rb', line 5

def channel
  @channel
end

#is_noticeObject (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

#networkObject (readonly)

Returns the value of attribute network.



5
6
7
# File 'lib/irc-log-parser/log.rb', line 5

def network
  @network
end

#nickObject (readonly)

Returns the value of attribute nick.



5
6
7
# File 'lib/irc-log-parser/log.rb', line 5

def nick
  @nick
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/irc-log-parser/log.rb', line 5

def text
  @text
end

#timeObject (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

#parseObject



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_ltsvObject



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_sObject



40
41
42
# File 'lib/irc-log-parser/log.rb', line 40

def to_s
  to_json.to_s
end