Class: OpenX::Image
- Inherits:
-
Object
- Object
- OpenX::Image
- Includes:
- XMLRPC::Marshallable
- Defined in:
- lib/openx/image.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#editswf ⇒ Object
Returns the value of attribute editswf.
-
#filename ⇒ Object
Returns the value of attribute filename.
Instance Method Summary collapse
-
#initialize(hash_or_file) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(hash_or_file) ⇒ Image
Returns a new instance of Image.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/openx/image.rb', line 6 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 |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/openx/image.rb', line 4 def content @content end |
#editswf ⇒ Object
Returns the value of attribute editswf.
4 5 6 |
# File 'lib/openx/image.rb', line 4 def editswf @editswf end |
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'lib/openx/image.rb', line 4 def filename @filename end |