Module: Vop::EntitySyntax

Defined in:
lib/vop/syntax/entity_syntax.rb

Instance Method Summary collapse

Instance Method Details

#entity(options = { key: "name" }, &block) ⇒ Object


9
10
11
12
13
# File 'lib/vop/syntax/entity_syntax.rb', line 9

def entity(options = { key: "name" }, &block)
  if block
    run(&block)
  end
end

#key(key) ⇒ Object


5
6
7
# File 'lib/vop/syntax/entity_syntax.rb', line 5

def key(key)
  @entity.key = key
end

#on(other_entity) ⇒ Object


19
20
21
# File 'lib/vop/syntax/entity_syntax.rb', line 19

def on(other_entity)
  @entity.on = other_entity
end

#run(&block) ⇒ Object


15
16
17
# File 'lib/vop/syntax/entity_syntax.rb', line 15

def run(&block)
  @entity.block = block
end

#show(options = {}) ⇒ Object


23
24
25
26
27
28
29
30
31
# File 'lib/vop/syntax/entity_syntax.rb', line 23

def show(options = {})
  column_options = options.delete(:columns)
  display_type = options.delete(:display_type)

  raise "unknown keyword #{options.keys.first}" if options.keys.length > 0

  @entity.show_options[:columns] = column_options
  @entity.show_options[:display_type] = display_type
end