abstract class Crinja::FeatureLibrary(T)

Direct Known Subclasses

Defined in:

lib/feature_library.cr

Constructors

Instance Method Summary

Macro 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.


[View source]

Instance Method Detail

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

Adds an array of classes to this library.


[View source]
def <<(klass : Class) #

Adds a class to this library.


[View source]
def <<(obj : T) #

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


[View source]
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.


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

Stores a feature object obj under the key name.


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

Stores a feature object obj under the key name.


[View source]
def aliases : Hash(String, String) #

Map of aliases.


[View source]
def disabled : Array(String) #

List of disabled features.


[View source]
def each(*args, **options) #

[View source]
def each(*args, **options, &) #

[View source]
def has_key?(name) #

[View source]
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>

[View source]
def keys(*args, **options) #

[View source]
def keys(*args, **options, &) #

[View source]
def name #

[View source]
def register_defaults #

Adds default values to this library.


[View source]
def size(*args, **options) #

[View source]
def size(*args, **options, &) #

[View source]

Macro Detail

macro register_default(default, name = nil) #

Register default values with this library.


[View source]