Class: Fictium::Action
Instance Attribute Summary collapse
-
#deprecated ⇒ Object
Returns the value of attribute deprecated.
-
#description ⇒ Object
Returns the value of attribute description.
-
#docs ⇒ Object
Returns the value of attribute docs.
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
-
#method ⇒ Object
Returns the value of attribute method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #[](section) ⇒ Object
- #add_example ⇒ Object
- #add_params_in(section, &block) ⇒ Object
- #combined_tags ⇒ Object
- #default_example ⇒ Object
- #deprecated? ⇒ Boolean
- #full_path ⇒ Object
-
#initialize(resource) ⇒ Action
constructor
A new instance of Action.
Methods inherited from Model
Constructor Details
#initialize(resource) ⇒ Action
Returns a new instance of Action.
6 7 8 9 10 11 12 |
# File 'lib/fictium/poros/action.rb', line 6 def initialize(resource) @resource = resource @params = ActiveSupport::HashWithIndifferentAccess.new @examples = [] @tags = [] @deprecated = false end |
Instance Attribute Details
#deprecated ⇒ Object
Returns the value of attribute deprecated.
4 5 6 |
# File 'lib/fictium/poros/action.rb', line 4 def deprecated @deprecated end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/fictium/poros/action.rb', line 4 def description @description end |
#docs ⇒ Object
Returns the value of attribute docs.
4 5 6 |
# File 'lib/fictium/poros/action.rb', line 4 def docs @docs end |
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
3 4 5 |
# File 'lib/fictium/poros/action.rb', line 3 def examples @examples end |
#method ⇒ Object
Returns the value of attribute method.
4 5 6 |
# File 'lib/fictium/poros/action.rb', line 4 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/fictium/poros/action.rb', line 3 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/fictium/poros/action.rb', line 4 def path @path end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
3 4 5 |
# File 'lib/fictium/poros/action.rb', line 3 def resource @resource end |
#summary ⇒ Object
Returns the value of attribute summary.
4 5 6 |
# File 'lib/fictium/poros/action.rb', line 4 def summary @summary end |
#tags ⇒ Object
Returns the value of attribute tags.
4 5 6 |
# File 'lib/fictium/poros/action.rb', line 4 def @tags end |
Instance Method Details
#[](section) ⇒ Object
18 19 20 |
# File 'lib/fictium/poros/action.rb', line 18 def [](section) @params[section] ||= ActiveSupport::HashWithIndifferentAccess.new end |
#add_example ⇒ Object
27 28 29 |
# File 'lib/fictium/poros/action.rb', line 27 def add_example Fictium::Example.new(self).tap { |example| examples << example } end |
#add_params_in(section, &block) ⇒ Object
22 23 24 25 |
# File 'lib/fictium/poros/action.rb', line 22 def add_params_in(section, &block) self[section].merge!(Fictium::ParameterEvaluator.new.evaluate_params(&block)) nil end |
#combined_tags ⇒ Object
31 32 33 |
# File 'lib/fictium/poros/action.rb', line 31 def resource. + end |
#default_example ⇒ Object
39 40 41 |
# File 'lib/fictium/poros/action.rb', line 39 def default_example examples.find(&:default?).presence || examples.first end |
#deprecated? ⇒ Boolean
35 36 37 |
# File 'lib/fictium/poros/action.rb', line 35 def deprecated? deprecated end |
#full_path ⇒ Object
14 15 16 |
# File 'lib/fictium/poros/action.rb', line 14 def full_path "#{resource.base_path}#{path}" end |