Class: FFProbe::Entity
- Inherits:
-
Object
- Object
- FFProbe::Entity
- Defined in:
- lib/ffprobe/entity.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#units ⇒ Object
Returns the value of attribute units.
Class Method Summary collapse
Instance Method Summary collapse
-
#units? ⇒ Object
Returns the value of attribute units.
Instance Attribute Details
#units ⇒ Object
Returns the value of attribute units.
11 12 13 |
# File 'lib/ffprobe/entity.rb', line 11 def units @units end |
Class Method Details
.from_hash(hash, units = false) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/ffprobe/entity.rb', line 4 def self.from_hash(hash,units=false) target = new target.units = units hash.each {|k,v| target.__send__("#{k}=", v) } target end |
.units(mapping) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ffprobe/entity.rb', line 14 def self.units(mapping) mapping.each do |property,unit| self.class_eval " def \#{property}=(val)\n if units?\n if val.nil?\n @\#{property} = nil\n else\n @\#{property} = Unit.new(\"\\\#{val} \#{unit}\")\n end\n else\n @\#{property} = val\n end\n end\n EOF\n end\nend\n" |
Instance Method Details
#units? ⇒ Object
Returns the value of attribute units.
12 13 14 |
# File 'lib/ffprobe/entity.rb', line 12 def units @units end |