Module: Card::Set::Abstract::Items::OptionsApi
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb
Overview
Set: Abstract (Items, OptionsApi)
TODO: some of this should be moved to right/options!!
Defined Under Namespace
Modules: Format, HtmlFormat
Constant Summary
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included from Event::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#json_options? ⇒ Boolean
-
#option_cards ⇒ Object
-
#option_hash_from_names ⇒ Object
-
#option_names ⇒ Object
-
#option_names_from_items ⇒ Object
-
#options_card ⇒ Object
-
#options_card_name ⇒ Object
-
#options_hash ⇒ Object
or to type/JSON?.
-
#standard_option_names ⇒ Object
Methods included from Card::Set
Methods included from I18nScope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
Methods included from Card::Set::AdvancedApi
#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Class Method Details
.source_location ⇒ Object
8 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 8 def self.source_location; "/Users/ethan/dev/decko/gem/mod/layout/set/abstract/items/options_api.rb"; end |
Instance Method Details
#json_options? ⇒ Boolean
15 16 17 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 15 def &.type_id == JsonID end |
#option_cards ⇒ Object
33 34 35 36 37 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 33 def option_cards option_names.map do |name| Card.fetch name, new: {} end end |
#option_hash_from_names ⇒ Object
19 20 21 22 23 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 19 def option_hash_from_names option_names.each_with_object({}) do |name, hash| hash[name] = name end end |
#option_names ⇒ Object
25 26 27 28 29 30 31 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 25 def option_names if ( = item_names) (standard_option_names + ).uniq else standard_option_names end end |
#option_names_from_items ⇒ Object
47 48 49 50 51 52 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 47 def option_names_from_items o_card = limit = o_card.try(:default_limit).to_i context_name = right_type? ? nil : name o_card.item_names context: context_name, limit: limit end |
#options_card ⇒ Object
54 55 56 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 54 def @options_card ||= rule_card(:content_options) || || Card[:all] end |
#options_card_name ⇒ Object
58 59 60 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 58 def &.name&.url_key end |
#options_hash ⇒ Object
or to type/JSON?
11 12 13 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 11 def ? .parse_content : option_hash_from_names end |
#standard_option_names ⇒ Object
39 40 41 42 43 44 45 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/abstract/items/options_api.rb', line 39 def standard_option_names if .values.map(&:to_name) else option_names_from_items end end |