Class: SDM::Memcached

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, port: nil) ⇒ Memcached

Returns a new instance of Memcached.



1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
# File 'lib/models/porcelain.rb', line 1825

def initialize(
  id: nil,
  name: nil,
  healthy: nil,
  hostname: nil,
  port_override: 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 port != nil
    @port = port
  end
end

Instance Attribute Details

#healthyObject

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



1817
1818
1819
# File 'lib/models/porcelain.rb', line 1817

def healthy
  @healthy
end

#hostnameObject

Returns the value of attribute hostname.



1819
1820
1821
# File 'lib/models/porcelain.rb', line 1819

def hostname
  @hostname
end

#idObject

Unique identifier of the Resource.



1813
1814
1815
# File 'lib/models/porcelain.rb', line 1813

def id
  @id
end

#nameObject

Unique human-readable name of the Resource.



1815
1816
1817
# File 'lib/models/porcelain.rb', line 1815

def name
  @name
end

#portObject

Returns the value of attribute port.



1823
1824
1825
# File 'lib/models/porcelain.rb', line 1823

def port
  @port
end

#port_overrideObject

Returns the value of attribute port_override.



1821
1822
1823
# File 'lib/models/porcelain.rb', line 1821

def port_override
  @port_override
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1853
1854
1855
1856
1857
1858
1859
# File 'lib/models/porcelain.rb', line 1853

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