Class: Oat::Blob

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/oat/blobtypes/blob.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(position, string = '') ⇒ Blob


10
11
12
13
14
15
# File 'lib/oat/blobtypes/blob.rb', line 10

def initialize (position, string = '')
  @position = position
  @japanese = string
  @english = ''
  @status = :incomplete #:incomplete, :complete, :partial
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position


8
9
10
# File 'lib/oat/blobtypes/blob.rb', line 8

def position
  @position
end

#statusObject (readonly)

Returns the value of attribute status


7
8
9
# File 'lib/oat/blobtypes/blob.rb', line 7

def status
  @status
end

Instance Method Details

#+(obj2) ⇒ Object


50
51
52
53
54
# File 'lib/oat/blobtypes/blob.rb', line 50

def +(obj2)
  #call to_jp on Blobs, or just add strings
  #Blob.new(obj2.respond_to?(:to_jp) ? @japanese + obj2.to_jp : @japanese + obj2)
  @japanese += obj2.respond_to?(:to_jp) ? obj2.to_jp : obj2
end

#<(other) ⇒ Object


64
65
66
# File 'lib/oat/blobtypes/blob.rb', line 64

def <(other)
  @position < other.position
end

#<=>(other) ⇒ Object


56
57
58
# File 'lib/oat/blobtypes/blob.rb', line 56

def <=>(other)
  @position <=> other.position
end

#>(other) ⇒ Object


60
61
62
# File 'lib/oat/blobtypes/blob.rb', line 60

def >(other)
  @position > other.position
end

#complete!Object


29
30
31
# File 'lib/oat/blobtypes/blob.rb', line 29

def complete!
  @status = :complete
end

#complete?Boolean


21
22
23
# File 'lib/oat/blobtypes/blob.rb', line 21

def complete?
  @status == :complete
end

#english=(value, status = :complete) ⇒ Object


45
46
47
48
# File 'lib/oat/blobtypes/blob.rb', line 45

def english=(value, status = :complete)
  @english = value 
  @status = status
end

#incomplete!Object


25
26
27
# File 'lib/oat/blobtypes/blob.rb', line 25

def incomplete!
  @status = :incomplete
end

#incomplete?Boolean


17
18
19
# File 'lib/oat/blobtypes/blob.rb', line 17

def incomplete?
  @status == :incomplete
end

#to_enObject


33
34
35
# File 'lib/oat/blobtypes/blob.rb', line 33

def to_en
  @english
end

#to_jpObject


37
38
39
# File 'lib/oat/blobtypes/blob.rb', line 37

def to_jp
  @japanese
end

#to_xmlObject


41
42
43
# File 'lib/oat/blobtypes/blob.rb', line 41

def to_xml
  #sprintf(Oat::Formats::HEADERS_FMT, @english)
end