Class: Sutty::Cli::Commands::Layout

Inherits:
Sutty::Cli::Command show all
Defined in:
lib/sutty/cli/commands/layout.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Sutty::Cli::Command

#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which

Constructor Details

#initialize(name, options) ⇒ Layout

Returns a new instance of Layout.



13
14
15
16
# File 'lib/sutty/cli/commands/layout.rb', line 13

def initialize(name, options)
  @name = name
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/sutty/cli/commands/layout.rb', line 11

def name
  @name
end

Class Method Details

.layoutsObject



23
24
25
26
27
# File 'lib/sutty/cli/commands/layout.rb', line 23

def self.layouts
  @@layouts ||= Dir.glob(File.join('_data', 'layouts') + '/*.yml').map do |d|
    File.basename d, '.yml'
  end
end

Instance Method Details

#execute(input: $stdin, output: $stdout) ⇒ Object



18
19
20
21
# File 'lib/sutty/cli/commands/layout.rb', line 18

def execute(input: $stdin, output: $stdout)
  TTY::File.create_file data_layout, YAML.dump(data_default_fields)
  TTY::File.create_file html_layout, "---\nlayout: default\n---\n\n"
end