Module: Vop::EntitySyntax
- Defined in:
- lib/vop/syntax/entity_syntax.rb
Instance Method Summary collapse
- #contribute(options, &block) ⇒ Object
- #description(s) ⇒ Object
- #entity(options = { key: "name" }, &block) ⇒ Object
- #invalidate(&block) ⇒ Object
- #key(key) ⇒ Object
- #on(other_entity) ⇒ Object
- #run(&block) ⇒ Object
- #show(options = {}) ⇒ Object
Instance Method Details
#contribute(options, &block) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/vop/syntax/entity_syntax.rb', line 39 def contribute(, &block) raise "missing option 'to'" unless .has_key?(:to) @op.register_contributor( command_name: [:to], contributor: @entity.name.to_s.carefully_pluralize ) run(&block) end |
#description(s) ⇒ Object
5 6 7 |
# File 'lib/vop/syntax/entity_syntax.rb', line 5 def description(s) @entity.description = s end |
#entity(options = { key: "name" }, &block) ⇒ Object
13 14 15 |
# File 'lib/vop/syntax/entity_syntax.rb', line 13 def entity( = { key: "name" }, &block) run(&block) end |
#invalidate(&block) ⇒ Object
35 36 37 |
# File 'lib/vop/syntax/entity_syntax.rb', line 35 def invalidate(&block) @entity.invalidation_block = block end |
#key(key) ⇒ Object
9 10 11 |
# File 'lib/vop/syntax/entity_syntax.rb', line 9 def key(key) @entity.key = key end |
#on(other_entity) ⇒ Object
21 22 23 |
# File 'lib/vop/syntax/entity_syntax.rb', line 21 def on(other_entity) @entity.on = other_entity end |
#run(&block) ⇒ Object
17 18 19 |
# File 'lib/vop/syntax/entity_syntax.rb', line 17 def run(&block) @entity.block = block if block end |
#show(options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/vop/syntax/entity_syntax.rb', line 25 def show( = {}) = .delete(:columns) display_type = .delete(:display_type) raise "unknown keyword #{.keys.first}" if .keys.length > 0 @entity.[:columns] = if @entity.[:display_type] = display_type if display_type end |