class Vcard
Attributes
version[RW]
Public Class Methods
blank(version)
click to toggle source
# File lib/vcard.rb, line 8 def blank(version) new VERSION: { value: version } end
decode(vcard_str, version = nil)
click to toggle source
# File lib/vcard.rb, line 12 def decode(vcard_str, version = nil) version_str = version.nil? ? "4.0" : /\nVERSION:([^\n\r]+)/i.match(vcard_str)[1] blank(version_str).parse(vcard_str) end
new(version)
click to toggle source
Calls superclass method
Component::new
# File lib/vcard.rb, line 31 def initialize(version) self.version = version super VCARD: { VERSION: { value: version } } end
parse(vcf, version, strict)
click to toggle source
# File lib/vcard.rb, line 17 def parse(vcf, version, strict) hash = version == "3.0" ? Vcard::V3_0::Component.parse(vcf, strict) : Vcard::V4_0::Component.parse(vcf, strict) # comp_name = hash.keys.first # return self.new(comp_name, hash[:vobject][comp_name], hash[:errors] ) hash end
Private Class Methods
raise_invalid_parsing()
click to toggle source
# File lib/vcard.rb, line 26 def raise_invalid_parsing raise "vCard parse failed" end
Private Instance Methods
component_base_class()
click to toggle source
# File lib/vcard.rb, line 47 def component_base_class version == "3.0" ? Vcard::V3_0::Component : Vcard::V4_0::Component # version_class.const_get(:Component) end
name()
click to toggle source
# File lib/vcard.rb, line 38 def name :VCARD end
property_base_class()
click to toggle source
# File lib/vcard.rb, line 42 def property_base_class version == "3.0" ? Vcard::V3_0::Property : Vcard::V4_0::Property # version_class.const_get(:Property) end