class Essay::AbstractCollection

Attributes

env[R]

Public Class Methods

new(env) click to toggle source
# File lib/essay/abstract_collection.rb, line 12
def initialize(env)
  @env           = env
  @active_record = env.fetch(:active_record)
  @features_for  = {}
end

Public Instance Methods

[](name) click to toggle source
# File lib/essay/abstract_collection.rb, line 18
def [](name)
  @features_for[name.to_sym] ||= construct_features(name)
end
to_hash() click to toggle source
# File lib/essay/abstract_collection.rb, line 22
def to_hash
  @features_for.each_with_object({}) do |(k, v), memo|
    memo[k] = v.to_hash
  end
end

Protected Instance Methods

construct_features(name) click to toggle source
# File lib/essay/abstract_collection.rb, line 29
def construct_features(name)
  raise NotImplementedError
end