Class: Ulysses::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/ulysses/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info_file_path) ⇒ Group

Returns a new instance of Group.



6
7
8
9
# File 'lib/ulysses/group.rb', line 6

def initialize(info_file_path)
  @dirname = File.dirname(info_file_path)
  @info    = parse_info(info_file_path)
end

Instance Attribute Details

#dirnameObject (readonly)

Returns the value of attribute dirname.



4
5
6
# File 'lib/ulysses/group.rb', line 4

def dirname
  @dirname
end

Instance Method Details

#childrenObject



15
16
17
18
19
# File 'lib/ulysses/group.rb', line 15

def children
  @info['childOrder'].children.map do |child|
    Group.new File.join(@dirname, child.content, 'Info.ulgroup') if child.element?
  end.compact
end

#display_nameObject



11
12
13
# File 'lib/ulysses/group.rb', line 11

def display_name
  @display_name = @info['displayName'].content
end

#sheetsObject



21
22
23
24
25
26
# File 'lib/ulysses/group.rb', line 21

def sheets
  list = @info['sheetClusters'].children.find { |child| child.element? && child.name == 'array' }
  list.children.map do |child|
    Sheet.new File.join(@dirname, child.content) if child.element? && child.name == 'string'
  end.compact
end