Class: RgGen::Core::Builder::PluginInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/core/builder/plugin_manager.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gemnameObject (readonly)

Returns the value of attribute gemname.



10
11
12
# File 'lib/rggen/core/builder/plugin_manager.rb', line 10

def gemname
  @gemname
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/rggen/core/builder/plugin_manager.rb', line 9

def path
  @path
end

#versionObject (readonly)

Returns the value of attribute version.



11
12
13
# File 'lib/rggen/core/builder/plugin_manager.rb', line 11

def version
  @version
end

Class Method Details

.parse(path_or_name, version) ⇒ Object



13
14
15
16
17
# File 'lib/rggen/core/builder/plugin_manager.rb', line 13

def self.parse(path_or_name, version)
  info = new
  info.parse(path_or_name.to_s.strip, version)
  info
end

Instance Method Details

#parse(path_or_name, version) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rggen/core/builder/plugin_manager.rb', line 19

def parse(path_or_name, version)
  @name, @path, @gemname, @version =
    if path_or_name == DEFAULT_PLUGSINS || plugin_path?(path_or_name)
      [nil, path_or_name]
    else
      [
        path_or_name, get_plugin_path(path_or_name),
        get_gemname(path_or_name), version
      ]
    end
end

#to_sObject



31
32
33
34
35
36
37
38
39
# File 'lib/rggen/core/builder/plugin_manager.rb', line 31

def to_s
  if @name && @version
    "#{@name} (#{@version})"
  elsif @name
    @name
  else
    @path
  end
end