Module: Treaty::Controller::DSL::InstanceMethods

Defined in:
lib/treaty/controller/dsl.rb

Instance Method Summary collapse

Instance Method Details

#treaty_classObject



36
37
38
39
40
41
42
43
44
# File 'lib/treaty/controller/dsl.rb', line 36

def treaty_class
  treaty_class_name.constantize
rescue NameError
  raise Treaty::Exceptions::ClassName,
        I18n.t(
          "treaty.controller.treaty_class_not_found",
          class_name: treaty_class_name
        )
end

#treaty_class_nameObject



46
47
48
49
# File 'lib/treaty/controller/dsl.rb', line 46

def treaty_class_name
  # TODO: Need to move `Treaty` to configuration.
  self.class.name.sub(/Controller$/, "::#{action_name.to_s.classify}Treaty")
end

#treaty_versionObject



51
52
53
# File 'lib/treaty/controller/dsl.rb', line 51

def treaty_version
  Treaty::Engine.config.treaty.version.call(self)
end