Class: Virginity::Vcard::Patching::Remove
- Defined in:
- lib/virginity/vcard/patching.rb
Overview
to remove fields matching a query
Instance Attribute Summary collapse
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
- #apply(vcard) ⇒ Object
-
#initialize(query) ⇒ Remove
constructor
A new instance of Remove.
- #pretty_print(q) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Patch
#field_from_query, normalize_vcard!, query_for_line, query_from_string
Constructor Details
#initialize(query) ⇒ Remove
Returns a new instance of Remove.
163 164 165 |
# File 'lib/virginity/vcard/patching.rb', line 163 def initialize(query) @query = query end |
Instance Attribute Details
#query ⇒ Object
Returns the value of attribute query.
162 163 164 |
# File 'lib/virginity/vcard/patching.rb', line 162 def query @query end |
Instance Method Details
#apply(vcard) ⇒ Object
167 168 169 |
# File 'lib/virginity/vcard/patching.rb', line 167 def apply(vcard) vcard.delete(*vcard.where(@query)) end |
#pretty_print(q) ⇒ Object
175 176 177 |
# File 'lib/virginity/vcard/patching.rb', line 175 def pretty_print(q) q.text "Remove #{@query}" end |
#to_s ⇒ Object
171 172 173 |
# File 'lib/virginity/vcard/patching.rb', line 171 def to_s "Remove(#{@query.inspect})" end |