Class: Spree::Core::Partials

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/core/partials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, environment) ⇒ Partials

Returns a new instance of Partials.



5
6
7
8
9
# File 'lib/spree/core/partials.rb', line 5

def initialize(config, environment)
  @config = config
  @environment = environment
  define_dynamic_methods
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/spree/core/partials.rb', line 11

def config
  @config
end

#environmentObject (readonly)

Returns the value of attribute environment.



11
12
13
# File 'lib/spree/core/partials.rb', line 11

def environment
  @environment
end

Instance Method Details

#keysObject



17
18
19
# File 'lib/spree/core/partials.rb', line 17

def keys
  partial_members.map { |member| member.to_s.sub(/_partials$/, '') }
end

#partial_membersObject



13
14
15
# File 'lib/spree/core/partials.rb', line 13

def partial_members
  environment.members.select { |member| member.to_s.end_with?('_partials') }
end