Module: Codable

Extended by:
ActiveSupport::Concern
Defined in:
lib/codable.rb,
lib/codable/railtie.rb,
lib/codable/version.rb

Overview

Rails plugin for the attribute - code

Defined Under Namespace

Classes: Railtie

Constant Summary collapse

VERSION =
'6.0.0'.freeze

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/codable.rb', line 30

def method_missing(method, *args)
  if method.to_s.end_with?('?')
    attributes[self.class.codable_key.to_s] == method.to_s.chomp('?')
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/codable.rb', line 38

def respond_to_missing?(method, include_private = false)
  method.to_s.end_with?('?') || super
end