Class: Threatinator::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/threatinator/record.rb

Direct Known Subclasses

Parsers::JSON::Record, Parsers::XML::Record

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, opts = {}) ⇒ Record

Returns a new instance of Record.



4
5
6
7
8
9
# File 'lib/threatinator/record.rb', line 4

def initialize(data, opts = {})
  @data = data
  @line_number = opts[:line_number]
  @pos_start = opts[:pos_start]
  @pos_end = opts[:pos_end]
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/threatinator/record.rb', line 3

def data
  @data
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



3
4
5
# File 'lib/threatinator/record.rb', line 3

def line_number
  @line_number
end

#pos_endObject (readonly)

Returns the value of attribute pos_end.



3
4
5
# File 'lib/threatinator/record.rb', line 3

def pos_end
  @pos_end
end

#pos_startObject (readonly)

Returns the value of attribute pos_start.



3
4
5
# File 'lib/threatinator/record.rb', line 3

def pos_start
  @pos_start
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
15
16
# File 'lib/threatinator/record.rb', line 11

def ==(other)
  @data == other.data &&
    @line_number == other.line_number &&
    @pos_start == other.pos_start &&
    @pos_end == other.pos_end
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/threatinator/record.rb', line 18

def eql?(other)
  other.kind_of?(self.class) && self == other
end