Class: Hobix::BaseEntry

Inherits:
BaseContent show all
Defined in:
lib/hobix/base.rb

Overview

The BaseEntry class is the underlying class for all Hobix entries (i.e. the content for your website/blahhg.)

Direct Known Subclasses

Entry, LinkList

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseContent

#base_id, #canonical_tags, #day_id, #force_tags, #initialize, link_format, load, maker, #month_id, no_implicit_tags, #path_to_tags, root_tag=, #section_id, split_implicit_tags, #tags, text_processor, text_processor_fields, #to_yaml, #to_yaml_orig, url_link, yaml_type, #year_id

Methods included from BaseProperties

append_features, #property_map, #to_yaml_properties

Constructor Details

This class inherits a constructor from Hobix::BaseContent

Class Method Details

.inherited(sub) ⇒ Object



459
460
461
# File 'lib/hobix/base.rb', line 459

def self.inherited( sub )
    Weblog::add_entry_class( sub )
end

Instance Method Details

#content_ratingsObject



457
# File 'lib/hobix/base.rb', line 457

def content_ratings; @content_ratings || [:ham]; end

#to_searchObject

Build the searchable text



464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/hobix/base.rb', line 464

def to_search
    self.class.properties.map do |name, opts|
        next unless opts
        val = instance_variable_get( "@#{ name }" )
        next unless val
        val = val.strftime "%Y-%m-%dT%H:%M:%S" if val.respond_to? :strftime
        case opts[:search]
        when :prefix
            "#{ name }:" + val.to_s
        when :fulltext
            val.to_s
        end
    end.compact.join "\n"
end