Class: Lbrt::Space

Inherits:
Object
  • Object
show all
Includes:
Logger::Helper
Defined in:
lib/lbrt/space.rb

Defined Under Namespace

Classes: DSL, Exporter

Instance Method Summary collapse

Methods included from Logger::Helper

#log

Constructor Details

#initialize(client, options = {}) ⇒ Space

Returns a new instance of Space.



4
5
6
7
8
# File 'lib/lbrt/space.rb', line 4

def initialize(client, options = {})
  @client = client
  @options = options
  @driver = Lbrt::Driver.new(@client, @options)
end

Instance Method Details

#apply(file) ⇒ Object



39
40
41
# File 'lib/lbrt/space.rb', line 39

def apply(file)
  walk(file)
end

#export(export_options = {}) ⇒ Object



34
35
36
37
# File 'lib/lbrt/space.rb', line 34

def export(export_options = {})
  exported = Lbrt::Space::Exporter.export(@client, @options)
  Lbrt::Space::DSL.convert(exported, @options)
end

#listObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lbrt/space.rb', line 10

def list
  json = {}
  space_by_name_or_id = build_space_by_name_or_id

  space_by_name_or_id.each do |name_or_id, space_id|
    json[space_id] = {
      name: name_or_id,
      url: space_url(space_id),
    }
  end

  puts JSON.pretty_generate(json)
end

#pecoObject



24
25
26
27
28
29
30
31
32
# File 'lib/lbrt/space.rb', line 24

def peco
  space_by_name_or_id = build_space_by_name_or_id
  result = PecoSelector.select_from(space_by_name_or_id)

  result.each do |space_id|
    url = space_url(space_id)
    Lbrt::Utils.open(url)
  end
end