Class: Inform::Verb
Overview
Verbs
Defined Under Namespace
Classes: Grammar
Constant Summary collapse
- SpaceString =
' '.freeze
- VerbString =
'Verb'.freeze
- MetaString =
'meta'.freeze
- EmoteString =
'emote'.freeze
- Newline =
"\n".freeze
Instance Attribute Summary collapse
-
#emote ⇒ Object
readonly
Returns the value of attribute emote.
-
#grammars ⇒ Object
Returns the value of attribute grammars.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #emote? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(verbs, source, meta = nil, emote = nil) ⇒ Verb
constructor
A new instance of Verb.
- #meta? ⇒ Boolean
- #to_s ⇒ Object (also: #to_str)
- #verb ⇒ Object
Methods inherited from Set
Constructor Details
#initialize(verbs, source, meta = nil, emote = nil) ⇒ Verb
Returns a new instance of Verb.
51 52 53 54 55 56 57 58 |
# File 'lib/story_teller/grammar_parser.rb', line 51 def initialize(verbs, source, = nil, emote = nil) super() merge(verbs) @meta = unless .nil? @emote = emote unless emote.nil? @grammars = [] @source = source end |
Instance Attribute Details
#emote ⇒ Object (readonly)
Returns the value of attribute emote.
48 49 50 |
# File 'lib/story_teller/grammar_parser.rb', line 48 def emote @emote end |
#grammars ⇒ Object
Returns the value of attribute grammars.
49 50 51 |
# File 'lib/story_teller/grammar_parser.rb', line 49 def grammars @grammars end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
48 49 50 |
# File 'lib/story_teller/grammar_parser.rb', line 48 def @meta end |
#source ⇒ Object
Returns the value of attribute source.
49 50 51 |
# File 'lib/story_teller/grammar_parser.rb', line 49 def source @source end |
Instance Method Details
#<=>(other) ⇒ Object
65 66 67 68 |
# File 'lib/story_teller/grammar_parser.rb', line 65 def <=>(other) !other.nil? && include?(other.to_s) && == other. && grammars == other.grammars && super end |
#==(other) ⇒ Object
60 61 62 63 |
# File 'lib/story_teller/grammar_parser.rb', line 60 def ==(other) !other.nil? && include?(other.to_s) && == other. && grammars == other.grammars && super end |
#emote? ⇒ Boolean
83 84 85 |
# File 'lib/story_teller/grammar_parser.rb', line 83 def emote? !emote.nil? end |
#eql?(other) ⇒ Boolean
70 71 72 73 |
# File 'lib/story_teller/grammar_parser.rb', line 70 def eql?(other) !other.nil? && include?(other.to_s) && == other. && grammars == other.grammars && super end |
#hash ⇒ Object
107 108 109 |
# File 'lib/story_teller/grammar_parser.rb', line 107 def hash [super, , emote, grammars].hash end |
#meta? ⇒ Boolean
79 80 81 |
# File 'lib/story_teller/grammar_parser.rb', line 79 def !.nil? end |
#to_s ⇒ Object Also known as: to_str
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/story_teller/grammar_parser.rb', line 93 def to_s VerbString + SpaceString + if MetaString + SpaceString elsif emote? EmoteString + SpaceString else '' end + map { |verb| "'#{verb}'" }.join(SpaceString) + Newline + grammars.join(Newline) end |
#verb ⇒ Object
75 76 77 |
# File 'lib/story_teller/grammar_parser.rb', line 75 def verb first end |