lib/pudl/property_types.rb
# Define a DSL property that receives a value, either
# into a context key or a block. Only symbols and blocks
# are permissible here.
Define a DSL property that receives a value, either
into a context key or a block. Only symbols and blocks
are permissible here.
Define a DSL property that receives a value either into a context key or a block . Only symbols and blocks are permissible here .
def property_out name, &block
        send :define_method, name do |v=nil, &b|
          if !v.nil? && !b.nil?
            raise ArgumentError, "Cannot specify a key and a block in an out property"
          end
          if v.nil? && b.nil?
            raise ArgumentError, "Must specify a symbol or a block in an out property"
          end
          if v && !v.is_a?(Symbol)
            raise ArgumentError, "Only symbols and blocks allowed for out property"
          end
          v = b if v.nil?
          instance_exec v, &block
        end
      end
def property_out name , & block send :define_method , name do | v = nil , & b | if ! v . nil? && ! b . nil? raise ArgumentError , "Cannot specify a key and a block in an out property" end if v . nil? && b . nil? raise ArgumentError , "Must specify a symbol or a block in an out property" end if v && ! v . is_a? ( Symbol ) raise ArgumentError , "Only symbols and blocks allowed for out property" end v = b if v . nil? instance_exec v , & block end end
Define a DSL property that receives a value, either
into a context key or a block.
Define a DSL property that receives a value either into a context key or a block .
name
<not_specific>
block
<not_specific>