class Buildkite::Builder::Data
Public Class Methods
new()
click to toggle source
# File lib/buildkite/builder/data.rb, line 4 def initialize @data = Hash.new end
Public Instance Methods
to_definition()
click to toggle source
# File lib/buildkite/builder/data.rb, line 8 def to_definition @data.each_with_object({}) do |(key, value), hash| value = value.respond_to?(:to_definition) ? value.to_definition : value next if value.empty? hash[key] = value end end
Private Instance Methods
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/buildkite/builder/data.rb, line 20 def method_missing(name, *args, &block) if name.end_with?('=') name = name.to_s.delete_suffix('=').to_sym if respond_to_missing?(name) raise ArgumentError, "Data already contains key '#{name}'" else return @data[name] = args.first end elsif respond_to_missing?(name) return @data[name] end super end
respond_to_missing?(name, *)
click to toggle source
# File lib/buildkite/builder/data.rb, line 36 def respond_to_missing?(name, *) @data.key?(name) end