Class: Cloudimage::URI

Inherits:
Object
  • Object
show all
Includes:
CustomHelpers, Params, Srcset
Defined in:
lib/cloudimage/uri.rb

Constant Summary

Constants included from Srcset

Srcset::SRCSET_GROWTH_FACTOR, Srcset::SRCSET_RANGE

Constants included from Params

Params::ALIASES, Params::PARAMS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Srcset

#to_srcset

Methods included from CustomHelpers

#positionable_crop, #seal_params

Constructor Details

#initialize(path, **config) ⇒ URI

Returns a new instance of URI.



21
22
23
24
25
26
27
# File 'lib/cloudimage/uri.rb', line 21

def initialize(path, **config)
  @config = config
  @params = {}
  @sealed_params = Set.new
  @path = transform(path)
  @uri = build_uri
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



19
20
21
# File 'lib/cloudimage/uri.rb', line 19

def config
  @config
end

#paramsObject (readonly)

Returns the value of attribute params.



19
20
21
# File 'lib/cloudimage/uri.rb', line 19

def params
  @params
end

#pathObject (readonly)

Returns the value of attribute path.



19
20
21
# File 'lib/cloudimage/uri.rb', line 19

def path
  @path
end

#sealed_paramsObject (readonly)

Returns the value of attribute sealed_params.



19
20
21
# File 'lib/cloudimage/uri.rb', line 19

def sealed_params
  @sealed_params
end

#uriObject (readonly)

Returns the value of attribute uri.



19
20
21
# File 'lib/cloudimage/uri.rb', line 19

def uri
  @uri
end

Instance Method Details

#to_url(**extra_params) ⇒ Object



41
42
43
44
45
# File 'lib/cloudimage/uri.rb', line 41

def to_url(**extra_params)
  set_uri_params(**extra_params)
  secure_url
  uri.to_s
end