Class: SublimeDSL::SublimeText::Package
- Inherits:
-
Object
- Object
- SublimeDSL::SublimeText::Package
- Defined in:
- lib/sublime_dsl/sublime_text/package.rb,
lib/sublime_dsl/sublime_text/package/reader.rb,
lib/sublime_dsl/sublime_text/package/writer.rb,
lib/sublime_dsl/sublime_text/package/exporter.rb,
lib/sublime_dsl/sublime_text/package/importer.rb,
lib/sublime_dsl/sublime_text/package/dsl_reader.rb
Defined Under Namespace
Classes: DSLReader, Exporter, Importer, Reader, Writer
Instance Attribute Summary collapse
-
#command_sets ⇒ Object
readonly
Returns the value of attribute command_sets.
-
#grammars ⇒ Object
readonly
Returns the value of attribute grammars.
-
#keymaps ⇒ Object
readonly
Returns the value of attribute keymaps.
-
#macros ⇒ Object
readonly
Returns the value of attribute macros.
-
#menus ⇒ Object
readonly
Returns the value of attribute menus.
-
#mousemaps ⇒ Object
readonly
Returns the value of attribute mousemaps.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#other_files ⇒ Object
readonly
Returns the value of attribute other_files.
-
#preferences ⇒ Object
readonly
Returns the value of attribute preferences.
-
#setting_sets ⇒ Object
readonly
Returns the value of attribute setting_sets.
-
#snippets ⇒ Object
readonly
Returns the value of attribute snippets.
-
#themes ⇒ Object
readonly
Returns the value of attribute themes.
Class Method Summary collapse
-
.import(name, options = {}) ⇒ Object
Create a new Package from a Sublime Text ‘Packages’ subdirectory.
- .process_options(object, options) ⇒ Object
-
.read(name, options = {}) ⇒ Object
Create a new Package from a DSL directory.
Instance Method Summary collapse
-
#export(options = {}) ⇒ Object
Exports the package.
-
#initialize(name) ⇒ Package
constructor
A new instance of Package.
-
#write(options = {}) ⇒ Object
Writes the package to DSL files.
Constructor Details
#initialize(name) ⇒ Package
Returns a new instance of Package.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 59 def initialize(name) @name = name @themes = [] @grammars = [] @preferences = [] @snippets = [] @setting_sets = [] @macros = [] @command_sets = [] = [] @mousemaps = [] @keymaps = [] @other_files = [] end |
Instance Attribute Details
#command_sets ⇒ Object (readonly)
Returns the value of attribute command_sets.
52 53 54 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 52 def command_sets @command_sets end |
#grammars ⇒ Object (readonly)
Returns the value of attribute grammars.
47 48 49 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 47 def grammars @grammars end |
#keymaps ⇒ Object (readonly)
Returns the value of attribute keymaps.
55 56 57 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 55 def keymaps @keymaps end |
#macros ⇒ Object (readonly)
Returns the value of attribute macros.
51 52 53 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 51 def macros @macros end |
#menus ⇒ Object (readonly)
Returns the value of attribute menus.
53 54 55 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 53 def end |
#mousemaps ⇒ Object (readonly)
Returns the value of attribute mousemaps.
54 55 56 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 54 def mousemaps @mousemaps end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
44 45 46 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 44 def name @name end |
#other_files ⇒ Object (readonly)
Returns the value of attribute other_files.
57 58 59 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 57 def other_files @other_files end |
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
48 49 50 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 48 def preferences @preferences end |
#setting_sets ⇒ Object (readonly)
Returns the value of attribute setting_sets.
50 51 52 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 50 def setting_sets @setting_sets end |
#snippets ⇒ Object (readonly)
Returns the value of attribute snippets.
49 50 51 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 49 def snippets @snippets end |
#themes ⇒ Object (readonly)
Returns the value of attribute themes.
46 47 48 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 46 def themes @themes end |
Class Method Details
.import(name, options = {}) ⇒ Object
Create a new Package from a Sublime Text ‘Packages’ subdirectory.
The options can be any Importer option.
18 19 20 21 22 23 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 18 def self.import(name, = {}) importer = Importer.new(name) importer, importer.package end |
.process_options(object, options) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 36 def self.(object, ) .each_pair do |k,v| m = "#{k}=" raise OptionError, "invalid option '#{k}'" unless object.respond_to? m object.send m, v end end |
.read(name, options = {}) ⇒ Object
Create a new Package from a DSL directory.
The options can be any Reader option.
29 30 31 32 33 34 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 29 def self.read(name, = {}) reader = Reader.new(name) reader, reader.package end |
Instance Method Details
#export(options = {}) ⇒ Object
Exports the package. The options can be any Exporter option.
87 88 89 90 91 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 87 def export( = {}) exporter = Exporter.new(self) self.class. exporter, exporter.export end |
#write(options = {}) ⇒ Object
Writes the package to DSL files. The options can be any Writer option.
78 79 80 81 82 |
# File 'lib/sublime_dsl/sublime_text/package.rb', line 78 def write( = {}) writer = Writer.new(self) self.class. writer, writer.write end |