Class: NexusParser::NexusParser::Character

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCharacter

Returns a new instance of Character.



29
30
31
32
33
# File 'lib/nexus_parser.rb', line 29

def initialize
  @name = nil
  @states = {}
  @notes = []
end

Instance Attribute Details

#nameObject



50
51
52
# File 'lib/nexus_parser.rb', line 50

def name
  ((@name == "") || (@name.nil?)) ? "Undefined" : @name
end

#notesObject

Returns the value of attribute notes.



26
27
28
# File 'lib/nexus_parser.rb', line 26

def notes
  @notes
end

#statesObject

Returns the value of attribute states.



26
27
28
# File 'lib/nexus_parser.rb', line 26

def states
  @states
end

Instance Method Details

#add_state(options = {}) ⇒ Object

requires :label



36
37
38
39
40
41
42
43
# File 'lib/nexus_parser.rb', line 36

def add_state(options = {})
  @opt = {
    :name => ''
  }.merge!(options)
  return false if !@opt[:label]

  @states.update(@opt[:label] => ChrState.new(@opt[:name]))
end

#state_labelsObject

test this



46
47
48
# File 'lib/nexus_parser.rb', line 46

def state_labels
  @states.keys.sort
end