Class: VimGet::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/vimget/script.rb

Overview

< Hash?

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name = "", author = "", version = "", installed = "", download = "", manifest = []) ⇒ Script

Returns a new instance of Script.



19
20
21
22
23
24
25
26
27
28
# File 'lib/vimget/script.rb', line 19

def initialize(id, name="", author="", version="", installed="", download="",
  manifest=[])
  @sid = id
  @name = name
  @author = author
  @version = version
  @installed = installed
  @download = download
  @manifest = manifest
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



17
18
19
# File 'lib/vimget/script.rb', line 17

def author
  @author
end

#downloadObject

Returns the value of attribute download.



17
18
19
# File 'lib/vimget/script.rb', line 17

def download
  @download
end

#installedObject

Returns the value of attribute installed.



17
18
19
# File 'lib/vimget/script.rb', line 17

def installed
  @installed
end

#manifestObject

Returns the value of attribute manifest.



17
18
19
# File 'lib/vimget/script.rb', line 17

def manifest
  @manifest
end

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/vimget/script.rb', line 16

def name
  @name
end

#sidObject (readonly)

Returns the value of attribute sid.



16
17
18
# File 'lib/vimget/script.rb', line 16

def sid
  @sid
end

#versionObject

Returns the value of attribute version.



17
18
19
# File 'lib/vimget/script.rb', line 17

def version
  @version
end

Instance Method Details

#[](key) ⇒ Object



30
31
32
# File 'lib/vimget/script.rb', line 30

def [](key)
  # act as a hash 
end

#installed?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/vimget/script.rb', line 51

def installed?
  return !installed.empty?
end

#outdated?Boolean

Returns:

  • (Boolean)


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vimget/script.rb', line 39

def outdated?
  if @installed.empty?
    false
  elsif @installed.to_f < @version.to_f
    true
  elsif @installed < @version
    true
  else
    false
  end
end

#to_sObject



34
35
36
37
# File 'lib/vimget/script.rb', line 34

def to_s
  "#{@name}(#{@sid}): #{@version} <= #{@installed}\n" +
  "By: #{@author} from #{@download}"
end