Class: Schaltroom::Repository

Inherits:
Hash
  • Object
show all
Defined in:
lib/schaltroom/repository.rb

Overview

features class for Schaltroom

Instance Method Summary collapse

Instance Method Details

#add_feature(name, type, value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/schaltroom/repository.rb', line 6

def add_feature(name, type, value)
  sym = name.is_a?(Symbol) ? name : name.to_s.to_sym
  if type == :boolean
    self[sym] = { type: :boolean, value: value }
  elsif type == :version
    self[sym] = { type: :version, value: value }
  else
    raise Exception, "unknown type: #{type.to_sym}"
  end
end

#add_gem(gem) ⇒ Object



17
18
19
# File 'lib/schaltroom/repository.rb', line 17

def add_gem(gem)
  add_feature(gem.to_s.to_sym, :version, gem::VERSION::STRING)
end