Class: XcodeSnippets::Snippet::MetaData
- Inherits:
-
Object
- Object
- XcodeSnippets::Snippet::MetaData
- Defined in:
- lib/xcode_snippets/snippet.rb
Class Method Summary collapse
Instance Method Summary collapse
- #guid ⇒ Object
- #guid=(new_guid) ⇒ Object
-
#initialize(data) ⇒ MetaData
constructor
A new instance of MetaData.
- #save_to(path) ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(data) ⇒ MetaData
Returns a new instance of MetaData.
59 60 61 |
# File 'lib/xcode_snippets/snippet.rb', line 59 def initialize(data) @data = data end |
Class Method Details
.from_file(path) ⇒ Object
63 64 65 66 |
# File 'lib/xcode_snippets/snippet.rb', line 63 def self.from_file(path) raise "Could not parse metadata in file #{path}" unless File.exist?(path) new(Plist.parse_xml(path)) end |
Instance Method Details
#guid ⇒ Object
72 73 74 |
# File 'lib/xcode_snippets/snippet.rb', line 72 def guid @data["IDECodeSnippetIdentifier"] end |
#guid=(new_guid) ⇒ Object
76 77 78 |
# File 'lib/xcode_snippets/snippet.rb', line 76 def guid=(new_guid) @data["IDECodeSnippetIdentifier"] = new_guid end |
#save_to(path) ⇒ Object
80 81 82 83 84 |
# File 'lib/xcode_snippets/snippet.rb', line 80 def save_to(path) File.open(path, "w") do |io| io.write @data.to_plist end end |
#title ⇒ Object
68 69 70 |
# File 'lib/xcode_snippets/snippet.rb', line 68 def title @data["IDECodeSnippetTitle"] end |