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
192
193
194
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 192
def admin_config
@admin_config ||= load_admin_config
end
|
#admin_config_exists? ⇒ Boolean
221
222
223
224
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 221
def admin_config_exists?
@admin_config_exists = !admin_config_path.nil? if @admin_config_exists.nil?
@admin_config_exists
end
|
#admin_config_objects ⇒ Object
196
197
198
199
200
201
202
203
204
205
206
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 196
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
208
209
210
211
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 208
def admin_config_objects_by_category
@admin_config_objects_by_category ||=
admin_config_objects.group_by(&:category)
end
|
#admin_config_path ⇒ Object
226
227
228
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 226
def admin_config_path
@admin_config_path ||= mod&.subpath "config", "admin.yml"
end
|
#admin_config_section(category) ⇒ Object
188
189
190
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 188
def admin_config_section category
admin_config_objects_by_category[category.to_s]
end
|
#cardtypes ⇒ Object
159
160
161
162
163
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 159
def cardtypes
return unless admin_config
config_codenames_grouped_by_title admin_config_section(:cardtypes)
end
|
#cardtypes? ⇒ Boolean
102
103
104
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 102
def cardtypes?
cardtypes.present?
end
|
#configurations ⇒ Object
153
154
155
156
157
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 153
def configurations
return unless admin_config
admin_config["configurations"]
end
|
#configurations? ⇒ Boolean
106
107
108
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 106
def configurations?
configurations.present?
end
|
#depends_on ⇒ Object
134
135
136
137
138
139
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 134
def depends_on
mod&.spec&.dependencies
&.map { |dep| dep.name }
&.select { |name| name.starts_with? "card-mod" }
&.map { |name| "mod_#{name[8..-1]}" }
end
|
#depends_on? ⇒ Boolean
122
123
124
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 122
def depends_on?
mod&.spec&.dependencies.present?
end
|
#description ⇒ Object
171
172
173
174
175
176
177
178
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 171
def description
default = if mod&.spec&.description.present?
mod&.spec&.description
else
mod&.spec&.summary
end
t("#{modname}_mod_description", default: default)
end
|
#description? ⇒ Boolean
126
127
128
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 126
def description?
true
end
|
#ensure_mod_asset_card(asset_type) ⇒ Object
9
10
11
12
13
14
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/type/mod.rb', line 9
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
213
214
215
216
217
218
219
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 213
def load_admin_config
return unless admin_config_exists?
admin_config = YAML.load_file admin_config_path
return {} unless admin_config admin_config
end
|
184
185
186
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 184
def mod
@mod ||= Cardio::Mod.fetch modname
end
|
180
181
182
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 180
def modname
codename.to_s.gsub(/^mod_/, "")
end
|
#scripts? ⇒ Boolean
118
119
120
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 118
def scripts?
fetch(:script).present?
end
|
145
146
147
148
149
150
151
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 145
def settings
return unless admin_config
admin_config["settings"]&.map do |setting|
setting.to_sym
end
end
|
#settings? ⇒ Boolean
98
99
100
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 98
def settings?
settings.present?
end
|
#styles? ⇒ Boolean
114
115
116
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 114
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
110
111
112
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 110
def tasks?
tasks.present?
end
|
165
166
167
168
169
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 165
def views
return unless admin_config
admin_config["views"]
end
|
#views? ⇒ Boolean
130
131
132
|
# File 'platypus/tmp/set/gem-card/mod001-core/type/mod.rb', line 130
def views?
views.present?
end
|