Class: BugsBunny::Exchange
- Inherits:
-
Object
- Object
- BugsBunny::Exchange
- Defined in:
- lib/bugs_bunny/exchange.rb
Instance Attribute Summary collapse
-
#delete ⇒ Object
readonly
Returns the value of attribute delete.
-
#durable ⇒ Object
readonly
Returns the value of attribute durable.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #delete_x ⇒ Object
- #durable_x ⇒ Object
-
#initialize(txt) ⇒ Exchange
constructor
A new instance of Exchange.
- #kind ⇒ Object
- #x(x) ⇒ Object
Constructor Details
#initialize(txt) ⇒ Exchange
Returns a new instance of Exchange.
10 11 12 |
# File 'lib/bugs_bunny/exchange.rb', line 10 def initialize(txt) @name, @kind, @durable, @delete, @args = txt.split("\t") end |
Instance Attribute Details
#delete ⇒ Object (readonly)
Returns the value of attribute delete.
3 4 5 |
# File 'lib/bugs_bunny/exchange.rb', line 3 def delete @delete end |
#durable ⇒ Object (readonly)
Returns the value of attribute durable.
3 4 5 |
# File 'lib/bugs_bunny/exchange.rb', line 3 def durable @durable end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/bugs_bunny/exchange.rb', line 3 def name @name end |
Class Method Details
.parse(txt) ⇒ Object
5 6 7 8 |
# File 'lib/bugs_bunny/exchange.rb', line 5 def self.parse(txt) return nil if txt =~ /Listing|\.\.\./ new(txt) end |
Instance Method Details
#<=>(other) ⇒ Object
14 15 16 |
# File 'lib/bugs_bunny/exchange.rb', line 14 def <=>(other) @name <=> other.name end |
#delete_x ⇒ Object
27 |
# File 'lib/bugs_bunny/exchange.rb', line 27 def delete_x; x(@delete); end |
#durable_x ⇒ Object
26 |
# File 'lib/bugs_bunny/exchange.rb', line 26 def durable_x; x(@durable); end |
#kind ⇒ Object
18 19 20 |
# File 'lib/bugs_bunny/exchange.rb', line 18 def kind @kind.capitalize end |
#x(x) ⇒ Object
22 23 24 |
# File 'lib/bugs_bunny/exchange.rb', line 22 def x(x) eval(x) ? " X" : "" end |