Class: Vobject::Property
- Inherits:
-
Object
- Object
- Vobject::Property
- Defined in:
- lib/vobject/property.rb
Constant Summary collapse
- MAX_LINE_WIDTH =
75
Instance Attribute Summary collapse
-
#group ⇒ Object
Returns the value of attribute group.
-
#params ⇒ Object
Returns the value of attribute params.
-
#prop_name ⇒ Object
Returns the value of attribute prop_name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, options) ⇒ Property
constructor
A new instance of Property.
- #to_s ⇒ Object
Constructor Details
#initialize(key, options) ⇒ Property
Returns a new instance of Property.
9 10 11 12 13 14 15 16 |
# File 'lib/vobject/property.rb', line 9 def initialize key, self.group = [:group] self.prop_name = key self.params = [:params] self.value = parse_value([:value]) raise_invalid_initialization if key != name end |
Instance Attribute Details
#group ⇒ Object
Returns the value of attribute group.
7 8 9 |
# File 'lib/vobject/property.rb', line 7 def group @group end |
#params ⇒ Object
Returns the value of attribute params.
7 8 9 |
# File 'lib/vobject/property.rb', line 7 def params @params end |
#prop_name ⇒ Object
Returns the value of attribute prop_name.
7 8 9 |
# File 'lib/vobject/property.rb', line 7 def prop_name @prop_name end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/vobject/property.rb', line 7 def value @value end |
Instance Method Details
#to_s ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vobject/property.rb', line 18 def to_s line = group ? "#{group}." : "" line << "#{name}" (params || {}).each do |pname, pvalue| pvalue.to_s.gsub!(/\n/, '\n') line << ";#{pname}=#{pvalue}" end line << ":#{value}" line = fold_line(line) << "\n" line end |