Module: Progressive::Subject

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Callbacks
Defined in:
lib/progressive/subject.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *args, &block) ⇒ Object



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

def method_missing(method_sym, *args, &block)
  if method_sym.to_s[-1] == '?' && specification.state?(method_sym.to_s[0..-2])
    state.send(method_sym)
  else
    super
  end
end

Instance Method Details

#human_stateObject



42
43
44
# File 'lib/progressive/subject.rb', line 42

def human_state
  state.humanize
end

#specificationObject



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

def specification
  self.class.specification
end