class Novika::Resolver::PermissionServer
- Novika::Resolver::PermissionServer
- Reference
- Object
Overview
Permission server allows to prompt the user for permissions, and save the user's choices in the permissions file.
Included Modules
Defined in:
novika/resolver.crConstructors
-
.new(env : RunnableEnvironment, explicit : Array(RunnableQuery))
Creates a new permission server.
Instance Method Summary
-
#answer(answer : String)
Prints answer so that it can be seen by the user.
-
#ask?(question : String) : String | Nil
Asks user a question, and returns the answer or an empty string in case EOF was received.
-
#brief(dependency : RunnableCapability) : String
Returns a brief description of dependency.
-
#explicit?(dependency : Resolution::Dependency) : Bool
Returns whether dependency is explicit.
-
#load
Fills the permissions hash with saved permissions.
-
#query_permission?(container : RunnableContainer, dependency : Resolution::Dependency)
Queries (possibly prompts) and returns the permission state of dependency for the given container.
-
#receive(signal : Signal)
Receives and reacts to a signal sent by
RunnableRoot
. -
#save
Flushes the internal permissions store to disk.
Instance methods inherited from module Novika::Resolver::SignalReceiver
receive(signal : Signal)
receive
Constructor Detail
Creates a new permission server.
resolver is the resolver with which this server will talk about resolver-related things.
explicit is a list of explicit runnable queries. An explicit query is that query which was specified manually, e.g. via the arguments. In other words, the user had to type it here and now rather than "acquire" it from somewhere unknowingly. This list is mainly used to be less annoying when it comes to asking for permissions.
Instance Method Detail
Asks user a question, and returns the answer or an empty string in case EOF was received.
Returns whether dependency is explicit.
This is done by checking whether the first RunnableQuery
ancestor of dependency is in the explicit list. See .new
to learn what "explicitness" means.
Queries (possibly prompts) and returns the permission state of dependency for the given container.
Receives and reacts to a signal sent by RunnableRoot
.
Flushes the internal permissions store to disk. Can create the permissions file, if necessary.
Note: this method does nothing in case the internal permissions store is empty.