Class: Imgix::Rails::Tag

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers, UrlHelper
Defined in:
lib/imgix/rails/tag.rb

Direct Known Subclasses

ImageTag, PictureTag

Constant Summary collapse

@@parameters =
nil

Class Method Summary collapse

Instance Method Summary collapse

Methods included from UrlHelper

#ix_image_url

Constructor Details

#initialize(source, options = {}) ⇒ Tag

Returns a new instance of Tag.



26
27
28
29
# File 'lib/imgix/rails/tag.rb', line 26

def initialize(source, options={})
  @source = source
  @options = options
end

Class Method Details

.available_parametersObject

Store our parameter information on the class instance so that each instance of any this class or our subclasses doesn’t have to go back to disk to get this configuration information



12
13
14
# File 'lib/imgix/rails/tag.rb', line 12

def self.available_parameters
  @@available_parameters ||= parameters.keys
end

.parametersObject



16
17
18
19
20
21
22
23
24
# File 'lib/imgix/rails/tag.rb', line 16

def self.parameters
  return @@parameters if @@parameters

  path = File.expand_path("../../../../vendor/parameters.json", __FILE__)
  @@parameters = JSON.parse(File.read(path), symbolize_names: true)[:parameters]
  @@parameters[:widths] = nil

  @@parameters
end