Class: Alexandria::ImportFilter
- Inherits:
-
Object
- Object
- Alexandria::ImportFilter
- Extended by:
- GetText
- Includes:
- Logging, GetText
- Defined in:
- lib/alexandria/import_library.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
Class Method Summary collapse
Instance Method Summary collapse
- #invoke(library_name, filename) ⇒ Object
- #on_error(&on_error_cb) ⇒ Object
- #on_iterate(&on_iterate_cb) ⇒ Object
Methods included from Logging
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
12 13 14 |
# File 'lib/alexandria/import_library.rb', line 12 def @message end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/alexandria/import_library.rb', line 12 def name @name end |
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
12 13 14 |
# File 'lib/alexandria/import_library.rb', line 12 def patterns @patterns end |
Class Method Details
.all ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/alexandria/import_library.rb', line 19 def self.all [ new(_("Autodetect"), ["*"], :import_autodetect), new(_("Archived Tellico XML (*.bc, *.tc)"), ["*.tc", "*.bc"], :import_as_tellico_xml_archive), new(_("ISBN List (*.txt)"), ["*.txt"], :import_as_isbn_list), new(_("GoodReads CSV"), ["*.csv"], :import_as_csv_file) ] end |
Instance Method Details
#invoke(library_name, filename) ⇒ Object
37 38 39 40 41 |
# File 'lib/alexandria/import_library.rb', line 37 def invoke(library_name, filename) log.debug { "Selected: #{@message} -- #{library_name} -- #{filename}" } Library.send(@message, library_name, filename, @on_iterate_cb, @on_error_cb) end |
#on_error(&on_error_cb) ⇒ Object
33 34 35 |
# File 'lib/alexandria/import_library.rb', line 33 def on_error(&on_error_cb) @on_error_cb = on_error_cb end |
#on_iterate(&on_iterate_cb) ⇒ Object
29 30 31 |
# File 'lib/alexandria/import_library.rb', line 29 def on_iterate(&on_iterate_cb) @on_iterate_cb = on_iterate_cb end |