Class: Booker::Folder

Inherits:
Object
  • Object
show all
Defined in:
lib/booker/bookmarks.rb

Overview

for recursively parsing bookmarks

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json, title = "|") ⇒ Folder

Returns a new instance of Folder.



136
137
138
139
# File 'lib/booker/bookmarks.rb', line 136

def initialize(json, title = "|")
  @title = Folder.normalize(title)
  @json = json
end

Instance Attribute Details

#jsonObject (readonly)

Returns the value of attribute json.



129
130
131
# File 'lib/booker/bookmarks.rb', line 129

def json
  @json
end

#titleObject (readonly)

Returns the value of attribute title.



129
130
131
# File 'lib/booker/bookmarks.rb', line 129

def title
  @title
end

Class Method Details

.normalize(title) ⇒ Object

the browsers disagree about what punctuation belongs in a folder name, so every parser normalizes through here rather than carrying its own copy of the rule for the levels it builds itself



134
# File 'lib/booker/bookmarks.rb', line 134

def self.normalize(title) = title.gsub(/[:,'"]/, "-").downcase