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
- #to_extension_name(string) ⇒ Object
Instance Attribute Details
#extension ⇒ Object
Returns the value of attribute extension.
233 234 235 |
# File 'lib/radiant/extension/script.rb', line 233 def extension @extension end |
#extension_name ⇒ Object
Returns the value of attribute extension_name.
233 234 235 |
# File 'lib/radiant/extension/script.rb', line 233 def extension_name @extension_name end |
Instance Method Details
#extension_paths ⇒ Object
244 245 246 |
# File 'lib/radiant/extension/script.rb', line 244 def extension_paths [RAILS_ROOT, RADIANT_ROOT].uniq.map { |p| Dir["#{p}/vendor/extensions/*"] }.flatten end |
#find_extension ⇒ Object
252 253 254 |
# File 'lib/radiant/extension/script.rb', line 252 def find_extension self.extension = load_extensions.find{|e| e.name == self.extension_name } end |
#installed? ⇒ Boolean
239 240 241 242 |
# File 'lib/radiant/extension/script.rb', line 239 def installed? path_match = Regexp.compile("#{extension_name}$") extension_paths.any? {|p| p =~ path_match } end |
#load_extensions ⇒ Object
248 249 250 |
# File 'lib/radiant/extension/script.rb', line 248 def load_extensions Registry::Extension.find(:all) end |
#to_extension_name(string) ⇒ Object
235 236 237 |
# File 'lib/radiant/extension/script.rb', line 235 def to_extension_name(string) string.to_s.underscore end |