app/models/text_asset.rb
# Adds a tag named after the inheriting class name (i.e. <r:javascript> or
# <r:stylesheet>).  This method is kind of funky since we wanted to define
# the tag in only one place yet we don't have the inheriting class' name
# until after initialization.
Adds a tag named after the inheriting class name .  This method is kind of funky since we wanted to define
the tag in only one place yet we don't have the inheriting class' name
until after initialization.
Adds a tag named after the inheriting class name . This method is kind of funky since we wanted to define the tag in only one place yet we don ' t have the inheriting class ' name until after initialization .
def create_tags
      self.class.class_eval do
        tag(self.name.underscore) do |tag|
          if name = tag.attr['name']
            self.dependencies.list << tag.attr['name'].strip
            if text_asset = self.class.find_by_name(tag.attr['name'].strip)
              text_asset.render
            else
              raise TagError.new("#{self.class.to_s.underscore} not found")
            end
          else
            raise TagError.new("`#{self.class.to_s.underscore}' tag must contain a `name' attribute.") unless tag.attr.has_key?('name')
          end
        end
      end
    end
def create_tags self . class . class_eval do tag ( self . name . underscore ) do | tag | if name = tag . attr [ 'name' ] self . dependencies . list << tag . attr [ 'name' ] . strip if text_asset = self . class . find_by_name ( tag . attr [ 'name' ] . strip ) text_asset . render else raise TagError . new ( "#{self.class.to_s.underscore} not found" ) end else raise TagError . new ( "`#{self.class.to_s.underscore}' tag must contain a `name' attribute." ) unless tag . attr . has_key? ( 'name' ) end end end end
Adds a tag named after the inheriting class name (i.e.
Adds a tag named after the inheriting class name ( i . e .