Class: Finexclub::Images

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/finexclub/images.rb

Defined Under Namespace

Classes: Middleware

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(core) ⇒ Images

Returns a new instance of Images.



13
14
15
16
# File 'lib/finexclub/images.rb', line 13

def initialize(core)
  @core = core
  @app = Dragonfly[:images]
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



8
9
10
# File 'lib/finexclub/images.rb', line 8

def app
  @app
end

#coreObject (readonly)

Returns the value of attribute core.



7
8
9
# File 'lib/finexclub/images.rb', line 7

def core
  @core
end

#screenshot_pathObject

Returns the value of attribute screenshot_path.



9
10
11
# File 'lib/finexclub/images.rb', line 9

def screenshot_path
  @screenshot_path
end

Instance Method Details

#configure_endpoint(path_prefix = nil) ⇒ Object



24
25
26
27
28
29
# File 'lib/finexclub/images.rb', line 24

def configure_endpoint(path_prefix = nil)
  path_prefix ||= "/media"
  @app.configure_with(:rmagick) do |c|
    c.url_path_prefix = path_prefix
  end
end

#store(filename) ⇒ Object



18
19
20
21
22
# File 'lib/finexclub/images.rb', line 18

def store(filename)
  path = screenshot_path || ""
  file = File.expand_path(File.join(path, filename))
  app.store File.new(file)
end