abstract class Crinja::FeatureLibrary(T)
- Crinja::FeatureLibrary(T)
- Reference
- Object
Direct Known Subclasses
- Crinja::Filter::Library
- Crinja::Function::Library
- Crinja::Operator::Library
- Crinja::Tag::Library
- Crinja::Test::Library
Defined in:
lib/feature_library.crConstructors
-
.new(register_defaults = true, disabled : Array(String) = [] of String)
Creates a new feature library.
Instance Method Summary
-
#<<(classes : Array(Class))
Adds an array of classes to this library.
-
#<<(klass : Class)
Adds a class to this library.
-
#<<(obj : T)
Adds a feature object to this library.
-
#[](lookup) : T
Retrieves the feature object in this library with key or alias lookup.
-
#[]=(name, klass : Class)
Stores a feature object obj under the key name.
-
#[]=(name, obj : T)
Stores a feature object obj under the key name.
-
#aliases : Hash(String, String)
Map of aliases.
-
#disabled : Array(String)
List of disabled features.
- #each(*args, **options)
- #each(*args, **options, &)
- #has_key?(name)
-
#inspect(io : IO)
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
- #keys(*args, **options)
- #keys(*args, **options, &)
- #name
-
#register_defaults
Adds default values to this library.
- #size(*args, **options)
- #size(*args, **options, &)
Macro Summary
-
register_default(default, name = nil)
Register default values with this library.
Constructor Detail
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
.
Instance Method Detail
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.
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>