Sha256: a438b844a4f89d0ef5c9beeec4d9d909db31a259d8a1b220a625e754a8a46c82

Contents?: true

Size: 582 Bytes

Versions: 23

Compression:

Stored size: 582 Bytes

Contents

require 'ostruct'
require 'dragonfly/has_filename'
require 'dragonfly/utils'

module Dragonfly
  class UrlAttributes < OpenStruct
    include HasFilename # Updating ext / basename also updates the name

    def empty?
      @table.reject{|k, v| v.nil? }.empty?
    end

    # Hack so we can use .send('format') and it not call the private Kernel method
    def format
      @table[:format]
    end

    def extract(keys)
      keys.inject({}) do |attrs, key|
        value = send(key)
        attrs[key] = value unless Utils.blank?(value)
        attrs
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
dragonfly-1.4.0 lib/dragonfly/url_attributes.rb
dragonfly-1.3.0 lib/dragonfly/url_attributes.rb
dragonfly-1.2.1 lib/dragonfly/url_attributes.rb
dragonfly-1.2.0 lib/dragonfly/url_attributes.rb
dragonfly-1.1.5 lib/dragonfly/url_attributes.rb
dragonfly-1.1.4 lib/dragonfly/url_attributes.rb
dragonfly-1.1.3 lib/dragonfly/url_attributes.rb
dragonfly-1.1.2 lib/dragonfly/url_attributes.rb
dragonfly-1.1.1 lib/dragonfly/url_attributes.rb
dragonfly-1.1.0 lib/dragonfly/url_attributes.rb
dragonfly-1.0.12 lib/dragonfly/url_attributes.rb
dragonfly-1.0.11 lib/dragonfly/url_attributes.rb
dragonfly-1.0.10 lib/dragonfly/url_attributes.rb
dragonfly-1.0.9 lib/dragonfly/url_attributes.rb
dragonfly-1.0.8 lib/dragonfly/url_attributes.rb
dragonfly-1.0.7 lib/dragonfly/url_attributes.rb
dragonfly-1.0.6 lib/dragonfly/url_attributes.rb
dragonfly-1.0.5 lib/dragonfly/url_attributes.rb
dragonfly-1.0.4 lib/dragonfly/url_attributes.rb
dragonfly-1.0.3 lib/dragonfly/url_attributes.rb