Module: ValidatesXmlOf

Defined in:
lib/validates_xml_of.rb,
lib/validates_xml_of/railtie.rb,
lib/validates_xml_of/version.rb,
lib/validates_xml_of/validator.rb,
lib/validates_xml_of/matchers/validate_xml_of.rb

Defined Under Namespace

Modules: Matchers Classes: Railtie, Validator

Constant Summary collapse

DEFAULT_MESSAGE =
'does not appear to be a valid xml'
DEFAULT_SCHEMA_MESSAGE =
'does not appear to be a valid xml based on schema informed'
ERROR_MESSAGE_I18N_KEY =
:invalid_xml
ERROR_SCHEMA_MESSAGE_I18N_KEY =
:invalid_xml_based_on_schema
VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.schema_pathsObject

Returns the value of attribute schema_paths.



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

def schema_paths
  @schema_paths
end

Class Method Details

.default_messageObject



19
20
21
# File 'lib/validates_xml_of.rb', line 19

def default_message
  i18n_defined? ? I18n.t(ERROR_MESSAGE_I18N_KEY, scope: [:errors, :messages], default: DEFAULT_MESSAGE) : DEFAULT_MESSAGE
end

.default_schema_messageObject



23
24
25
# File 'lib/validates_xml_of.rb', line 23

def default_schema_message
  i18n_defined? ? I18n.t(ERROR_SCHEMA_MESSAGE_I18N_KEY, scope: [:errors, :messages], default: DEFAULT_SCHEMA_MESSAGE): DEFAULT_SCHEMA_MESSAGE
end

.load_i18n_localesObject



9
10
11
12
# File 'lib/validates_xml_of.rb', line 9

def load_i18n_locales
  require 'i18n'
  I18n.load_path += Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'locales', '*.yml')))
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



36
37
38
# File 'lib/validates_xml_of.rb', line 36

def self.setup
  yield self
end