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.



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

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#notesObject

Returns the value of attribute notes.



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

def notes
  @notes
end

#statesObject

Returns the value of attribute states.



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

def states
  @states
end

Instance Method Details

#add_state(options = {}) ⇒ Object

requires :label



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

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



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

def state_labels
  @states.keys.sort
end