Class: Vop::EntityDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/vop/objects/entity_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plugin, name) ⇒ EntityDefinition

Returns a new instance of EntityDefinition.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vop/objects/entity_definition.rb', line 16

def initialize(plugin, name)
  @plugin = plugin
  @name = name
  @key = "name"
  @data = {}

  @block = lambda { |params| $logger.warn "entity #{name} does not have a run block" }
  @invalidation_block = nil

  @on = nil
  @show_options = {}
  @read_only = true
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



9
10
11
# File 'lib/vop/objects/entity_definition.rb', line 9

def block
  @block
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/vop/objects/entity_definition.rb', line 6

def description
  @description
end

#invalidation_blockObject

Returns the value of attribute invalidation_block.



13
14
15
# File 'lib/vop/objects/entity_definition.rb', line 13

def invalidation_block
  @invalidation_block
end

#keyObject

Returns the value of attribute key.



8
9
10
# File 'lib/vop/objects/entity_definition.rb', line 8

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/vop/objects/entity_definition.rb', line 5

def name
  @name
end

#onObject

Returns the value of attribute on.



10
11
12
# File 'lib/vop/objects/entity_definition.rb', line 10

def on
  @on
end

#pluginObject (readonly)

Returns the value of attribute plugin.



5
6
7
# File 'lib/vop/objects/entity_definition.rb', line 5

def plugin
  @plugin
end

#read_onlyObject

Returns the value of attribute read_only.



14
15
16
# File 'lib/vop/objects/entity_definition.rb', line 14

def read_only
  @read_only
end

#show_optionsObject

Returns the value of attribute show_options.



11
12
13
# File 'lib/vop/objects/entity_definition.rb', line 11

def show_options
  @show_options
end

Instance Method Details

#list_command_nameObject



38
39
40
# File 'lib/vop/objects/entity_definition.rb', line 38

def list_command_name
  short_name.carefully_pluralize
end

#short_nameObject



30
31
32
# File 'lib/vop/objects/entity_definition.rb', line 30

def short_name
  @name.split(".").last
end

#sourceObject



34
35
36
# File 'lib/vop/objects/entity_definition.rb', line 34

def source
  plugin.sources[:entities][name]
end