exif.rb
# Generate instance variables name for each kind of info available in the picture
Generate instance variables name for each kind of info available in the picture
Generate instance variables name for each kind of info available in the picture
def gen_instance_variables
      def infos
        @@DATA.keys.map{|c| (c.downcase+"?").to_sym}
      end
      dk = @@DATA.keys.map{|c| c.downcase}
      (KNOWN_META - dk).map{|k|
        self.class.instance_eval {
          define_method(("%s?" % k).to_sym) do
            nil
          end
        }
      }
      (KNOWN_META & dk).map{|k|
        instance_variable_set("@#{k}", Object.const_get(k.capitalize).new(@@DATA[k.upcase]))
          self.class.instance_eval {
            define_method(("%s?" % k).to_sym) do
              true
            end
          }
        }
    end
def gen_instance_variables def infos @@DATA . keys . map { | c | ( c . downcase + "?" ) . to_sym } end dk = @@DATA . keys . map { | c | c . downcase } ( KNOWN_META - dk ) . map { | k | self . class . instance_eval { define_method ( ( "%s?" % k ) . to_sym ) do nil end } } ( KNOWN_META & dk ) . map { | k | instance_variable_set ( "@#{k}" , Object . const_get ( k . capitalize ) . new ( @@DATA [ k . upcase ] ) ) self . class . instance_eval { define_method ( ( "%s?" % k ) . to_sym ) do true end } } end
Generate instance variables name for each kind of info available in the picture
Generate instance variables name for each kind of info available in the picture
# unavailable methods will return nil # available methods will return what they supposed to return