Class: Faun::SectionWithMeta

Inherits:
Section
  • Object
show all
Defined in:
lib/faun.rb

Direct Known Subclasses

Forum, Subtopic, Topic

Instance Attribute Summary collapse

Attributes inherited from Section

#id, #items, #name

Instance Method Summary collapse

Methods inherited from Section

#each, #each_key, #each_value, #to_json

Constructor Details

#initialize(id, name, path, type) ⇒ SectionWithMeta

Returns a new instance of SectionWithMeta.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/faun.rb', line 54

def initialize(id, name, path, type)
  super(id, name, path, type)

  Async do
    begin
      File.open(File.join(path, "meta.yaml"), "r:UTF-8") do |file|
        generic = Async::IO::Stream.new(file)
        @meta = YAML.load(generic.read)
      end
    rescue
      @meta = {}
    end
  end.wait
end

Instance Attribute Details

#metaObject (readonly)

Returns the value of attribute meta.



52
53
54
# File 'lib/faun.rb', line 52

def meta
  @meta
end