Class: EmotionList
- Inherits:
-
Object
- Object
- EmotionList
- Defined in:
- lib/emotion_list.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
-
#initialize ⇒ EmotionList
constructor
A new instance of EmotionList.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ EmotionList
Returns a new instance of EmotionList.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/emotion_list.rb', line 3 def initialize @list = { "anger" => [ "bothered", "annoyed", "bitter", "angry", "irritated", "disgusted", "frustrated", "exasperated", "furious" ], "joy" => [ "content", "peaceful", "relaxed", "cheerful", "satisfied", "joyous", "excited", "ecstatic", "happy" ], "sadness" => [ "sad", "depressed", "distraught", "despair", "melancholy", "grief", "helpless", "hopeless", "miserable" ], "hurt" => [ "lonely", "homesick", "abandoned", "embarrassed", "shame", "guilt", "foolish", "humiliated" ], "fear" => [ "uncertain", "worried", "anxious", "frightened", "scared", "nervous", "afraid", "terrified", "overwhelmed" ] } end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
2 3 4 |
# File 'lib/emotion_list.rb', line 2 def list @list end |
Instance Method Details
#to_s ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/emotion_list.rb', line 61 def to_s result = "" @list.each do |emotion, states| result += emotion.upcase + ":\n" result += " " + states.join(", ") result += "\n" end return result end |