Class: SDM::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, name: nil, healthy: nil, hostname: nil, port_override: nil, password: nil, port: nil) ⇒ Redis

Returns a new instance of Redis.



3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
# File 'lib/models/porcelain.rb', line 3141

def initialize(
  id: nil,
  name: nil,
  healthy: nil,
  hostname: nil,
  port_override: nil,
  password: nil,
  port: nil
)
  if id != nil
    @id = id
  end
  if name != nil
    @name = name
  end
  if healthy != nil
    @healthy = healthy
  end
  if hostname != nil
    @hostname = hostname
  end
  if port_override != nil
    @port_override = port_override
  end
  if password != nil
    @password = password
  end
  if port != nil
    @port = port
  end
end

Instance Attribute Details

#healthyObject

True if the datasource is reachable and the credentials are valid.



3131
3132
3133
# File 'lib/models/porcelain.rb', line 3131

def healthy
  @healthy
end

#hostnameObject

Returns the value of attribute hostname.



3133
3134
3135
# File 'lib/models/porcelain.rb', line 3133

def hostname
  @hostname
end

#idObject

Unique identifier of the Resource.



3127
3128
3129
# File 'lib/models/porcelain.rb', line 3127

def id
  @id
end

#nameObject

Unique human-readable name of the Resource.



3129
3130
3131
# File 'lib/models/porcelain.rb', line 3129

def name
  @name
end

#passwordObject

Returns the value of attribute password.



3137
3138
3139
# File 'lib/models/porcelain.rb', line 3137

def password
  @password
end

#portObject

Returns the value of attribute port.



3139
3140
3141
# File 'lib/models/porcelain.rb', line 3139

def port
  @port
end

#port_overrideObject

Returns the value of attribute port_override.



3135
3136
3137
# File 'lib/models/porcelain.rb', line 3135

def port_override
  @port_override
end

Instance Method Details

#to_json(options = {}) ⇒ Object



3173
3174
3175
3176
3177
3178
3179
# File 'lib/models/porcelain.rb', line 3173

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end