Class: Blur::SuperScript
- Inherits:
-
Object
- Object
- Blur::SuperScript
- Defined in:
- library/blur/script.rb
Class Attribute Summary collapse
-
.authors ⇒ Object
(also: author)
Returns the value of attribute authors.
-
.description ⇒ Object
Returns the value of attribute description.
-
.events ⇒ Object
Returns the value of attribute events.
-
.name ⇒ Object
Returns the value of attribute name.
-
.version ⇒ Object
Returns the value of attribute version.
Instance Attribute Summary collapse
-
#_client_ref ⇒ Object
Reference to the main client that holds the script.
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#config ⇒ Object
Script-specific configuration that is read from the main configuration file.
Class Method Summary collapse
-
.Author(*authors) ⇒ Object
(also: Authors)
Sets the author.
-
.deinit ⇒ Object
Called right before the script is being removed from the list of superscripts.
-
.Description(description) ⇒ Object
Sets the description.
-
.init ⇒ Object
Called when when the superscript has been loaded and added to the list of superscripts.
- .inspect ⇒ Object
-
.register!(*args) ⇒ Object
Registers events to certain functions.
-
.register_event!(name, method_name = name) ⇒ Object
Adds the given event
name
and the name of the method to call once the event is emitted. - .to_s ⇒ Object
-
.Version(version) ⇒ Object
Sets the version.
Instance Method Summary collapse
-
#inspect ⇒ Object
Gets a human-readable representation of the script.
-
#script(name) ⇒ Object
Gets the instantiated script with
name
. - #to_s ⇒ Object
-
#unloaded ⇒ Object
Called right before the instance of the script is being removed.
Class Attribute Details
.authors ⇒ Object Also known as:
Returns the value of attribute authors.
56 57 58 |
# File 'library/blur/script.rb', line 56 def end |
.description ⇒ Object
Returns the value of attribute description.
56 57 58 |
# File 'library/blur/script.rb', line 56 def description @description end |
.events ⇒ Object
Returns the value of attribute events.
56 57 58 |
# File 'library/blur/script.rb', line 56 def events @events end |
.name ⇒ Object
Returns the value of attribute name.
56 57 58 |
# File 'library/blur/script.rb', line 56 def name @name end |
.version ⇒ Object
Returns the value of attribute version.
56 57 58 |
# File 'library/blur/script.rb', line 56 def version @version end |
Instance Attribute Details
#_client_ref ⇒ Object
Reference to the main client that holds the script.
128 129 130 |
# File 'library/blur/script.rb', line 128 def _client_ref @_client_ref end |
#cache ⇒ Object
Returns the value of attribute cache.
134 135 136 |
# File 'library/blur/script.rb', line 134 def cache @cache end |
#config ⇒ Object
Script-specific configuration that is read from the main configuration file.
132 133 134 |
# File 'library/blur/script.rb', line 132 def config @config end |
Class Method Details
.Author(*authors) ⇒ Object Also known as: Authors
Sets the author.
62 63 64 |
# File 'library/blur/script.rb', line 62 def Author * = end |
.deinit ⇒ Object
Called right before the script is being removed from the list of superscripts.
125 |
# File 'library/blur/script.rb', line 125 def self.deinit; end |
.Description(description) ⇒ Object
Sets the description.
70 71 72 |
# File 'library/blur/script.rb', line 70 def Description description @description = description end |
.init ⇒ Object
Called when when the superscript has been loaded and added to the list of superscripts.
121 |
# File 'library/blur/script.rb', line 121 def self.init; end |
.inspect ⇒ Object
111 112 113 |
# File 'library/blur/script.rb', line 111 def inspect %(#<SuperScript:0x#{object_id.to_s 16}>) end |
.register!(*args) ⇒ Object
Registers events to certain functions.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'library/blur/script.rb', line 86 def register! *args args.each do |events| case events when Hash events.each do |event, method_name| register_event! event, method_name end when Array register! *events when Symbol register_event! events end end end |
.register_event!(name, method_name = name) ⇒ Object
Adds the given event name
and the name of the method to call once the event is emitted.
103 104 105 |
# File 'library/blur/script.rb', line 103 def register_event! name, method_name = name (@events[name] ||= []) << method_name end |
.to_s ⇒ Object
107 108 109 |
# File 'library/blur/script.rb', line 107 def to_s inspect end |
.Version(version) ⇒ Object
Sets the version.
78 79 80 |
# File 'library/blur/script.rb', line 78 def Version version @version = version end |
Instance Method Details
#inspect ⇒ Object
Gets a human-readable representation of the script.
145 146 147 148 149 150 |
# File 'library/blur/script.rb', line 145 def inspect "#<Script(#{self.class.name.inspect}) " \ "@author=#{self.class.author.inspect} " \ "@version=#{self.class.version.inspect} " \ "@description=#{self.class.description.inspect}>" end |
#script(name) ⇒ Object
Gets the instantiated script with name
.
140 141 142 |
# File 'library/blur/script.rb', line 140 def script name _client_ref.scripts[name] end |
#to_s ⇒ Object
152 153 154 |
# File 'library/blur/script.rb', line 152 def to_s inspect end |
#unloaded ⇒ Object
Called right before the instance of the script is being removed.
137 |
# File 'library/blur/script.rb', line 137 def unloaded; end |