Module: BibTeX::Filters
- Defined in:
- lib/bibtex/filters.rb,
lib/bibtex/filters/latex.rb,
lib/bibtex/filters/linebreaks.rb
Defined Under Namespace
Classes: LaTeX, LineBreaks
Constant Summary
collapse
- LOAD_PATH =
[File.expand_path(__dir__), 'filters'].join('/').freeze
Class Method Summary
collapse
Class Method Details
.resolve(filter) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/bibtex/filters.rb', line 39
def self.resolve(filter)
if filter.respond_to?(:apply)
filter
elsif filter.respond_to?(:to_s)
klass = Filter.subclasses.detect do |c|
c.name == filter.to_s || c.name.split(/::/)[-1] =~ /^#{filter}$/i
end
klass&.instance
end
end
|
.resolve!(filter) ⇒ Object
35
36
37
|
# File 'lib/bibtex/filters.rb', line 35
def self.resolve!(filter)
resolve(filter) || raise(ArgumentError, "Failed to load filter #{filter.inspect}")
end
|