Module: Pipeline::SymbolAttribute::ClassMethods

Defined in:
lib/pipeline/core_ext/symbol_attribute.rb

Instance Method Summary collapse

Instance Method Details

#symbol_attrs(*attributes) ⇒ Object Also known as: symbol_attr



8
9
10
11
12
13
14
15
16
# File 'lib/pipeline/core_ext/symbol_attribute.rb', line 8

def symbol_attrs(*attributes)
  attributes.each do |attribute|
    class_eval <<-EOD
      def #{attribute.to_s}
        read_attribute('#{attribute.to_s}').to_sym rescue nil
      end
    EOD
  end
end