Sha256: e7d8dcb2f6e4299cd911030a038f528339db1aa614cf37b17aa0101d5865029e
Contents?: true
Size: 862 Bytes
Versions: 1
Compression:
Stored size: 862 Bytes
Contents
module InertiaRails mattr_accessor :shared_plain_data, default: {} mattr_accessor :shared_blocks, default: [] def self.configure yield(Configuration) end # "Getters" def self.shared_data shared_plain_data.merge!(evaluated_blocks(shared_blocks)) end def self.version Configuration.evaluated_version end def self.layout Configuration.layout end # "Setters" def self.share(**args) shared_plain_data.merge!(args) end def self.share_block(block) shared_blocks.push(block) end private module Configuration mattr_accessor :layout, default: 'application' mattr_accessor :version, default: nil def self.evaluated_version version.respond_to?(:call) ? version.call : version end end def self.evaluated_blocks(blocks) blocks.flat_map(&:call).reduce(&:merge) || {} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inertia_rails-1.0.0 | lib/inertia_rails/inertia_rails.rb |