Class: OsCtld::Repository::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/osctld/repository/template.rb

Constant Summary collapse

ATTRS =
%i(vendor variant arch distribution version tags)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Template

Returns a new instance of Template

Parameters:

  • attrs (Hash)


7
8
9
10
11
12
13
# File 'lib/osctld/repository/template.rb', line 7

def initialize(attrs)
  ATTRS.each do |attr|
    instance_variable_set("@#{attr}", attrs[attr])
  end

  @cached = attrs[:cached].any?
end

Instance Attribute Details

#archObject (readonly)

Returns the value of attribute arch



4
5
6
# File 'lib/osctld/repository/template.rb', line 4

def arch
  @arch
end

#distributionObject (readonly)

Returns the value of attribute distribution



4
5
6
# File 'lib/osctld/repository/template.rb', line 4

def distribution
  @distribution
end

#tagsObject (readonly)

Returns the value of attribute tags



4
5
6
# File 'lib/osctld/repository/template.rb', line 4

def tags
  @tags
end

#variantObject (readonly)

Returns the value of attribute variant



4
5
6
# File 'lib/osctld/repository/template.rb', line 4

def variant
  @variant
end

#vendorObject (readonly)

Returns the value of attribute vendor



4
5
6
# File 'lib/osctld/repository/template.rb', line 4

def vendor
  @vendor
end

#versionObject (readonly)

Returns the value of attribute version



4
5
6
# File 'lib/osctld/repository/template.rb', line 4

def version
  @version
end

Instance Method Details

#cached?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/osctld/repository/template.rb', line 15

def cached?
  @cached
end

#dumpObject



19
20
21
22
23
24
# File 'lib/osctld/repository/template.rb', line 19

def dump
  ret = {}
  ATTRS.each { |attr| ret[attr] = send(attr) }
  ret[:cached] = cached?
  ret
end