Class: Stenographer::Message
- Inherits:
-
Object
- Object
- Stenographer::Message
- Defined in:
- lib/stenographer/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#words ⇒ Object
Returns the value of attribute words.
Instance Method Summary collapse
- #explode ⇒ Object
- #include?(query = nil) ⇒ Boolean
-
#initialize(id, name, body) ⇒ Message
constructor
A new instance of Message.
- #print(opts = {}) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/stenographer/message.rb', line 4 def body @body end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/stenographer/message.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/stenographer/message.rb', line 4 def name @name end |
#words ⇒ Object
Returns the value of attribute words.
4 5 6 |
# File 'lib/stenographer/message.rb', line 4 def words @words end |
Instance Method Details
#explode ⇒ Object
19 20 21 |
# File 'lib/stenographer/message.rb', line 19 def explode Word.(self) end |
#include?(query = nil) ⇒ Boolean
13 14 15 16 17 |
# File 'lib/stenographer/message.rb', line 13 def include?(query=nil) return true if query.nil? body.include?(query) end |
#print(opts = {}) ⇒ Object
23 24 25 26 |
# File 'lib/stenographer/message.rb', line 23 def print(opts={}) code = opts[:highlighted] ? ">> %-17s %0s" : "%-20s %0s" puts printf(code, name, body) end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/stenographer/message.rb', line 28 def to_s "Message <name: #{name}, body: #{body}>" end |