Class: EmotionList

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEmotionList

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

#listObject (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_sObject



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