Class: Watnow::Annotation

Inherits:
Object
  • Object
show all
Defined in:
lib/watnow/annotation/annotation.rb

Overview

An Annotation is basically a group of AnnotationLine

Constant Summary collapse

@@id =
0
@@instances =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Annotation

Returns a new instance of Annotation.



15
16
17
18
19
20
21
22
23
24
# File 'lib/watnow/annotation/annotation.rb', line 15

def initialize(opts)
  @priority = 0
  @file = opts[:file]
  @lines = set_lines(opts[:lines])

  # Auto increment instances id
  # Push instance into a class array
  @id = @@id += 1
  @@instances << self
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



8
9
10
# File 'lib/watnow/annotation/annotation.rb', line 8

def file
  @file
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/watnow/annotation/annotation.rb', line 8

def id
  @id
end

#linesObject

Returns the value of attribute lines.



8
9
10
# File 'lib/watnow/annotation/annotation.rb', line 8

def lines
  @lines
end

#priorityObject

Returns the value of attribute priority.



8
9
10
# File 'lib/watnow/annotation/annotation.rb', line 8

def priority
  @priority
end

Class Method Details

.allObject

An ORM-like method that returns all Annotation instances



11
12
13
# File 'lib/watnow/annotation/annotation.rb', line 11

def self.all
  @@instances
end