Sha256: d30f20dc5a15e3b81c276f80e9ab84c5c2a084f1ff4c642ddaf2153db30cb2bd
Contents?: true
Size: 730 Bytes
Versions: 42
Compression:
Stored size: 730 Bytes
Contents
module Locomotive module API module Entities class BaseEntity < ::Grape::Entity include ActionView::Helpers::NumberHelper include ActionView::Helpers::TextHelper format_with(:human_size) { |number| number_to_human_size(number) } format_with(:iso_timestamp) { |date_time| date_time.try(:iso8601) } format_with(:labelize) { |label| label.gsub(/[\"\']/, '').gsub('-', ' ').humanize } format_with(:truncate_to_3) { |target| truncate(target, length: 3) } expose :_id do |entity, _| entity._id.to_s end expose :created_at, format_with: :iso_timestamp expose :updated_at, format_with: :iso_timestamp end end end end
Version data entries
42 entries across 42 versions & 1 rubygems