lib/pudl/property_types.rb
# Define a DSL property that accepts two arguments,
# a key and a value, or one argument and a block
Define a DSL property that accepts two arguments,
a key and a value, or one argument and a block
Define a DSL property that accepts two arguments a key and a value or one argument and a block
def property_keyval name, &block
        send :define_method, name do |k, v=nil, &b|
          if !v.nil? && !b.nil?
            raise ArgumentError, "Cannot specify a value and a block in a keyval property"
          end
          if !k.is_a? Symbol
            raise ArgumentError, "Key must be a symbol in a keyval property"
          end
          v = b if v.nil?
          instance_exec k, v, &block
        end
      end
def property_keyval name , & block send :define_method , name do | k , v = nil , & b | if ! v . nil? && ! b . nil? raise ArgumentError , "Cannot specify a value and a block in a keyval property" end if ! k . is_a? Symbol raise ArgumentError , "Key must be a symbol in a keyval property" end v = b if v . nil? instance_exec k , v , & block end end
Define a DSL property that accepts two arguments,
a key and a value, or one argument and a block
Define a DSL property that accepts two arguments a key and a value or one argument and a block
name
<not_specific>
block
<not_specific>