Class: NexusParser::NexusParser::Character
- Inherits:
-
Object
- Object
- NexusParser::NexusParser::Character
- Defined in:
- lib/nexus_parser.rb
Instance Attribute Summary collapse
- #name ⇒ Object
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#states ⇒ Object
Returns the value of attribute states.
Instance Method Summary collapse
-
#add_state(options = {}) ⇒ Object
requires :label.
-
#initialize ⇒ Character
constructor
A new instance of Character.
-
#state_labels ⇒ Object
test this.
Constructor Details
#initialize ⇒ Character
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
#name ⇒ Object
50 51 52 |
# File 'lib/nexus_parser.rb', line 50 def name ((@name == "") || (@name.nil?)) ? "Undefined" : @name end |
#notes ⇒ Object
Returns the value of attribute notes.
26 27 28 |
# File 'lib/nexus_parser.rb', line 26 def notes @notes end |
#states ⇒ Object
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( = {}) @opt = { :name => '' }.merge!() return false if !@opt[:label] @states.update(@opt[:label] => ChrState.new(@opt[:name])) end |
#state_labels ⇒ Object
test this
46 47 48 |
# File 'lib/nexus_parser.rb', line 46 def state_labels @states.keys.sort end |