Module: BplEnrich
- Defined in:
- lib/bpl_enrich.rb,
lib/bpl_enrich/lcsh.rb,
lib/bpl_enrich/dates.rb,
lib/bpl_enrich/version.rb,
lib/bpl_enrich/constants.rb,
lib/bpl_enrich/authorities.rb
Defined Under Namespace
Classes: Authorities, Constants, Dates, LCSH
Constant Summary collapse
- VERSION =
"0.0.4"
Class Method Summary collapse
- .strip_value(value) ⇒ Object
-
.utf8Encode(value) ⇒ Object
TODO: Better name for this.
Class Method Details
.strip_value(value) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bpl_enrich.rb', line 16 def self.strip_value(value) if(value.blank?) return nil else if value.class == Float || value.class == Fixnum value = value.to_i.to_s end # Make sure it is all UTF-8 and not character encodings or HTML tags and remove any cariage returns return utf8Encode(value) end end |
.utf8Encode(value) ⇒ Object
TODO: Better name for this. Should be part of an overall helped gem.
30 31 32 |
# File 'lib/bpl_enrich.rb', line 30 def self.utf8Encode(value) return ::HTMLEntities.new.decode(ActionView::Base.full_sanitizer.sanitize(value.to_s.gsub(/\r?\n?\t/, ' ').gsub(/\r?\n/, ' ').gsub(/<br[\s]*\/>/,' '))).strip end |