Roll  Roll::Metadata

[Validate]
Generated with WebRI Redfish 1.2.1

Metadata

Attributes

location[R]

TODO: hide most methods

Public Class Methods

new(location) click to toggle source
    # File lib/roll/metadata.rb, line 13
13:     def initialize(location)
14:       @location = location
15:       @cache = {}
16:     end

Public Instance Methods

active() click to toggle source

Get library active state.

    # File lib/roll/metadata.rb, line 33
33:     def active
34:       return @cache[:active] if @cache.key?(:active)
35:       @cache[:active] = (
36:         case read(:active).to_s.downcase
37:         when 'false', 'no'
38:           false
39:         else
40:           true
41:         end
42:       )
43:     end
loadpath() click to toggle source

Get library loadpath.

    # File lib/roll/metadata.rb, line 54
54:     def loadpath
55:       @cache[:loadpath] ||= (
56:         val = read(:loadpath).to_s.strip.split(/\s*\n/)  # TODO: handle YAML
57:         val = ['lib'] if val.empty?
58:         val
59:       )
60:     end
method_missing(name, *args) click to toggle source
    # File lib/roll/metadata.rb, line 76
76:     def method_missing(name, *args)
77:       if @cache.key?(name)
78:         @cache[name]
79:       else
80:         @cache[name] = read(name)
81:       end
82:     end
name() click to toggle source

Get library name.

    # File lib/roll/metadata.rb, line 19
19:     def name
20:       @cache[:name] ||= read('name')
21:     end
released() click to toggle source

Get library release date.

    # File lib/roll/metadata.rb, line 49
49:     def released
50:       @cache[:released] ||= read(:released) || "1900-01-01"
51:     end
requires() click to toggle source
    # File lib/roll/metadata.rb, line 63
63:     def requires
64:       @cache[:requires] ||= (
65:         if entry = read(:requires)
66:           entry.strip.split("\n").map do |line|
67:             line.strip.split(/\s+/)
68:           end
69:         else
70:           []
71:         end
72:       )
73:     end
version() click to toggle source

Get library version.

    # File lib/roll/metadata.rb, line 28
28:     def version
29:       @cache[:version] ||= Version.new(read(:version))
30:     end

Private Instance Methods

read(name) click to toggle source
     # File lib/roll/metadata.rb, line 87
 87:     def read(name)
 88:       file = Dir[File.join(location, "{meta,.meta}", name.to_s)].first
 89:       if file
 90:         text = File.read(file)
 91:         if text =~ /^---/
 92:           require_yaml
 93:           YAML.load(text)
 94:         else
 95:           text.strip
 96:         end
 97:       else
 98:         nil
 99:       end
100:     end
require_yaml() click to toggle source
     # File lib/roll/metadata.rb, line 103
103:     def require_yaml
104:       @require_yaml ||=(
105:         require 'yaml'
106:         true
107:       )
108:     end

Disabled; run with --debug to generate this.