Class: Rave::Models::Annotation

Inherits:
Object
  • Object
show all
Includes:
Rave::Mixins::ObjectFactory
Defined in:
lib/models/annotation.rb

Overview

An annotation applying styling or other meta-data to a section of text.

Direct Known Subclasses

Conversation, Language, Link, Style, User

Defined Under Namespace

Classes: Conversation, Language, Link, Style, User

Constant Summary collapse

JAVA_CLASS =
"com.google.wave.api.Annotation"

Constants included from Rave::Mixins::ObjectFactory

Rave::Mixins::ObjectFactory::WILDCARD

Instance Attribute Summary

Attributes included from Rave::Mixins::ObjectFactory

#type

Instance Method Summary collapse

Methods included from Rave::Mixins::ObjectFactory

included

Constructor Details

#initialize(*args) ⇒ Annotation

:nodoc:



29
# File 'lib/models/annotation.rb', line 29

def initialize(value, range); end

Instance Method Details

#nameObject

Name of the annotation type [String]



12
13
14
15
# File 'lib/models/annotation.rb', line 12

def name # :nodoc:
  # If @id is defined, then put that into the type, otherwise just the type is fine.
  @id ? type.sub(WILDCARD, @id) : type
end

#rangeObject

Range of characters over which the annotation applies [Range]



23
24
25
# File 'lib/models/annotation.rb', line 23

def range # :nodoc:
  @range.dup
end

#to_jsonObject

:nodoc:



43
44
45
46
47
48
49
50
# File 'lib/models/annotation.rb', line 43

def to_json # :nodoc:
  {
    'javaClass' => JAVA_CLASS,
    'name' => name,
    'value' => value,
    'range' => range,
  }.to_json
end

#valueObject

Value of the annotation [String]



18
19
20
# File 'lib/models/annotation.rb', line 18

def value # :nodoc:
  @value.dup
end