Sha256: 76b77f94cdf0da8d2cfa9b634681a08a282e97c4d6412b29ff9fee195ef0f657

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

module CephStorage
  # Factory Class to create a Cluster reference object
  class ClusterFactory < ::CephRuby::Cluster
    # Defaults
    CONFIG_DIR = '/etc/ceph'.freeze
    CLUSTER = 'ceph'.freeze
    USER = 'client.admin'.freeze
    FLAGS = 0
    class << self
      # Create a factory method for creating Cluster Objects
      def build(config_dir: CONFIG_DIR, cluster: CLUSTER,
                user: USER, flags: FLAGS)
        c = Cluster.new(cluster: cluster, config_dir: config_dir,
                        user: user, flags: flags)
        yield(c) if block_given?
        c
      end

      # Make this private otherwise the self.new {} returns a different
      # Object to self.new {CONFIG_DIR, CLUSTER, USER}
      private :new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ceph_storage-0.1.0 lib/ceph_storage/cluster_factory.rb