module Otoroshi::Sanctuary

This module is designed to be in a class. This will provide the “property” ({Sanctuary::ClassMethods.property}) method for defining class properties.

@example

class Importer
  include Otoroshi::Sanctuary

  property :whatever
  property :number, Integer
  property :numbers, [Integer]
  property :positive_number, Integer, verify: ->(v) { v >= 0 }
  property :number_or_nil, Integer, allow_nil: true
  property :number_with_default, Integer, default: 42
  property :number_in_collection, Integer, one_of: [1, 2, 3, 5, 8, 13, 21, 34]
end

Public Class Methods

included(base) click to toggle source

Extend ClassMethods for the base class

# File lib/otoroshi/sanctuary.rb, line 24
def included(base)
  base.extend ClassMethods
end