Module: Virginity::Params::Type
- Defined in:
- lib/virginity/vcard/field/params.rb
Defined Under Namespace
Classes: TypeArray
Instance Method Summary collapse
- #add_type(thing) ⇒ Object
- #location ⇒ Object
- #location=(str) ⇒ Object
-
#locations ⇒ Object
Location handling:.
- #locations=(array) ⇒ Object
- #preferred=(val) ⇒ Object
-
#preferred? ⇒ Boolean
Preferred.
- #remove_type(thing) ⇒ Object
- #type=(str) ⇒ Object
- #types ⇒ Object
- #types=(array) ⇒ Object
Instance Method Details
#add_type(thing) ⇒ Object
50 51 52 53 |
# File 'lib/virginity/vcard/field/params.rb', line 50 def add_type(thing) t = types t << thing unless t.include? thing end |
#location ⇒ Object
83 84 85 |
# File 'lib/virginity/vcard/field/params.rb', line 83 def location locations.join(" ") end |
#location=(str) ⇒ Object
87 88 89 |
# File 'lib/virginity/vcard/field/params.rb', line 87 def location=(str) self.locations = str.split(/ /) end |
#locations ⇒ Object
Location handling:
75 76 77 |
# File 'lib/virginity/vcard/field/params.rb', line 75 def locations types.locations end |
#locations=(array) ⇒ Object
79 80 81 |
# File 'lib/virginity/vcard/field/params.rb', line 79 def locations=(array) types.locations = array end |
#preferred=(val) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/virginity/vcard/field/params.rb', line 65 def preferred=(val) if val add_type 'PREF' else remove_type 'PREF' end end |
#preferred? ⇒ Boolean
Preferred
61 62 63 |
# File 'lib/virginity/vcard/field/params.rb', line 61 def preferred? types.include? 'PREF' end |
#remove_type(thing) ⇒ Object
55 56 57 |
# File 'lib/virginity/vcard/field/params.rb', line 55 def remove_type(thing) types.delete(thing) end |
#type=(str) ⇒ Object
46 47 48 |
# File 'lib/virginity/vcard/field/params.rb', line 46 def type=(str) self.types = str.split(/ /) end |
#types ⇒ Object
38 39 40 |
# File 'lib/virginity/vcard/field/params.rb', line 38 def types TypeArray.new(self) end |
#types=(array) ⇒ Object
42 43 44 |
# File 'lib/virginity/vcard/field/params.rb', line 42 def types=(array) types.replace(array) end |