Class: Cachext::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/cachext/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, expires_in: config.default_expires_in, default: nil, errors: config.default_errors, reraise_errors: true, not_found_error: config.not_found_errors, heartbeat_expires: config.heartbeat_expires, cache: true) ⇒ Options

Returns a new instance of Options.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cachext/options.rb', line 11

def initialize config,
               expires_in: config.default_expires_in,
               default: nil,
               errors: config.default_errors,
               reraise_errors: true,
               not_found_error: config.not_found_errors,
               heartbeat_expires: config.heartbeat_expires,
               cache: true

  @expires_in = expires_in
  @default = default
  @errors = errors
  @reraise_errors = reraise_errors
  @not_found_error = not_found_error
  @heartbeat_expires = heartbeat_expires
  @cache = cache
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



4
5
6
# File 'lib/cachext/options.rb', line 4

def default
  @default
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/cachext/options.rb', line 4

def errors
  @errors
end

#expires_inObject (readonly)

Returns the value of attribute expires_in.



4
5
6
# File 'lib/cachext/options.rb', line 4

def expires_in
  @expires_in
end

#heartbeat_expiresObject (readonly)

Returns the value of attribute heartbeat_expires.



4
5
6
# File 'lib/cachext/options.rb', line 4

def heartbeat_expires
  @heartbeat_expires
end

#not_found_errorObject (readonly)

Returns the value of attribute not_found_error.



4
5
6
# File 'lib/cachext/options.rb', line 4

def not_found_error
  @not_found_error
end

#reraise_errorsObject (readonly)

Returns the value of attribute reraise_errors.



4
5
6
# File 'lib/cachext/options.rb', line 4

def reraise_errors
  @reraise_errors
end

Instance Method Details

#cache?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/cachext/options.rb', line 29

def cache?
  @cache
end