Sha256: 4b80667253d1d86959e1311a9524618647bdff6ab9e86a6f97eef2599a2d15a0
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
module Transcriber class Resource class Key attr_accessor :name attr_accessor :model attr_accessor :options attr_accessor :summarize def initialize(name, options = {}) @name = name @options = options end def present?(resource) return true unless options[:if] resource.instance_eval &options[:if] end def visible?(resource) if present? resource return true if options[:visible].nil? return options[:visible] unless options[:visible].kind_of?(Proc) return resource.instance_eval &options[:visible] end false end def input_path return @input_path if @input_path path = InputPath.resolve(options, convert_input_keys) @input_path = path.empty? ? convert_input_keys.call([name]) : path end def convert_input_keys options.fetch(:convert_input_keys, model.try(:convert_input_keys) || Transcriber.configuration.convert_input_keys) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems