Class: Motor::IconsController
- Inherits:
-
ApiBaseController
- Object
- ActionController::API
- ApiBaseController
- Motor::IconsController
- Defined in:
- app/controllers/motor/icons_controller.rb
Constant Summary collapse
- CACHE_STORE =
ActiveSupport::Cache::MemoryStore.new
Instance Method Summary collapse
Methods included from CurrentAbility
Methods included from CurrentUserMethod
Instance Method Details
#index ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/motor/icons_controller.rb', line 9 def index data = CACHE_STORE.fetch('icons') do Motor::Assets.icons.map do |icon| svg = Motor::Assets.load_asset(icon, gzip: !Motor.development?) svg = ActiveSupport::Gzip.decompress(svg) unless Motor.development? [icon.split('/').last, svg] end end render json: { data: data } end |