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