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.



1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
# File 'lib/models/porcelain.rb', line 1831

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.



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

def healthy
  @healthy
end

#hostnameObject

Returns the value of attribute hostname.



1825
1826
1827
# File 'lib/models/porcelain.rb', line 1825

def hostname
  @hostname
end

#idObject

Unique identifier of the Resource.



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

def id
  @id
end

#nameObject

Unique human-readable name of the Resource.



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

def name
  @name
end

#portObject

Returns the value of attribute port.



1829
1830
1831
# File 'lib/models/porcelain.rb', line 1829

def port
  @port
end

#port_overrideObject

Returns the value of attribute port_override.



1827
1828
1829
# File 'lib/models/porcelain.rb', line 1827

def port_override
  @port_override
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1859
1860
1861
1862
1863
1864
1865
# File 'lib/models/porcelain.rb', line 1859

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