Module: Card::Set::Type::Mod
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-card/mod001-core/type/mod.rb,
platypus/tmp/set/gem-defaults/mod004-format/type/mod.rb,
platypus/tmp/set/gem-defaults/mod018-assets/type/mod.rb
Overview
Defined Under Namespace
Modules: HtmlFormat
Constant Summary
Constants included
from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included
from Event::Api
Event::Api::OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Card::Set
reset
Methods included from I18nScope
#mod_name, #scope
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
#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
#include_set, #include_set_formats
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
Class Method Details
.source_location ⇒ Object
8
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 8
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/type/mod.rb"; end
|
Instance Method Details
#admin_config ⇒ Object
187
188
189
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 187
def admin_config
@admin_config ||= load_admin_config
end
|
#admin_config_exists? ⇒ Boolean
218
219
220
221
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 218
def admin_config_exists?
@admin_config_exists = !admin_config_path.nil? if @admin_config_exists.nil?
@admin_config_exists
end
|
#admin_config_objects ⇒ Object
191
192
193
194
195
196
197
198
199
200
201
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 191
def admin_config_objects
@admin_config_objects ||= admin_config.map do |category, values|
if values.is_a? Hash
values.map do |subcategory, subvalues|
create_admin_items mod, category, subcategory, subvalues
end.flatten
else
create_admin_items mod, category, nil, values
end
end.flatten
end
|
#admin_config_objects_by_category ⇒ Object
203
204
205
206
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 203
def admin_config_objects_by_category
@admin_config_objects_by_category ||=
admin_config_objects.group_by(&:category)
end
|
#admin_config_path ⇒ Object
223
224
225
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 223
def admin_config_path
@admin_config_path ||= mod&.subpath "config", "admin.yml"
end
|
#admin_config_section(category) ⇒ Object
183
184
185
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 183
def admin_config_section category
admin_config_objects_by_category[category.to_s]
end
|
#cardtypes ⇒ Object
157
158
159
160
161
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 157
def cardtypes
return unless admin_config
config_codenames_grouped_by_title admin_config_section(:cardtypes)
end
|
#cardtypes? ⇒ Boolean
105
106
107
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 105
def cardtypes?
cardtypes.present?
end
|
#configurations ⇒ Object
151
152
153
154
155
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 151
def configurations
return unless admin_config
admin_config["configurations"]
end
|
#configurations? ⇒ Boolean
109
110
111
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 109
def configurations?
configurations.present?
end
|
#depends_on ⇒ Object
137
138
139
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 137
def depends_on
@depends_on ||= card_mods { mod&.spec&.dependencies }
end
|
#depends_on? ⇒ Boolean
125
126
127
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 125
def depends_on?
depends_on.present?
end
|
#description ⇒ Object
169
170
171
172
173
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 169
def description
spec = mod&.spec
default = spec&.description.present? ? spec&.description : spec&.summary
t "#{modname}_mod_description", default: default
end
|
#description? ⇒ Boolean
129
130
131
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 129
def description?
true
end
|
#ensure_mod_asset_card(asset_type) ⇒ Object
8
9
10
11
12
13
14
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/type/mod.rb', line 8
def ensure_mod_asset_card asset_type
asset_card = fetch_mod_assets_card asset_type
return unless asset_card.assets_path
asset_card.save! if asset_card.new?
asset_card.name
end
|
#load_admin_config ⇒ Object
208
209
210
211
212
213
214
215
216
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 208
def load_admin_config
return unless admin_config_exists?
admin_config = YAML.load_file admin_config_path
return {} unless admin_config
admin_config
end
|
179
180
181
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 179
def mod
@mod ||= Cardio::Mod.fetch modname
end
|
175
176
177
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 175
def modname
codename.to_s.gsub(/^mod_/, "")
end
|
#scripts? ⇒ Boolean
121
122
123
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 121
def scripts?
fetch(:script).present?
end
|
145
146
147
148
149
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 145
def settings
return unless admin_config
admin_config["settings"]&.map(&:to_sym)
end
|
#settings? ⇒ Boolean
101
102
103
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 101
def settings?
settings.present?
end
|
#styles? ⇒ Boolean
117
118
119
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 117
def styles?
fetch(:style).present?
end
|
141
142
143
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 141
def tasks
basket[:tasks].select { |_k, v| v[:mod] == modname.to_sym }
end
|
#tasks? ⇒ Boolean
113
114
115
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 113
def tasks?
tasks.present?
end
|
163
164
165
166
167
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 163
def views
return unless admin_config
admin_config["views"]
end
|
#views? ⇒ Boolean
133
134
135
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 133
def views?
views.present?
end
|