Class: Rebundler::GemSet
- Inherits:
-
Object
- Object
- Rebundler::GemSet
- Includes:
- Comparable
- Defined in:
- lib/rebundler/gem_set.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#gems ⇒ Object
readonly
Returns the value of attribute gems.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(name: nil, node: nil, default: false) ⇒ GemSet
constructor
A new instance of GemSet.
Constructor Details
#initialize(name: nil, node: nil, default: false) ⇒ GemSet
Returns a new instance of GemSet.
9 10 11 12 13 14 15 16 |
# File 'lib/rebundler/gem_set.rb', line 9 def initialize(name: nil, node: nil, default: false) @name = name @node = node @default = default @plugins = [] @gems = [] end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
7 8 9 |
# File 'lib/rebundler/gem_set.rb', line 7 def default @default end |
#gems ⇒ Object (readonly)
Returns the value of attribute gems.
7 8 9 |
# File 'lib/rebundler/gem_set.rb', line 7 def gems @gems end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/rebundler/gem_set.rb', line 7 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
7 8 9 |
# File 'lib/rebundler/gem_set.rb', line 7 def node @node end |
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
7 8 9 |
# File 'lib/rebundler/gem_set.rb', line 7 def plugins @plugins end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rebundler/gem_set.rb', line 18 def <=>(other) unless other.is_a?(GemSet) raise ArgumentError, "comparison of GemSet with #{other.class} failed" end # Default first, then sort by name [default ? 0 : 1, name.to_s] <=> [other.default ? 0 : 1, other.name.to_s] end |
#==(other) ⇒ Object
28 29 30 |
# File 'lib/rebundler/gem_set.rb', line 28 def ==(other) other.is_a?(GemSet) && other.name == name && other.default == default end |