Module: Radiant::Extension::Script::Util
Instance Attribute Summary collapse
-
#extension ⇒ Object
Returns the value of attribute extension.
-
#extension_name ⇒ Object
Returns the value of attribute extension_name.
Instance Method Summary collapse
- #extension_paths ⇒ Object
- #find_extension ⇒ Object
- #installed? ⇒ Boolean
- #load_extensions ⇒ Object
- #registered? ⇒ Boolean
- #to_extension_name(string) ⇒ Object
Instance Attribute Details
#extension ⇒ Object
Returns the value of attribute extension.
270 271 272 |
# File 'lib/radiant/extension/script.rb', line 270 def extension @extension end |
#extension_name ⇒ Object
Returns the value of attribute extension_name.
270 271 272 |
# File 'lib/radiant/extension/script.rb', line 270 def extension_name @extension_name end |
Instance Method Details
#extension_paths ⇒ Object
285 286 287 |
# File 'lib/radiant/extension/script.rb', line 285 def extension_paths [RAILS_ROOT, RADIANT_ROOT].uniq.map { |p| Dir["#{p}/vendor/extensions/*"] }.flatten end |
#find_extension ⇒ Object
293 294 295 |
# File 'lib/radiant/extension/script.rb', line 293 def find_extension self.extension = load_extensions.find{|e| e.name == self.extension_name } end |
#installed? ⇒ Boolean
276 277 278 279 |
# File 'lib/radiant/extension/script.rb', line 276 def installed? path_match = Regexp.compile("#{extension_name}$") extension_paths.any? {|p| p =~ path_match } end |
#load_extensions ⇒ Object
289 290 291 |
# File 'lib/radiant/extension/script.rb', line 289 def load_extensions Registry::Extension.find(:all) end |
#registered? ⇒ Boolean
281 282 283 |
# File 'lib/radiant/extension/script.rb', line 281 def registered? self.extension end |
#to_extension_name(string) ⇒ Object
272 273 274 |
# File 'lib/radiant/extension/script.rb', line 272 def to_extension_name(string) string.to_s.underscore end |