Class: Dox::DSL::Resource
- Inherits:
-
Object
- Object
- Dox::DSL::Resource
- Includes:
- AttrProxy
- Defined in:
- lib/dox/dsl/resource.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
writeonly
Sets the attribute desc.
-
#endpoint ⇒ Object
writeonly
Sets the attribute endpoint.
-
#group ⇒ Object
writeonly
Sets the attribute group.
-
#name ⇒ Object
writeonly
Sets the attribute name.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(name, &block) ⇒ Resource
constructor
A new instance of Resource.
Methods included from AttrProxy
Constructor Details
#initialize(name, &block) ⇒ Resource
Returns a new instance of Resource.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dox/dsl/resource.rb', line 12 def initialize(name, &block) self.name = name instance_eval(&block) raise(Dox::Errors::InvalidResourceError, 'Resource name is required!') if @name.blank? raise(Dox::Errors::InvalidResourceError, 'Resource group is required!') if @group.blank? if Dox.config.check_file_presence_on_init raise(Dox::Errors::InvalidResourceError, "Resource desc #{@desc} is missing!") if desc_file_path.nil? end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Dox::DSL::AttrProxy
Instance Attribute Details
#desc=(value) ⇒ Object (writeonly)
Sets the attribute desc
10 11 12 |
# File 'lib/dox/dsl/resource.rb', line 10 def desc=(value) @desc = value end |
#endpoint=(value) ⇒ Object (writeonly)
Sets the attribute endpoint
8 9 10 |
# File 'lib/dox/dsl/resource.rb', line 8 def endpoint=(value) @endpoint = value end |
#group=(value) ⇒ Object (writeonly)
Sets the attribute group
7 8 9 |
# File 'lib/dox/dsl/resource.rb', line 7 def group=(value) @group = value end |
#name=(value) ⇒ Object (writeonly)
Sets the attribute name
6 7 8 |
# File 'lib/dox/dsl/resource.rb', line 6 def name=(value) @name = value end |
Instance Method Details
#config ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/dox/dsl/resource.rb', line 25 def config { resource_name: @name.presence, resource_desc: @desc.presence, resource_group_name: @group.presence, apidoc: true } end |