Class: Feta::Feature
- Inherits:
-
Object
- Object
- Feta::Feature
- Defined in:
- lib/feta/feature.rb
Overview
Small DSL into fate features
Some examples: Feature.query.only_actor(x).with_role.each do {|feature| … }
Features responds to the following issue methods, shared with bugs: id, title, url
Defined Under Namespace
Classes: ProductContext
Instance Attribute Summary collapse
-
#developers ⇒ Object
Returns the value of attribute developers.
-
#feature_id ⇒ Object
Returns the value of attribute feature_id.
-
#infoprovider ⇒ Object
Returns the value of attribute infoprovider.
-
#product_contexts ⇒ Hash
A feature different statuses and other properties with regard to different products.
-
#products ⇒ Object
Returns the value of attribute products.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #feature_url ⇒ Object
- #id ⇒ Object
-
#initialize(client) ⇒ Feature
constructor
A new instance of Feature.
-
#numeric_priority_for_product_and_role(product, role) ⇒ Fixnum
Numeric priority for this feature use it for sorting.
-
#priority_for_product_and_role(product, role) ⇒ Symbol
The priority of this feature given by
role
forproduct
. -
#status_for_product(product) ⇒ Symbol
Status for
product
or nil if the product is not in the feature.
Constructor Details
#initialize(client) ⇒ Feature
Returns a new instance of Feature.
56 57 58 59 |
# File 'lib/feta/feature.rb', line 56 def initialize(client) @client = client @product_contexts = Hash.new end |
Instance Attribute Details
#developers ⇒ Object
Returns the value of attribute developers.
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def developers @developers end |
#feature_id ⇒ Object
Returns the value of attribute feature_id.
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def feature_id @feature_id end |
#infoprovider ⇒ Object
Returns the value of attribute infoprovider.
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def infoprovider @infoprovider end |
#product_contexts ⇒ Hash
A feature different statuses and other properties with regard to different products
31 32 33 |
# File 'lib/feta/feature.rb', line 31 def product_contexts @product_contexts end |
#products ⇒ Object
Returns the value of attribute products.
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def products @products end |
#title ⇒ Object
Returns the value of attribute title.
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def title @title end |
Class Method Details
Instance Method Details
#feature_url ⇒ Object
70 71 72 |
# File 'lib/feta/feature.rb', line 70 def feature_url "#{@client.url}/#{id}" end |
#id ⇒ Object
52 53 54 |
# File 'lib/feta/feature.rb', line 52 def id feature_id end |
#numeric_priority_for_product_and_role(product, role) ⇒ Fixnum
Returns numeric priority for this feature use it for sorting.
89 90 91 92 93 94 95 96 97 |
# File 'lib/feta/feature.rb', line 89 def numeric_priority_for_product_and_role(product, role) case priority_for_product_and_role(product, role) when :neutral then 0 when :desirable then 1 when :important then 2 when :mandatory then 3 else -1 end end |
#priority_for_product_and_role(product, role) ⇒ Symbol
Returns the priority of this feature given by role
for product
.
83 84 85 |
# File 'lib/feta/feature.rb', line 83 def priority_for_product_and_role(product, role) product_contexts[product.to_s].priorities[role.to_sym] end |
#status_for_product(product) ⇒ Symbol
Returns status for product
or nil if the product is not in the feature.
77 78 79 |
# File 'lib/feta/feature.rb', line 77 def status_for_product(product) product_contexts[product.to_s].status end |