Module: Card::Set::Abstract::AssetGroup

Extended by:
Card::Set
Defined in:
platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb

Overview

Set: Abstract (AssetGroup)

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

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

#event

Class Method Details

.source_locationObject

[View source]

7
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/mod/assets/set/abstract/asset_group.rb"; end

Instance Method Details

#asset_input_needs_refresh?Boolean

Returns:

  • (Boolean)
[View source]

56
57
58
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 56

def asset_input_needs_refresh?
  !asset_input_updated_at || source_changed?(since: asset_input_updated_at)
end

#input_item_cardsObject

[View source]

51
52
53
54
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 51

def input_item_cards
  item_cards # we create virtual cards for manifest groups, hence we have
  # to override the default which rejects virtual cards.
end

#item_cards(_args = {}) ⇒ Object

[View source]

22
23
24
25
26
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 22

def item_cards _args={}
  relative_paths.map do |path|
    new_asset_file_card path
  end.compact
end

#last_file_changeObject

[View source]

60
61
62
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 60

def last_file_change
  paths.map { |path| ::File.mtime(path) }.max
end

#localObject

[View source]

43
44
45
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 43

def local
  @local = true
end

#new_asset_file_card(path, name = ::File.basename(path)) ⇒ Object

[View source]

28
29
30
31
32
33
34
35
36
37
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 28

def new_asset_file_card path, name=::File.basename(path)
  return unless (constants = new_asset_constants path)
  asset_card = Card.new(name: name, type_id: constants[:type_id], content: path)
  asset_card.include_set_module constants[:set_module]
  asset_card.minimize if @minimize
  asset_card.local if @local
  asset_card.base_path = base_path
  asset_card.files_must_exist!
  asset_card
end

#render_items_and_compress(format) ⇒ Object

[View source]

16
17
18
19
20
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 16

def render_items_and_compress format
  item_cards.compact.map do |mcard|
    mcard.format(format)._render_compressed
  end.join "\n"
end

#source_changed?(since:) ⇒ Boolean

Returns:

  • (Boolean)
[View source]

47
48
49
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 47

def source_changed? since:
  existing_source_paths.any? { |path| ::File.mtime(path) > since }
end

#source_pathsObject

[View source]

39
40
41
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 39

def source_paths
  paths
end

#virtual?Boolean

Returns:

  • (Boolean)
[View source]

12
13
14
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_group.rb', line 12

def virtual?
  new?
end