Module: Cream::GeneratorHelper::Strategy
- Defined in:
- lib/generators/cream/helpers/strategy_helper.rb
Instance Method Summary collapse
- #basic_strategies ⇒ Object
- #document_store_strategies ⇒ Object
- #document_store_strategy? ⇒ Boolean
- #embed_strategy? ⇒ Boolean
- #inline_strategies ⇒ Object
- #inline_strategy? ⇒ Boolean
- #role_embed_strategies ⇒ Object
- #role_ref_strategies ⇒ Object
- #role_ref_strategy? ⇒ Boolean
- #valid_strategies ⇒ Object
- #valid_strategies_list ⇒ Object
- #validate_strategy ⇒ Object
Instance Method Details
#basic_strategies ⇒ Object
50 51 52 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 50 def basic_strategies [:admin_flag, :role_string, :one_role, :many_roles, :roles_mask, :roles_string] end |
#document_store_strategies ⇒ Object
54 55 56 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 54 def document_store_strategies [:embed_one_role, :embed_many_roles, :role_strings] end |
#document_store_strategy? ⇒ Boolean
30 31 32 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 30 def document_store_strategy? document_store_strategies.include? strategy end |
#embed_strategy? ⇒ Boolean
26 27 28 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 26 def .include? strategy end |
#inline_strategies ⇒ Object
46 47 48 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 46 def inline_strategies valid_strategies - role_ref_strategies - end |
#inline_strategy? ⇒ Boolean
34 35 36 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 34 def inline_strategy? document_store_strategies.include? strategy end |
#role_embed_strategies ⇒ Object
42 43 44 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 42 def [:embed_one_role, :embed_many_roles] end |
#role_ref_strategies ⇒ Object
38 39 40 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 38 def role_ref_strategies [:one_role, :many_roles] end |
#role_ref_strategy? ⇒ Boolean
22 23 24 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 22 def role_ref_strategy? role_ref_strategies.include? strategy end |
#valid_strategies ⇒ Object
16 17 18 19 20 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 16 def valid_strategies @strategies ||= basic_strategies @strategies << document_store_strategies if document_store? @strategies end |
#valid_strategies_list ⇒ Object
12 13 14 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 12 def valid_strategies_list valid_strategies.map(&:to_s).join(', ') end |
#validate_strategy ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/generators/cream/helpers/strategy_helper.rb', line 4 def validate_strategy if !valid_strategies.include?(strategy.to_sym) say "ERROR: Strategy '#{strategy}' is not currently supported by Cream. Please use one of: #{valid_strategies_list}", :red return false end true end |