Class: Ablab::Group
- Inherits:
-
Object
- Object
- Ablab::Group
- Defined in:
- lib/ablab.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Class Method Summary collapse
Instance Method Summary collapse
- #==(o) ⇒ Object
- #control? ⇒ Boolean
- #eql? ⇒ Object
- #experimental? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, description = nil, weight = nil) ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize(name, description = nil, weight = nil) ⇒ Group
Returns a new instance of Group.
206 207 208 209 |
# File 'lib/ablab.rb', line 206 def initialize(name, description = nil, weight = nil) @name, @description = name.to_sym, description @weight = weight || 1 end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
204 205 206 |
# File 'lib/ablab.rb', line 204 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
204 205 206 |
# File 'lib/ablab.rb', line 204 def name @name end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
204 205 206 |
# File 'lib/ablab.rb', line 204 def weight @weight end |
Class Method Details
.control ⇒ Object
235 236 237 |
# File 'lib/ablab.rb', line 235 def self.control new(:control, 'control group') end |
Instance Method Details
#==(o) ⇒ Object
219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/ablab.rb', line 219 def ==(o) if o.is_a?(Symbol) name == o elsif o.is_a?(String) name.to_s == o elsif o.is_a?(self.class) name == o.name && description == o.description else false end end |
#control? ⇒ Boolean
211 212 213 |
# File 'lib/ablab.rb', line 211 def control? name == :control end |
#eql? ⇒ Object
205 |
# File 'lib/ablab.rb', line 205 alias_method :eql?, :== |
#experimental? ⇒ Boolean
215 216 217 |
# File 'lib/ablab.rb', line 215 def experimental? !control? end |
#hash ⇒ Object
231 232 233 |
# File 'lib/ablab.rb', line 231 def hash name.hash end |