Class: Plistr::Value
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(name) ⇒ Value
constructor
A new instance of Value.
- #parse ⇒ Object
Constructor Details
#initialize(name) ⇒ Value
Returns a new instance of Value.
57 58 59 60 |
# File 'lib/plistr.rb', line 57 def initialize(name) @name = name @text = "" end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
55 56 57 |
# File 'lib/plistr.rb', line 55 def name @name end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
55 56 57 |
# File 'lib/plistr.rb', line 55 def text @text end |
Instance Method Details
#parse ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/plistr.rb', line 62 def parse case @name when "string" @text when "real" @text.to_f when "integer" @text.to_i when "date" DateTime.parse(@text) when "data" Base64.decode64(@text.gsub(/\s/, '')) when "key" @text end end |