Module: Vanguard
- Defined in:
- lib/vanguard.rb,
lib/vanguard/dsl.rb,
lib/vanguard/rule.rb,
lib/vanguard/result.rb,
lib/vanguard/builder.rb,
lib/vanguard/matcher.rb,
lib/vanguard/evaluator.rb,
lib/vanguard/validator.rb,
lib/vanguard/violation.rb,
lib/vanguard/rule/guard.rb,
lib/vanguard/rule/nullary.rb,
lib/vanguard/dsl/evaluator.rb,
lib/vanguard/matcher/unary.rb,
lib/vanguard/support/blank.rb,
lib/vanguard/matcher/binary.rb,
lib/vanguard/builder/nullary.rb,
lib/vanguard/matcher/nullary.rb,
lib/vanguard/instance_methods.rb,
lib/vanguard/matcher/binary/or.rb,
lib/vanguard/matcher/unary/not.rb,
lib/vanguard/validator/builder.rb,
lib/vanguard/matcher/binary/and.rb,
lib/vanguard/matcher/binary/xor.rb,
lib/vanguard/matcher/nullary/proc.rb,
lib/vanguard/matcher/nullary/value.rb,
lib/vanguard/matcher/nullary/format.rb,
lib/vanguard/rule/nullary/attribute.rb,
lib/vanguard/matcher/unary/attribute.rb,
lib/vanguard/matcher/nullary/equality.rb,
lib/vanguard/matcher/nullary/identity.rb,
lib/vanguard/matcher/nullary/inclusion.rb,
lib/vanguard/matcher/nullary/less_than.rb,
lib/vanguard/matcher/nullary/primitive.rb,
lib/vanguard/rule/nullary/confirmation.rb,
lib/vanguard/matcher/nullary/greater_than.rb,
lib/vanguard/rule/nullary/attribute/format.rb,
lib/vanguard/rule/nullary/attribute/length.rb,
lib/vanguard/rule/nullary/attribute/absence.rb,
lib/vanguard/rule/nullary/attribute/presence.rb,
lib/vanguard/rule/nullary/attribute/inclusion.rb,
lib/vanguard/rule/nullary/attribute/predicate.rb,
lib/vanguard/rule/nullary/attribute/primitive.rb
Overview
Library namespace
Defined Under Namespace
Modules: DSL, InstanceMethods Classes: Builder, Evaluator, Matcher, Result, Rule, Validator, Violation
Class Method Summary collapse
-
.blank?(value) ⇒ true, false
private
Determines whether the specified
value
is blank. -
.singleton_constant(klass, name, &block) ⇒ self
private
Define constant singleton class.
Class Method Details
.blank?(value) ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Determines whether the specified value
is blank
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vanguard/support/blank.rb', line 15 def self.blank?(value) case value when ::NilClass, ::FalseClass true when ::TrueClass, ::Numeric false when ::Array, ::Hash value.empty? when ::String value !~ /\S/ else value.nil? || (value.respond_to?(:empty?) && value.empty?) end end |
.singleton_constant(klass, name, &block) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define constant singleton class
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vanguard.rb', line 25 def self.singleton_constant(klass, name, &block) subclass = Class.new(klass) do # Return inspection string # # @return [String] # # @api private # def inspect klass = self.class "#{klass.superclass.name}::#{klass.name}".freeze end end subclass.class_eval(&block) klass.const_set(name, subclass.new) self end |