Class: BarkestCore::SelfUpdateConfig

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, ActiveModel::Validations
Defined in:
app/models/barkest_core/self_update_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host.



6
7
8
# File 'app/models/barkest_core/self_update_config.rb', line 6

def host
  @host
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'app/models/barkest_core/self_update_config.rb', line 6

def password
  @password
end

#portObject



22
23
24
25
26
# File 'app/models/barkest_core/self_update_config.rb', line 22

def port
  @port ||= 22
  val = @port.to_s.to_i
  (1...65536).include?(val) ? val : 22
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'app/models/barkest_core/self_update_config.rb', line 6

def user
  @user
end

Class Method Details

.loadObject



32
33
34
# File 'app/models/barkest_core/self_update_config.rb', line 32

def SelfUpdateConfig.load
  SelfUpdateConfig.new SystemConfig.get(:self_update)
end

Instance Method Details

#saveObject



28
29
30
# File 'app/models/barkest_core/self_update_config.rb', line 28

def save
  SystemConfig.set :self_update, to_h, true
end

#to_hObject



13
14
15
16
17
18
19
20
# File 'app/models/barkest_core/self_update_config.rb', line 13

def to_h
  {
      host: host.to_s,
      port: port,
      user: user.to_s,
      password: password.to_s,
  }
end