Module: Compass::Configuration::Inheritance::ClassMethods
- Defined in:
- lib/compass/configuration/inheritance.rb
Instance Method Summary collapse
- #inherited_accessor(*attributes) ⇒ Object
-
#inherited_reader(*attributes) ⇒ Object
Defines the default reader to be an inherited_reader that will look at the inherited_data for its value when not set.
- #inherited_writer(*attributes) ⇒ Object
Instance Method Details
#inherited_accessor(*attributes) ⇒ Object
59 60 61 62 |
# File 'lib/compass/configuration/inheritance.rb', line 59 def inherited_accessor(*attributes) inherited_reader(*attributes) inherited_writer(*attributes) end |
#inherited_reader(*attributes) ⇒ Object
Defines the default reader to be an inherited_reader that will look at the inherited_data for its value when not set. The inherited reader calls to a raw reader that acts like a normal attribute reader but prefixes the attribute name with “raw_”.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/compass/configuration/inheritance.rb', line 42 def inherited_reader(*attributes) attributes.each do |attribute| line = __LINE__ + 1 class_eval %Q{ def raw_#{attribute} # def raw_css_dir @#{attribute} # @css_dir end # end def #{attribute}_without_default # def css_dir_without_default read_without_default(#{attribute.inspect}) # read_without_default(:css_dir) end # end def #{attribute} # def css_dir read(#{attribute.inspect}) # read(:css_dir) end # end }, __FILE__, line end end |
#inherited_writer(*attributes) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/compass/configuration/inheritance.rb', line 18 def inherited_writer(*attributes) attributes.each do |attribute| line = __LINE__ + 1 class_eval %Q{ def #{attribute}=(value) # def css_dir=(value) @set_attributes ||= {} # @set_attributes ||= {} @set_attributes[#{attribute.inspect}] = true # @set_attributes[:css_dir] = true @#{attribute} = value # @css_dir = value end # end def unset_#{attribute}! # def unset_css_dir! unset!(#{attribute.inspect}) # unset!(:css_dir) end # end def #{attribute}_set? # def css_dir_set? set?(#{attribute.inspect}) # set?(:css_dir) end # end }, __FILE__, line end end |