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)
-
- (Object) developers
Returns the value of attribute developers.
-
- (Object) feature_id
Returns the value of attribute feature_id.
-
- (Object) infoprovider
Returns the value of attribute infoprovider.
-
- (Hash) product_contexts
A feature different statuses and other properties with regard to different products.
-
- (Object) products
Returns the value of attribute products.
-
- (Object) title
Returns the value of attribute title.
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) feature_url
- - (Object) id
-
- (Feature) initialize(client)
constructor
A new instance of Feature.
-
- (Fixnum) numeric_priority_for_product_and_role(product, role)
Numeric priority for this feature use it for sorting.
-
- (Symbol) priority_for_product_and_role(product, role)
The priority of this feature given by role for product.
-
- (Symbol) status_for_product(product)
Status for product or nil if the product is not in the feature.
Constructor Details
- (Feature) initialize(client)
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
- (Object) developers
Returns the value of attribute developers
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def developers @developers end |
- (Object) feature_id
Returns the value of attribute feature_id
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def feature_id @feature_id end |
- (Object) infoprovider
Returns the value of attribute infoprovider
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def infoprovider @infoprovider end |
- (Hash) product_contexts
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 |
- (Object) products
Returns the value of attribute products
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def products @products end |
- (Object) title
Returns the value of attribute title
25 26 27 |
# File 'lib/feta/feature.rb', line 25 def title @title end |
Class Method Details
+ (Object) find(what = nil)
61 62 63 64 |
# File 'lib/feta/feature.rb', line 61 def self.find(what=nil) return Query.new.with_id(what).each.to_a.first if what Query.new end |
+ (Object) query
66 67 68 |
# File 'lib/feta/feature.rb', line 66 def self.query Query.new end |
Instance Method Details
- (Object) feature_url
70 71 72 |
# File 'lib/feta/feature.rb', line 70 def feature_url "#{@client.url}/#{id}" end |
- (Object) id
52 53 54 |
# File 'lib/feta/feature.rb', line 52 def id feature_id end |
- (Fixnum) numeric_priority_for_product_and_role(product, role)
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 |
- (Symbol) priority_for_product_and_role(product, role)
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 |
- (Symbol) status_for_product(product)
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 |