Sha256: a941153456ae0e73a9369d546c554cd17ad6753b52750349949b3af611e70953

Contents?: true

Size: 719 Bytes

Versions: 12

Compression:

Stored size: 719 Bytes

Contents

module OpenX
  class Image
    include XMLRPC::Marshallable
    attr_accessor :filename, :content, :editswf

    def initialize(hash_or_file)
      @editswf = 0
      if hash_or_file.is_a?(File)
        @filename = File.basename(hash_or_file.path)
        @editswf = File.basename(@filename, '.swf') == @filename ? 0 : 1
        @content  = XMLRPC::Base64.new(hash_or_file.read)
      else
        raise ArgumentError unless hash_or_file.key?(:filename)
        raise ArgumentError unless hash_or_file.key?(:content)
        hash_or_file.each { |k,v| send(:"#{k}=", v) }
        unless self.content.is_a?(XMLRPC::Base64)
          self.content = XMLRPC::Base64.new(self.content)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 6 rubygems

Version Path
spiceworks-openx-1.0.0 lib/openx/image.rb
krakatoa-openx-1.9.4 lib/openx/image.rb
bsm-openx-1.9.4 lib/openx/image.rb
bsm-openx-1.9.3 lib/openx/image.rb
bsm-openx-1.9.2 lib/openx/image.rb
bsm-openx-1.9.1 lib/openx/image.rb
jjp-openx-1.1.6 lib/openx/image.rb
jjp-openx-1.1.4 lib/openx/image.rb
touchlocal-openx-1.1.2 lib/openx/image.rb
touchlocal-openx-1.1.1 lib/openx/image.rb
touchlocal-openx-1.1.0 lib/openx/image.rb
openx-1.0.0 lib/openx/image.rb