extract formats_regexp as a method
This commit is contained in:
parent
15d3c77bc2
commit
6c8ea83385
@ -16,15 +16,18 @@ def render
|
||||
# the lookup context to take this new format into account.
|
||||
def wrap_formats(value)
|
||||
return yield unless value.is_a?(String)
|
||||
@@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/
|
||||
|
||||
if value.sub!(@@formats_regexp, "")
|
||||
if value.sub!(formats_regexp, "")
|
||||
update_details(:formats => [$1.to_sym]){ yield }
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def formats_regexp
|
||||
@@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def instrument(name, options={})
|
||||
|
Loading…
Reference in New Issue
Block a user