abstract class Crinja::FeatureLibrary(T)

Direct Known Subclasses

Defined in:

lib/feature_library.cr

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(register_defaults = true, disabled : Array(String) = [] of String) #

Creates a new feature library. If register_defaults is set to false, this library will be empty. Otherwise it is populated with registered default features. A list of disabled features can be provided, if a feature name in this list is accessed, it will raise a SecurityError.


Macro Detail

macro register_default(default, name = nil) #

Register default values with this library.


Instance Method Detail

def <<(classes : Array(Class)) #

Adds an array of classes to this library.


def <<(klass : Class) #

Adds a class to this library.


def <<(obj : T) #

Adds a feature object to this library. It will be stored under the key obj.name.


def [](lookup) : T #

Retrieves the feature object in this library with key or alias lookup.

If the lookup name is in the list of #disabled features, a SecurityError is raised. If the lookup name is not registered, an UnknownFeatureError is raised.


def []=(name, klass : Class) #

Stores a feature object obj under the key name.


def []=(name, obj : T) #

Stores a feature object obj under the key name.


def aliases : Hash(String, String) #

Map of aliases.


def disabled : Array(String) #

List of disabled features.


def each(*args, **options) #

def each(*args, **options, &) #

def has_key?(name) #

def inspect(io : IO) #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

def keys(*args, **options) #

def keys(*args, **options, &) #

def name #

def register_defaults #

Adds default values to this library.


def size(*args, **options) #

def size(*args, **options, &) #