module RubyFeatures
Constants
- VERSION
Public Class Methods
active_support_available?()
click to toggle source
# File lib/ruby-features.rb, line 57 def active_support_available? @active_support_available end
apply(*feature_names)
click to toggle source
# File lib/ruby-features.rb, line 49 def apply(*feature_names) feature_names.each do |feature_name| raise NameError.new("Such feature is not registered: #{feature_name}") unless @features.has_key?(feature_name) @features[feature_name].apply end end
define(feature_name, &feature_body)
click to toggle source
# File lib/ruby-features.rb, line 41 def define(feature_name, &feature_body) feature_name = feature_name.to_s raise NameError.new("Wrong feature name: #{feature_name}") unless feature_name.match(/^[\/_a-z\d]+$/) raise NameError.new("Such feature is already registered: #{feature_name}") if @features.has_key?(feature_name) @features[feature_name] = Mixins.new(feature_name, feature_body) end
find_in_path(*folders)
click to toggle source
# File lib/ruby-features.rb, line 31 def find_in_path(*folders) old_feature_names = @features.keys Dir[*folders.map{|folder| File.join(folder, '**', '*_feature.rb') }].each do |file| require file end Container.new(@features.keys - old_feature_names) end