class DkComposer::Volume

Attributes

fields[RW]
name[RW]

Public Class Methods

create(name,*params, **opts, &block) click to toggle source
# File lib/dkcomposer/volume.rb, line 39
def self.create(name,*params, **opts, &block)
  ret = new(name)
  ret.config(opts)
  ret.instance_exec(*params,&block) if block
  ret
end
new(name) click to toggle source
# File lib/dkcomposer/volume.rb, line 7
def initialize(name)
  @name = name
  @fields={}
end

Public Instance Methods

dump()
Alias for: to_s
to_h() click to toggle source
# File lib/dkcomposer/volume.rb, line 12
def to_h
  ret={}
  ret.merge!(@fields)
  ret={"#{name}":ret}
  ret.stringfy_key.stringfy_bool_value
end
to_s() click to toggle source
# File lib/dkcomposer/volume.rb, line 19
  def to_s
    ret= if @fields.empty?
      "volume :#{name}"
    else
    <<-DUMP
      volume(:#{name}) do
        #{
        fields.map do |(k,v)|
          v=v.to_quote_s if v.is_a?(String)
          v=v.map{|a| "'#{a}'"}.join(",") if v.is_a?(Array)
          "#{k} #{v.to_s}"
        end.join("\n")
        }
     end
    DUMP
  end
    ret
  end
Also aliased as: dump