Class: Mack::Utils::GemManager::GemObject

Inherits:
Object
  • Object
show all
Defined in:
lib/mack/utils/gem_manager.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ GemObject

Returns a new instance of GemObject.



71
72
73
74
75
76
77
# File 'lib/mack/utils/gem_manager.rb', line 71

def initialize(name, options = {})
  self.name = name
  self.version = options[:version]
  self.libs = [options[:libs]].flatten.compact
  self.tasks = [options[:tasks], "#{name}_tasks"].flatten.compact
  self.source = options[:source]
end

Instance Attribute Details

#libsObject

Returns the value of attribute libs.



67
68
69
# File 'lib/mack/utils/gem_manager.rb', line 67

def libs
  @libs
end

#nameObject

Returns the value of attribute name.



65
66
67
# File 'lib/mack/utils/gem_manager.rb', line 65

def name
  @name
end

#sourceObject

Returns the value of attribute source.



69
70
71
# File 'lib/mack/utils/gem_manager.rb', line 69

def source
  @source
end

#tasksObject

Returns the value of attribute tasks.



68
69
70
# File 'lib/mack/utils/gem_manager.rb', line 68

def tasks
  @tasks
end

#versionObject

Returns the value of attribute version.



66
67
68
# File 'lib/mack/utils/gem_manager.rb', line 66

def version
  @version
end

Instance Method Details

#libs?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/mack/utils/gem_manager.rb', line 85

def libs?
  self.libs.any?
end

#source?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/mack/utils/gem_manager.rb', line 93

def source?
  !self.source.blank?
end

#tasks?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/mack/utils/gem_manager.rb', line 97

def tasks?
  self.tasks.any?
end

#to_sObject



79
80
81
82
83
# File 'lib/mack/utils/gem_manager.rb', line 79

def to_s
  t = self.name.to_s
  t << "-#{self.version}" if self.version?
  t.downcase
end

#version?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/mack/utils/gem_manager.rb', line 89

def version?
  !self.version.blank?
end