Class: VimGet::Script
- Inherits:
-
Object
- Object
- VimGet::Script
- Defined in:
- lib/vimget/script.rb
Overview
< Hash?
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#download ⇒ Object
Returns the value of attribute download.
-
#installed ⇒ Object
Returns the value of attribute installed.
-
#manifest ⇒ Object
Returns the value of attribute manifest.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sid ⇒ Object
readonly
Returns the value of attribute sid.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(id, name = "", author = "", version = "", installed = "", download = "", manifest = []) ⇒ Script
constructor
A new instance of Script.
- #installed? ⇒ Boolean
- #outdated? ⇒ Boolean
- #to_s ⇒ Object
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="", ="", version="", installed="", download="", manifest=[]) @sid = id @name = name @author = @version = version @installed = installed @download = download @manifest = manifest end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
17 18 19 |
# File 'lib/vimget/script.rb', line 17 def @author end |
#download ⇒ Object
Returns the value of attribute download.
17 18 19 |
# File 'lib/vimget/script.rb', line 17 def download @download end |
#installed ⇒ Object
Returns the value of attribute installed.
17 18 19 |
# File 'lib/vimget/script.rb', line 17 def installed @installed end |
#manifest ⇒ Object
Returns the value of attribute manifest.
17 18 19 |
# File 'lib/vimget/script.rb', line 17 def manifest @manifest end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/vimget/script.rb', line 16 def name @name end |
#sid ⇒ Object (readonly)
Returns the value of attribute sid.
16 17 18 |
# File 'lib/vimget/script.rb', line 16 def sid @sid end |
#version ⇒ Object
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
51 52 53 |
# File 'lib/vimget/script.rb', line 51 def installed? return !installed.empty? end |
#outdated? ⇒ 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_s ⇒ Object
34 35 36 37 |
# File 'lib/vimget/script.rb', line 34 def to_s "#{@name}(#{@sid}): #{@version} <= #{@installed}\n" + "By: #{@author} from #{@download}" end |