Class: Rebundler::GemDeclaration
- Inherits:
-
Object
- Object
- Rebundler::GemDeclaration
- Includes:
- Comparable
- Defined in:
- lib/rebundler/gem_declaration.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(node: nil) ⇒ GemDeclaration
constructor
A new instance of GemDeclaration.
- #name ⇒ Object
- #normalized_name ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(node: nil) ⇒ GemDeclaration
Returns a new instance of GemDeclaration.
9 10 11 |
# File 'lib/rebundler/gem_declaration.rb', line 9 def initialize(node: nil) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
7 8 9 |
# File 'lib/rebundler/gem_declaration.rb', line 7 def node @node end |
Instance Method Details
#<=>(other) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/rebundler/gem_declaration.rb', line 28 def <=>(other) unless other.is_a?(GemDeclaration) raise ArgumentError, "comparison of GemDeclaration with #{other.class} failed" end normalized_name <=> other.normalized_name end |
#name ⇒ Object
13 |
# File 'lib/rebundler/gem_declaration.rb', line 13 def name = @node.arguments.child_nodes[0].content |
#normalized_name ⇒ Object
14 |
# File 'lib/rebundler/gem_declaration.rb', line 14 def normalized_name = name.tr("-_", "").downcase |
#summary ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rebundler/gem_declaration.rb', line 16 def summary gem = find_loaded_gem || find_external_gem return if gem.nil? if gem.summary.nil? || gem.summary == "" gem.description else gem.summary end end |