merb_global 0.0.4.2 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,79 +0,0 @@
1
- module Merb
2
- module Global
3
- module Provider
4
- ##
5
- # Transfer data from importer into exporter
6
- #
7
- # ==== Parameters
8
- # importer<Importer>:: The provider providing the information
9
- # exporter<Exporter>:: The provider receiving the information
10
- def self.transfer(importer, exporter)
11
- exporter.export do |export_data|
12
- importer.import(exporter, export_data)
13
- end
14
- end
15
- ##
16
- # Importer is a provider through which one can iterate.
17
- # Therefore it is possible to import data from this source
18
- module Importer
19
- ##
20
- # This method iterates through the data and calles the export method
21
- # of exporter
22
- #
23
- # ==== Parameters
24
- # exporter<Exporter>:: Exporter to which it should be exported
25
- # export_data:: Data to pass in calles
26
- #
27
- # ==== Raises
28
- # NoMethodError:: Raised by default implementation.
29
- # Should not be thrown.
30
- def import(exporter, export_data)
31
- raise NoMethodError.new('method import has not been implemented')
32
- end
33
- end
34
-
35
- ##
36
- # Some sources are not only read-only but one can write to them.
37
- # The provider is exporter if it handles this sort of source.
38
- module Exporter
39
- ##
40
- # This method handles all transaction stuff that is needed.
41
- # It also should do a initialization and/or cleanup of all resources
42
- # needed specificly to the transfer as well as the final
43
- # flush of changes.
44
- # ==== Yields
45
- # exported:: A data needed for transfer
46
- def export # Better name needed
47
- Merb.logger.error('No transaction has been set by exporter')
48
- yield nil
49
- end
50
- ##
51
- # This method exports a single message. Please note that the calles
52
- # may be not in any particular order.
53
- # ==== Parameters
54
- # language:: Language data (yielded by Language call)
55
- # msgid<String>:: Orginal string
56
- # msgid_plural<String>:: Orginal plural string
57
- # msgstr<String>:: The translation
58
- # msgstr_index<Integer>:: The number of form (nil if only singular)
59
- def export_string(language, msgid, msgid_plural, msgstr, msgstr_index)
60
- raise NoMethodError.new('method export has not been implemented')
61
- end
62
- ##
63
- # This method export an language. It is guaranteed to be called
64
- # before any of the messages will be exported.
65
- #
66
- # ==== Parameters
67
- # export_data:: Data given from transfer
68
- # language<String>:: Language call
69
- # nplural<Integer>:: Number of forms
70
- # plural<String>:: Format of plural
71
- # ==== Yields
72
- # language:: The data about language
73
- def export_language(export_data, language, nplural, plural)
74
- raise NoMethodError.new('method export has not been implemented')
75
- end
76
- end
77
- end
78
- end
79
- end