{: rooto:"YARD::CodeObjects::RootObject:@childrenIC:&YARD::CodeObjects::CodeObjectList[o:#YARD::CodeObjects::ClassObject;IC;[2o:$YARD::CodeObjects::MethodObject:@module_functionF: @scope: class:@visibility: public: @pathI"$Card.serializable_attr_accessor:EF:@parameters[[I" *args;T0: @files[[I"lib/card.rb;Ti[I"lib/card.rb;Ti[I"lib/card.rb;Ti:@current_file_has_commentsT: @name:serializable_attr_accessor:@source_type: ruby: @tags[:@docstrings{:@docstringIC:YARD::Docstring")attributes that ActiveJob can handle ;T:@ref_tags[;[: @allI")attributes that ActiveJob can handle;T:@unresolved_reference0: @object@ :@hash_flagF:@line_rangeo: Range: exclF: begini:endi:@namespace@:@signatureI"*def serializable_attr_accessor(*args);T:@explicitT: @sourceI"ndef self.serializable_attr_accessor *args self.serializable_attributes = args attr_accessor *args end;T: @dynamicTo; ; F; : instance;;;I"Card#follower_stash;F;[;[[@i<[@i;[@i:;F;:follower_stash;;;[;{;IC;"2Returns the value of attribute follower_stash ;T; @: @summary0;!F;[;[;I"2Returns the value of attribute follower_stash;T;0;'@;(I"def follower_stash;T;*I"-def follower_stash @follower_stash end;T;+To; ; F; ;,;;;I"Card#follower_stash=;F;[[I" value;T0;[[@i<[@i;[@i:;F;:follower_stash=;;;[;{;IC;"&Sets the attribute follower_stash ;T; @.;.0;!F;[;[o:YARD::Tags::Tag :@tag_nameI" param;F: @textI"6the value to set the attribute follower_stash to.;T;I" value;T: @types0; @.;I"eSets the attribute follower_stash @param value the value to set the attribute follower_stash to.;T;0;'@;(I"def follower_stash=(value);T;*I"=def follower_stash=(value) @follower_stash = value end;T;+To:&YARD::CodeObjects::ConstantObject;[[@iE[@iD[@iC;F;:TRACKED_FIELDS;;;;;[;{;IC;" ;T; @C;.0;!F;[;[;I";T;0;'@;I"Card::TRACKED_FIELDS;F;(I"7TRACKED_FIELDS = %w(name type_id db_content trash);T;*I"7TRACKED_FIELDS = %w(name type_id db_content trash);T: @valueI"&%w(name type_id db_content trash);T;+To; ;IC;[o; ;IC;[o; ; F; ; ;;;I"Card::Log::Request.path;F;[;[[I"lib/card/log.rb;Ti ;F;: path;;;[;{;IC;" ;T; @V;.0;!F;[;[;I";T;0;'@T;(I"def self.path;T;)T;*I"def self.path path = (Card.paths['request_log'] && Card.paths['request_log'].first) || File.dirname(Card.paths['log'].first) filename = "#{Date.today}_#{Rails.env}.csv" File.join path, filename end;T;+To; ; F; ; ;;;I"'Card::Log::Request.write_log_entry;F;[[I"controller;T0;[[@[i;F;:write_log_entry;;;[;{;IC;" ;T; @d;.0;!F;[;[;I";T;0;'@T;(I"(def self.write_log_entry controller;T;)T;*I"def self.write_log_entry controller return if controller.env["REQUEST_URI"] =~ %r{^/files?/} controller.instance_eval do log = [] log << (Card::Env.ajax? ? "YES" : "NO") log << env["REMOTE_ADDR"] log << Card::Auth.current_id log << card.name log << action_name log << params['view'] || (s = params['success'] and s['view']) log << env["REQUEST_METHOD"] log << status log << env["REQUEST_URI"] log << DateTime.now.to_s log << env['HTTP_ACCEPT_LANGUAGE'].to_s.scan(/^[a-z]{2}/).first log << env["HTTP_REFERER"] File.open(Card::Log::Request.path, "a") do |f| f.write CSV.generate_line(log) end end end;T;+T: @owner@T:@class_mixinsIC;[;9@T:@instance_mixinsIC;[;9@T:@attributesIC:SymbolHash{; IC;={:@symbolize_valueT;,IC;={;>T;>T: @aliases{: @groups[;[[@[i ;F;: Request;;;;;[;{;IC;" ;T; @T;.0;!F;[;[;I";T;0;'@R;I"Card::Log::Request;F:@superclasso:YARD::CodeObjects::Proxy : @imethod0:@origname0:@orignamespace0;: Object;'@: @objo; ;IC;[ o; ; F; ;,;;;I"Object#deep_clone;F;[;[[I"lib/card/core_ext.rb;Ti;T;:deep_clone;;;[;{;IC;"1FIXME: move this, mixin, don't extend Object ;T;[;[;I"1FIXME: move this, mixin, don't extend Object;T;0; @;!F;"o;#;$F;%i;&i;'@;(I"def deep_clone;T;)T;*I"def deep_clone case self when Fixnum,Bignum,Float,NilClass,FalseClass,TrueClass,Symbol klone = self when Hash klone = self.clone self.each{|k,v| klone[k] = v.deep_clone} when Array klone = self.clone klone.clear self.each{|v| klone << v.deep_clone} else klone = self.clone end klone.instance_variables.each {|v| klone.instance_variable_set(v, klone.instance_variable_get(v).deep_clone) } klone end;T;+To; ; F; ;,;;;I"Object#send_unless;F;[[I" method;T0[I" *args;T0[I" &block;T0;[[@i;F;:send_unless;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"*def send_unless method, *args, &block;T;)T;*I"gdef send_unless method, *args, &block ( block_given? ? yield : self ) or send method, *args end;T;+To; ; F; ;,;;;I"Object#send_if;F;[[I" method;T0[I" *args;T0[I" &block;T0;[[@i!;F;: send_if;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"*def send_if method, *args, &block;T;)T;*I"gdef send_if method, *args, &block ( block_given? ? yield : self ) and send method, *args end;T;+To; ; F; ;,;;;I"Object#to_name;F;[;[[@i%;F;: to_name;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def to_name;T;)T;*I"*def to_name Card::Name.new self end;T;+To; ; F; ;,;;;I"Object#to_viewname;F;[;[[@i);F;:to_viewname;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def to_viewname;T;)T;*I"2def to_viewname Card::ViewName.new self end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i;F;;G;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I" Object;F;Bo;C ;D0;E0;F0;:BasicObject;'@;H0: @type; ;O; ;+To; ;IC;["o;4;[[@[iM;T;:DEFAULT_CLASS;;;;;[;{;IC;""To enable logging add a performance_logger hash to your configuration Example: config.performance_logger = { :min_time => 100, # show only method calls that are slower than 100ms :max_depth => 3, # show nested method calls only up to depth 3 :details=> true, # show method arguments and sql :methods => [:event, :search, :fetch, :view], # choose methods to log :log_level => :info } If you give :methods a hash you can log arbitrary methods. The syntax is as follows: class => method type => method name => log options Example: Card => { :instance => [ :fetch, :search ], :singleton => { :fetch => { :title => 'Card.fetch' } }, :all => { :fetch => { :message => 2 # use second argument passed to fetch :details => :to_s # use return value of to_s in method context :title => proc { |method_context| method_context.name } }, }, }, class, method type and log options are optional. Default values are 'Card', ':all' and { :title => method name, :message => first argument, :details=> remaining arguments }. For example [:fetch] is equivalent to Card => { :all => { :fetch => { :message=>1, :details=>1..-1 } } ;T;[;[;I""To enable logging add a performance_logger hash to your configuration Example: config.performance_logger = { :min_time => 100, # show only method calls that are slower than 100ms :max_depth => 3, # show nested method calls only up to depth 3 :details=> true, # show method arguments and sql :methods => [:event, :search, :fetch, :view], # choose methods to log :log_level => :info } If you give :methods a hash you can log arbitrary methods. The syntax is as follows: class => method type => method name => log options Example: Card => { :instance => [ :fetch, :search ], :singleton => { :fetch => { :title => 'Card.fetch' } }, :all => { :fetch => { :message => 2 # use second argument passed to fetch :details => :to_s # use return value of to_s in method context :title => proc { |method_context| method_context.name } }, }, }, class, method type and log options are optional. Default values are 'Card', ':all' and { :title => method name, :message => first argument, :details=> remaining arguments }. For example [:fetch] is equivalent to Card => { :all => { :fetch => { :message=>1, :details=>1..-1 } };T;0; @;!F;"o;#;$F;%i.;&iK;'@;I"*Card::Log::Performance::DEFAULT_CLASS;F;(I"#DEFAULT_CLASS = Card;T;*I"#DEFAULT_CLASS = Card;T;6I" Card;T;+To;4;[[@[iN;F;:DEFAULT_METHOD_TYPE;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"0Card::Log::Performance::DEFAULT_METHOD_TYPE;F;(I"#DEFAULT_METHOD_TYPE = :all;T;*I"#DEFAULT_METHOD_TYPE = :all;T;6I" :all;T;+To;4;[[@[iO;F;:DEFAULT_LOG_LEVEL;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I".Card::Log::Performance::DEFAULT_LOG_LEVEL;F;(I"$DEFAULT_LOG_LEVEL = :info;T;*I"$DEFAULT_LOG_LEVEL = :info;T;6I" :info;T;+To;4;[[@[iP;F;:DEFAULT_METHOD_OPTIONS;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;I"3Card::Log::Performance::DEFAULT_METHOD_OPTIONS;F;(I" DEFAULT_METHOD_OPTIONS = {;T;*I"vDEFAULT_METHOD_OPTIONS = { :title => :method_name, :message => 1, :details => 1..-1, :context => nil };T;6I"\{ :title => :method_name, :message => 1, :details => 1..-1, :context => nil };T;+To;4;[[@[iW;F;:SPECIAL_METHODS;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I",Card::Log::Performance::SPECIAL_METHODS;F;(I"kSPECIAL_METHODS = [:search, :view, :event] # these methods have already a Wagn.with_logging block;T;*I"3SPECIAL_METHODS = [:search, :view, :event];T;6I"[:search, :view, :event];T;+To;4;[[@[i\;F;: TAB_SIZE;;;;;[;{;IC;" ;T; @%;.0;!F;[;[;I";T;0;'@;I"%Card::Log::Performance::TAB_SIZE;F;(I"TAB_SIZE = 3;T;*I"TAB_SIZE = 3;T;6I"3;T;+To:+YARD::CodeObjects::ClassVariableObject;[[@[i];F;: @@log;;;;;[;{;IC;" ;T; @2;.0;!F;[;[;I";T;0;'@;I""Card::Log::Performance::@@log;F;(I"@@log = [];T;*I"@@log = [];T;6I"[];T;+To;V;[[@[i^;F;:@@context_entries;;;;;[;{;IC;" ;T; @?;.0;!F;[;[;I";T;0;'@;I".Card::Log::Performance::@@context_entries;F;(I"@@context_entries = [];T;*I"@@context_entries = [];T;6I"[];T;+To;V;[[@[i_;F;:@@active_entries;;;;;[;{;IC;" ;T; @L;.0;!F;[;[;I";T;0;'@;I"-Card::Log::Performance::@@active_entries;F;(I"@@active_entries = [];T;*I"@@active_entries = [];T;6I"[];T;+To;V;[[@[i`;F;:@@current_level;;;;;[;{;IC;" ;T; @Y;.0;!F;[;[;I";T;0;'@;I",Card::Log::Performance::@@current_level;F;(I"@@current_level = 0;T;*I"@@current_level = 0;T;6I"0;T;+To; ; F; ; ;;;I",Card::Log::Performance.params_to_config;F;[[I" args;T0;[[@[id;F;:params_to_config;;;[;{;IC;" ;T; @f;.0;!F;[;[;I";T;0;'@;(I"def params_to_config args;T;)T;*I"def params_to_config args args[:details] = args[:details] == 'true' ? true : false args[:max_depth] &&= args[:max_depth].to_i args[:min_time] &&= args[:min_time].to_i args[:output] &&= args[:output].to_sym if args[:methods] if args[:methods].kind_of?(String) && args[:methods].match(/^\[.+\]$/) args[:methods] = JSON.parse(args[:methods]).map(&:to_sym) elsif args[:methods].kind_of?(Array) args[:methods].map!(&:to_sym) end end args end;T;+To; ; F; ; ;;;I"'Card::Log::Performance.load_config;F;[[I" args;T0;[[@[is;F;:load_config;;;[;{;IC;" ;T; @u;.0;!F;[;[;I";T;0;'@;(I"def load_config args;T;)T;*I"ndef load_config args args = params_to_config args @details = args[:details] || false @max_depth = args[:max_depth] || false @min_time = args[:min_time] || false @log_level = args[:log_level] || DEFAULT_LOG_LEVEL @output = args[:output] || :text @enabled_methods = ::Set.new prepare_methods_for_logging args[:methods] if args[:methods] end;T;+To; ; F; ; ;;;I"!Card::Log::Performance.start;F;[[I" args;TI"{};T;[[@[i~;F;: start;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def start args={};T;)T;*I"def start args={} @@current_level = 0 @@log = [] @@context_entries = [] @@active_entries = [] @@first_entry = new_entry(args) end;T;+To; ; F; ; ;;;I" Card::Log::Performance.stop;F;[;[[@[i;F;: stop;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I" def stop;T;)T;*I"def stop while (entry = @@context_entries.pop) do finish_entry entry end if @@first_entry @@first_entry.save_duration finish_entry @@first_entry end print_log end;T;+To; ; F; ; ;;;I"&Card::Log::Performance.with_timer;F;[[I" method;T0[I" args;T0[I" &block;T0;[[@[i;F;:with_timer;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"(def with_timer method, args, &block;T;)T;*I"def with_timer method, args, &block if args[:context] # if the previous context was created by an entry on the same level # then finish the current context if it's a different context if @@context_entries.last && @@current_level == @@context_entries.last.level+1 && args[:context] != @@context_entries.last.context finish_entry @@context_entries.pop end # start new context if it's different from the parent context if @@context_entries.empty? || args[:context] != @@context_entries.last.context @@context_entries << new_entry( :title=>'process', :message=>args[:context], :context=>args[:context] ) end end timer = new_entry args.merge(:method=>method ) begin result = block.call ensure timer.save_duration finish_entry timer # finish all deeper nested contexts while @@context_entries.last && @@context_entries.last.level >= @@current_level finish_entry @@context_entries.pop end # we don't know whether the next entry will belong to the same context or will start a new one # so we save the time @@context_entries.last.save_duration if @@context_entries.last end result end;T;+To; ; F; ; ;;;I")Card::Log::Performance.enable_method;F;[[I"method_name;T0;[[@[i;F;:enable_method;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I""def enable_method method_name;T;)T;*I"idef enable_method method_name @enabled_methods ||= ::Set.new @enabled_methods << method_name end;T;+To; ; F; ; ;;;I"+Card::Log::Performance.enabled_method?;F;[[I"method_name;T0;[[@[i;F;:enabled_method?;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @;I";T;0;'@;(I"$def enabled_method? method_name;T;)T;*I"edef enabled_method? method_name @enabled_methods && @enabled_methods.include?(method_name) end;T;+To; ; F; ; ;: private;I"%Card::Log::Performance.print_log;F;[;[[@[i;F;:print_log;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def print_log;T;)T;*I"def print_log if @output == :card && Card[:performance_log] Card[:performance_log].add_log_entry @@log.first.message, html_log elsif @output == :html html_log else text_log end end;T;+To; ; F; ; ;;b;I"$Card::Log::Performance.text_log;F;[;[[@[i;F;: text_log;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def text_log;T;)T;*I"pdef text_log @@log.each do |entry| Rails.logger.send @log_level, entry.to_s! if entry.valid end end;T;+To; ; F; ; ;;b;I"$Card::Log::Performance.html_log;F;[;[[@[i;F;: html_log;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def html_log;T;)T;*I"def html_log @html_log ||= begin list = @@log.inject([]) do |tree, entry| if entry.parent #entry.parent.children << entry else tree << entry end tree end list_to_accordion list end end;T;+To; ; F; ; ;;b;I"-Card::Log::Performance.list_to_accordion;F;[[I" list;T0;[[@[i;F;:list_to_accordion;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def list_to_accordion list;T;)T;*I"def list_to_accordion list list.map do |entry| if entry.children && entry.children.present? accordion_entry entry else "
  • #{simple_entry entry}
  • " end end.join "\n" end;T;+To; ; F; ; ;;b;I"(Card::Log::Performance.simple_entry;F;[[I" entry;T0;[[@[i;F;:simple_entry;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;(I"def simple_entry entry;T;)T;*I"/def simple_entry entry entry.to_html end;T;+To; ; F; ; ;;b;I"+Card::Log::Performance.accordion_entry;F;[[I" entry;T0;[[@[i;F;:accordion_entry;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def accordion_entry entry;T;)T;*I"def accordion_entry entry panel_body = list_to_accordion entry.children collapse_id = entry.hash.to_s %{
    } end;T;+To; ; F; ; ;;b;I"%Card::Log::Performance.new_entry;F;[[I" args;T0;[[@[i;F;:new_entry;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@;(I"def new_entry args;T;)T;*I"jdef new_entry args args.delete(:details) unless @details level = @@current_level last_entry = @@active_entries.last parent = if last_entry last_entry.level == level ? last_entry.parent : last_entry end @@log << Card::Log::Performance::Entry.new(parent, level, args ) @@current_level += 1 @@active_entries << @@log.last @@log.last end;T;+To; ; F; ; ;;b;I"(Card::Log::Performance.finish_entry;F;[[I" entry;T0;[[@[i;F;:finish_entry;;;[;{;IC;" ;T; @:;.0;!F;[;[;I";T;0;'@;(I"def finish_entry entry;T;)T;*I"def finish_entry entry if (@max_depth && entry.level > @max_depth) || (@min_time && entry.duration < @min_time) entry.delete end @@active_entries.pop @@current_level -= 1 end;T;+To; ; F; ; ;;b;I"7Card::Log::Performance.prepare_methods_for_logging;F;[[I" args;T0;[[@[i;F;: prepare_methods_for_logging;;;[;{;IC;" ;T; @I;.0;!F;[;[;I";T;0;'@;(I")def prepare_methods_for_logging args;T;)T;*I"def prepare_methods_for_logging args classes = hashify_and_verify_keys( args, DEFAULT_CLASS ) do |key| key.kind_of?(Class) || key.kind_of?(Module) end classes.each do |klass, method_types| klass.extend BigBrother # add watch methods method_types = hashify_and_verify_keys( method_types, DEFAULT_METHOD_TYPE ) do |key| [:all, :instance, :singleton].include? key end method_types.each do |method_type, methods| methods = hashify_and_verify_keys methods methods.each do |method_name, options| klass.watch_method method_name, method_type, DEFAULT_METHOD_OPTIONS.merge(options) end end end end;T;+To; ; F; ; ;;b;I"3Card::Log::Performance.hashify_and_verify_keys;F;[[I" args;T0[I"default_key;TI"nil;T;[[@[i/;F;:hashify_and_verify_keys;;;[;{;IC;" ;T; @X;.0;!F;[;[;I";T;0;'@;(I"6def hashify_and_verify_keys args, default_key=nil;T;)T;*I"Zdef hashify_and_verify_keys args, default_key=nil if default_key case args when Symbol { default_key => [ args ] } when Array { default_key => args } when Hash if block_given? args.keys.select{ |key| !(yield(key)) }.each do |key| args[default_key] = { key => args[key] } args.delete key end end args end else case args when Symbol { args => {} } when Array args.inject({}) do |h, key| h[key] = {} h end else args end end end;T;+To; ;IC;[o; ; F; ;,;;;I"(Card::Log::Performance::Entry#level;F;[;[[@[iR;F;: level;;;[;{;IC;")Returns the value of attribute level ;T; @l;.0;!F;[;[;I")Returns the value of attribute level;T;0;'@j;(I"def level;T;*I"def level @level end;T;+To; ; F; ;,;;;I")Card::Log::Performance::Entry#level=;F;[[I" value;T0;[[@[iR;F;: level=;;;[;{;IC;"Sets the attribute level ;T; @y;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute level to.;T;I" value;T;30; @y;I"SSets the attribute level @param value the value to set the attribute level to.;T;0;'@j;(I"def level=(value);T;*I"+def level=(value) @level = value end;T;+To; ; F; ;,;;;I"(Card::Log::Performance::Entry#valid;F;[;[[@[iR;F;: valid;;;[;{;IC;")Returns the value of attribute valid ;T; @;.0;!F;[;[;I")Returns the value of attribute valid;T;0;'@j;(I"def valid;T;*I"def valid @valid end;T;+To; ; F; ;,;;;I")Card::Log::Performance::Entry#valid=;F;[[I" value;T0;[[@[iR;F;: valid=;;;[;{;IC;"Sets the attribute valid ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute valid to.;T;I" value;T;30; @;I"SSets the attribute valid @param value the value to set the attribute valid to.;T;0;'@j;(I"def valid=(value);T;*I"+def valid=(value) @valid = value end;T;+To; ; F; ;,;;;I"*Card::Log::Performance::Entry#context;F;[;[[@[iR;F;: context;;;[;{;IC;"+Returns the value of attribute context ;T; @;.0;!F;[;[;I"+Returns the value of attribute context;T;0;'@j;(I"def context;T;*I"def context @context end;T;+To; ; F; ;,;;;I"+Card::Log::Performance::Entry#context=;F;[[I" value;T0;[[@[iR;F;: context=;;;[;{;IC;"Sets the attribute context ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I"/the value to set the attribute context to.;T;I" value;T;30; @;I"WSets the attribute context @param value the value to set the attribute context to.;T;0;'@j;(I"def context=(value);T;*I"/def context=(value) @context = value end;T;+To; ; F; ;,;;;I")Card::Log::Performance::Entry#parent;F;[;[[@[iR;F;: parent;;;[;{;IC;"*Returns the value of attribute parent ;T; @;.0;!F;[;[;I"*Returns the value of attribute parent;T;0;'@j;(I"def parent;T;*I"def parent @parent end;T;+To; ; F; ;,;;;I"*Card::Log::Performance::Entry#parent=;F;[[I" value;T0;[[@[iR;F;: parent=;;;[;{;IC;"Sets the attribute parent ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I".the value to set the attribute parent to.;T;I" value;T;30; @;I"USets the attribute parent @param value the value to set the attribute parent to.;T;0;'@j;(I"def parent=(value);T;*I"-def parent=(value) @parent = value end;T;+To; ; F; ;,;;;I"/Card::Log::Performance::Entry#children_cnt;F;[;[[@[iR;F;:children_cnt;;;[;{;IC;"0Returns the value of attribute children_cnt ;T; @;.0;!F;[;[;I"0Returns the value of attribute children_cnt;T;0;'@j;(I"def children_cnt;T;*I")def children_cnt @children_cnt end;T;+To; ; F; ;,;;;I"0Card::Log::Performance::Entry#children_cnt=;F;[[I" value;T0;[[@[iR;F;:children_cnt=;;;[;{;IC;"$Sets the attribute children_cnt ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I"4the value to set the attribute children_cnt to.;T;I" value;T;30; @;I"aSets the attribute children_cnt @param value the value to set the attribute children_cnt to.;T;0;'@j;(I"def children_cnt=(value);T;*I"9def children_cnt=(value) @children_cnt = value end;T;+To; ; F; ;,;;;I"+Card::Log::Performance::Entry#duration;F;[;[[@[iR;F;: duration;;;[;{;IC;",Returns the value of attribute duration ;T; @ ;.0;!F;[;[;I",Returns the value of attribute duration;T;0;'@j;(I"def duration;T;*I"!def duration @duration end;T;+To; ; F; ;,;;;I",Card::Log::Performance::Entry#duration=;F;[[I" value;T0;[[@[iR;F;:duration=;;;[;{;IC;" Sets the attribute duration ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I"0the value to set the attribute duration to.;T;I" value;T;30; @;I"YSets the attribute duration @param value the value to set the attribute duration to.;T;0;'@j;(I"def duration=(value);T;*I"1def duration=(value) @duration = value end;T;+To; ; F; ;,;;;I"+Card::Log::Performance::Entry#children;F;[;[[@[iR;F;: children;;;[;{;IC;",Returns the value of attribute children ;T; @,;.0;!F;[;[;I",Returns the value of attribute children;T;0;'@j;(I"def children;T;*I"!def children @children end;T;+To; ; F; ;,;;;I",Card::Log::Performance::Entry#children=;F;[[I" value;T0;[[@[iR;F;:children=;;;[;{;IC;" Sets the attribute children ;T; @9;.0;!F;[;[o;0 ;1I" param;F;2I"0the value to set the attribute children to.;T;I" value;T;30; @9;I"YSets the attribute children @param value the value to set the attribute children to.;T;0;'@j;(I"def children=(value);T;*I"1def children=(value) @children = value end;T;+To; ; F; ;,;;;I"*Card::Log::Performance::Entry#message;F;[;[[@[iS;F;: message;;;[;{;IC;"+Returns the value of attribute message ;T; @L;.0;!F;[;[;I"+Returns the value of attribute message;T;0;'@j;(I"def message;T;*I"def message @message end;T;+To; ; F; ;,;;;I"-Card::Log::Performance::Entry#initialize;F;[[I" parent;T0[I" level;T0[I" args;T0;[[@[iU;F;:initialize;;;[;{;IC;" ;T; @Y;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of Entry;T;0;3[I" Entry;F; @Y;I";T;0;'@j;(I"*def initialize( parent, level, args );T;)T;*I"def initialize( parent, level, args ) @start = Time.new @message = "#{ args[:title] || args[:method] || '' }" @message += ": #{ args[:message] }" if args[:message] @details = args[:details] @context = args[:context] @level = level @duration = nil @valid = true @parent = parent @children_cnt = 0 @children = [] if @parent @parent.add_children self #@sibling_nr = @parent.children_cnt end end;T;+To; ; F; ;,;;;I"/Card::Log::Performance::Entry#add_children;F;[[I" child;TI" false;T;[[@[ig;F;:add_children;;;[;{;IC;" ;T; @q;.0;!F;[;[;I";T;0;'@j;(I"!def add_children child=false;T;)T;*I"Xdef add_children child=false @children_cnt += 1 @children << child if child end;T;+To; ; F; ;,;;;I"2Card::Log::Performance::Entry#delete_children;F;[[I" child;TI" false;T;[[@[il;F;:delete_children;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@j;(I"$def delete_children child=false;T;)T;*I"`def delete_children child=false @children_cnt -= 1 @children.delete child if child end;T;+To; ; F; ;,;;;I"8Card::Log::Performance::Entry#has_younger_siblings?;F;[;[[@[ir;F;:has_younger_siblings?;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @;I";T;0;'@j;(I"def has_younger_siblings?;T;)T;*I"Udef has_younger_siblings? @parent && @parent.children_cnt > 0 #@sibling_nr end;T;+To; ; F; ;,;;;I"0Card::Log::Performance::Entry#save_duration;F;[;[[@[iv;F;:save_duration;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@j;(I"def save_duration;T;)T;*I"Cdef save_duration @duration = (Time.now - @start) * 1000 end;T;+To; ; F; ;,;;;I")Card::Log::Performance::Entry#delete;F;[;[[@[iz;F;: delete;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@j;(I"def delete;T;)T;*I"Odef delete @valid = false @parent.delete_children(self) if @parent end;T;+To; ; F; ;,;;;I"(Card::Log::Performance::Entry#to_s!;F;[;[[@[i;T;: to_s!;;;[;{;IC;"deletes the children counts in order to print the tree; must be called in the right order More robuts but more expensive approach: use @sibling_nr instead of counting @children_cnt down, but @sibling_nr has to be updated for all siblings of an entry if the entry gets deleted due to min_time or max_depth restrictions in the config, so we have to save all children relations for that ;T;[;[;I"deletes the children counts in order to print the tree; must be called in the right order More robuts but more expensive approach: use @sibling_nr instead of counting @children_cnt down, but @sibling_nr has to be updated for all siblings of an entry if the entry gets deleted due to min_time or max_depth restrictions in the config, so we have to save all children relations for that;T;0; @;!F;"o;#;$F;%i;&i;'@j;(I"def to_s!;T;)T;*I"&def to_s! @to_s ||= begin msg = indent msg += "(%d.2ms) " % @duration if @duration msg += @message if @message if @details msg += ", " + @details.to_s.gsub( "\n", "\n#{ indent(false) }#{' '* TAB_SIZE}" ) end @parent.delete_children if @parent msg end end;T;+To; ; F; ;,;;;I"*Card::Log::Performance::Entry#to_html;F;[;[[@[i;F;: to_html;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@j;(I"def to_html;T;)T;*I"def to_html @to_html ||= begin msg = "" msg += @message if @message msg += " %d.2ms " % @duration if @duration msg += '' end end;T;+To; ; F; ;,;;b;I")Card::Log::Performance::Entry#indent;F;[[I" link;TI" true;T;[[@[i;F;: indent;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@j;(I"def indent link=true;T;)T;*I"fdef indent link=true @indent ||= begin if @level == 0 "\n" else res = ' ' res += (1..level-1).inject('') do |msg, index| if younger_siblings[index] msg << '|' + ' ' * (TAB_SIZE-1) else msg << ' ' * TAB_SIZE end end res += link ? '|--' : ' ' end end end;T;+To; ; F; ;,;;b;I"3Card::Log::Performance::Entry#younger_siblings;F;[;[[@[i;F;:younger_siblings;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@j;(I"def younger_siblings;T;)T;*I"def younger_siblings res = [] next_parent = self while (next_parent) res << next_parent.has_younger_siblings? next_parent = next_parent.parent end res.reverse end;T;+T;9@j;:IC;[;9@j;;IC;[;9@j;T;,IC;={ ;mIC;={: read@l: write@y;>T;oIC;={;@;@;>T;qIC;={;@;@;>T;sIC;={;@;@;>T;uIC;={;@;@;>T;wIC;={;@ ;@;>T;yIC;={;@,;@9;>T;{IC;={;@L;0;>T;>T;>T;?{;@[;[[@[iQ;F;: Entry;;;;;[;{;IC;" ;T; @j;.0;!F;[;[;I";T;0;'@;I""Card::Log::Performance::Entry;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+To:$YARD::CodeObjects::ModuleObject;IC;[o; ; F; ;,;;;I"4Card::Log::Performance::BigBrother#watch_method;F;[[I"method_name;T0[I"method_type;TI" :all;T[I" options;TI"{};T;[[@[i;F;:watch_method;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"?def watch_method method_name, method_type=:all, options={};T;)T;*I"def watch_method method_name, method_type=:all, options={} Card::Log::Performance.enable_method method_name if !SPECIAL_METHODS.include? method_name if method_type == :all || method_type == :singleton add_singleton_logging method_name, options end if method_type == :all || method_type == :instance add_instance_logging method_name, options end end end;T;+To; ; F; ;,;;;I"=Card::Log::Performance::BigBrother#watch_instance_method;F;[[I" *names;T0;[[@[i;F;:watch_instance_method;;;[;{;IC;" ;T; @%;.0;!F;[;[;I";T;0;'@;(I"%def watch_instance_method *names;T;)T;*I"gdef watch_instance_method *names names.each do |name| watch_method name, :instance end end;T;+To; ; F; ;,;;;I">Card::Log::Performance::BigBrother#watch_singleton_method;F;[[I" *names;T0;[[@[i;F;:watch_singleton_method;;;[;{;IC;" ;T; @4;.0;!F;[;[;I";T;0;'@;(I"&def watch_singleton_method *names;T;)T;*I"idef watch_singleton_method *names names.each do |name| watch_method name, :singleton end end;T;+To; ; F; ;,;;;I"BCard::Log::Performance::BigBrother#watch_all_instance_methods;F;[;[[@[i;F;:watch_all_instance_methods;;;[;{;IC;" ;T; @C;.0;!F;[;[;I";T;0;'@;(I"#def watch_all_instance_methods;T;)T;*I"Qdef watch_all_instance_methods watch_instance_method *instance_methods end;T;+To; ; F; ;,;;;I"CCard::Log::Performance::BigBrother#watch_all_singleton_methods;F;[;[[@[i;F;: watch_all_singleton_methods;;;[;{;IC;" ;T; @P;.0;!F;[;[;I";T;0;'@;(I"$def watch_all_singleton_methods;T;)T;*I"def watch_all_singleton_methods fragile_methods = [:default_scope, :default_scopes, :default_scopes=] # if I touch these methods ActiveRecord breaks watch_singleton_method *(singleton_methods - fragile_methods) end;T;+To; ; F; ;,;;;I"9Card::Log::Performance::BigBrother#watch_all_methods;F;[;[[@[i;F;:watch_all_methods;;;[;{;IC;" ;T; @];.0;!F;[;[;I";T;0;'@;(I"def watch_all_methods;T;)T;*I"Ydef watch_all_methods watch_all_instance_methods watch_all_singleton_methods end;T;+To; ; F; ;,;;b;I"=Card::Log::Performance::BigBrother#add_singleton_logging;F;[[I"method_name;T0[I" options;T0;[[@[i;F;:add_singleton_logging;;;[;{;IC;" ;T; @j;.0;!F;[;[;I";T;0;'@;(I"3def add_singleton_logging method_name, options;T;)T;*I"def add_singleton_logging method_name, options return unless singleton_class.method_defined? method_name m = method(method_name) add_logging method_name, :define_singleton_method, options do |bind_object, args, &block| m.call(*args, &block) end end;T;+To; ; F; ;,;;b;I"T;,IC;={;>T;>T;?{;@[;[[@[i;F;:BigBrother;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"'Card::Log::Performance::BigBrother;F;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@[i-;F;:Performance;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@R;I"Card::Log::Performance;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+T;9@R;:IC;[;9@R;;IC;[;9@R;T;,IC;={;>T;>T;?{;@[;[[@[i;F;:Log;;;;;[;{;IC;" ;T; @R;.0;!F;[;[;I";T;0;'o;C ;D0;E0;F0;: Card;'@;H@;O0;I"Card::Log;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; o; ; F; ; ;;;I"Card.with_logging;F;[[I" method;T0[I" opts;T0[I" &block;T0;[[@[i;F;:with_logging;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"/def self.with_logging method, opts, &block;T;)T;*I"def self.with_logging method, opts, &block if Card::Log::Performance.enabled_method? method Card::Log::Performance.with_timer(method, opts) do block.call end else block.call end end;T;+To;;IC;[ o; ; F; ; ;;;I"Card::Env.reset;F;[[I" args;TI"{};T;[[I"lib/card/env.rb;Ti ;F;: reset;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def reset args={};T;)T;*I"def reset args={} @@env = { :main_name => nil } if c = args[:controller] self[:controller] = c self[:session] = c.request.session self[:params] = c.params self[:ip] = c.request.remote_ip self[:ajax] = c.request.xhr? || c.request.params[:simulate_xhr] self[:host] = Card.config.override_host || c.request.env['HTTP_HOST'] self[:protocol] = Card.config.override_protocol || c.request.protocol end end;T;+To; ; F; ; ;;;I"Card::Env.[];F;[[I"key;T0;[[@i;F;:[];;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;(I"def [] key;T;)T;*I"'def [] key @@env[key.to_sym] end;T;+To; ; F; ; ;;;I"Card::Env.[]=;F;[[I"key;T0[I" value;T0;[[@i;F;:[]=;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def []= key, value;T;)T;*I"7def []= key, value @@env[key.to_sym] = value end;T;+To; ; F; ; ;;;I"Card::Env.params;F;[;[[@i#;F;: params;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@;(I"def params;T;)T;*I"*def params self[:params] ||= {} end;T;+To; ; F; ; ;;;I"Card::Env.session;F;[;[[@i';F;: session;;;[;{;IC;" ;T; @8;.0;!F;[;[;I";T;0;'@;(I"def session;T;)T;*I",def session self[:session] ||= {} end;T;+To; ; F; ; ;;;I"Card::Env.ajax?;F;[;[[@i+;F;: ajax?;;;[;{;IC;" ;T; @E;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @E;I";T;0;'@;(I"def ajax?;T;)T;*I" def ajax? self[:ajax] end;T;+To; ; F; ; ;;;I"Card::Env.method_missing;F;[[I"method_id;T0[I" *args;T0;[[@i/;F;:method_missing;;;[;{;IC;" ;T; @W;.0;!F;[;[;I";T;0;'@;(I"(def method_missing method_id, *args;T;)T;*I"def method_missing method_id, *args case args.length when 0 ; self[ method_id ] when 1 ; self[ method_id ] = args[0] else ; super end end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i ;F;:Env;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Env;F;+To;;IC;[!o;V;[[I"lib/card/set.rb;Ti;F;:@@modules;;;;;[;{;IC;" ;T; @z;.0;!F;[;[;I";T;0;'@x;I"Card::Set::@@modules;F;(I"S@@modules = { :base=>[], :base_format=>{}, :nonbase=>{}, :nonbase_format=>{} };T;*I"S@@modules = { :base=>[], :base_format=>{}, :nonbase=>{}, :nonbase_format=>{} };T;6I"G{ :base=>[], :base_format=>{}, :nonbase=>{}, :nonbase_format=>{} };T;+To;;IC;[o;V;[[@}i\;F;: @@views;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Set::Format::@@views;F;(I"@@views = {};T;*I"@@views = {};T;6I"{};T;+To; ; F; ;,;;;I"Card::Set::Format#view;F;[[I" view;T0[I" *args;T0[I" &block;T0;[[@}i^;F;: view;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"!def view view, *args, &block;T;)T;*I"def view view, *args, &block view = view.to_viewname.key.to_sym views[self] ||= {} view_block = views[self][view] = if block_given? Card::Format.extract_class_vars view, args[0] block else alias_block view, args end define_method "_view_#{ view }", view_block end;T;+To; ; F; ;,;;;I""Card::Set::Format#alias_block;F;[[I" view;T0[I" args;T0;[[@}ij;F;:alias_block;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def alias_block view, args;T;)T;*I""def alias_block view, args opts = Hash===args[0] ? args.shift : { :view => args.shift } opts[:mod] ||= self opts[:view] ||= view views[ opts[:mod] ][ opts[:view] ] or fail rescue raise "cannot find #{ opts[:view] } view in #{ opts[:mod] }; failed to alias #{view} in #{self}" end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@}iZ;T;: Format;;;;;[;{;IC;" A "Set" is a group of Cards to which "Rules" may be applied. Sets can be as specific as a single card, as general as all cards, or anywhere in between. Rules take two main forms: card rules and code rules. "Card rules" are defined in card content. These are generally configured via the web interface and are thus documented at http://wagn.org/rules. "Code rules" can be defined in a "set file" within any "Mod" (short for both "module" and "modification"). In accordance with Wagn's "MoVE" architecture, there are two main kinds of code rules you can create in a set file: Views, and Events. Events are associated with the Card class, and Views are associated with a Format class. You can also use set files to add or override Card and/or Format methods directly. The majority of Card code is contained in these files. (FIXME - define mod, add generator) Whenever you fetch or instantiate a card, it will automatically include all the set modules defined in set files associated with sets of which it is a member. This entails both simple model methods and "events", which are special methods explored in greater detail below. For example, say you have a Plaintext card named "Philipp+address", and you have set files for the following sets: * all cards * all Plaintext cards * all cards ending in +address When you run this: mycard = Card.fetch 'Philipp+address' ...then mycard will include the set modules associated with each of those sets in the above order. (The order is determined by the set pattern; see lib/card/set_pattern.rb for more information about set_ptterns and mod/core/set/all/fetch.rb for more about fetching.) Similarly, whenever a Format object is instantiated for a card, it includes all views associated with BOTH (a) sets of which the card is a member and (b) the current format or its ancestors. More on defining views below. In order to have a set file associated with "all cards ending in +address", you could create a file in mywagn/mod/mymod/set/right/address.rb. The recommended mechanism for doing so is running `wagn generate set modname set_pattern set_anchor`. In the current example, this would translate to `wagn generate set mymod right address`. Note that both the set_pattern and the set_anchor must correspond to the codename of a card in the database to function correctly but you can add arbitrary subdirectories to organize your code rules. The rule above for example could be saved in mywagn/mod/mymod/set/right/address/america/north/canada.rb. When a Card application loads, it uses these files to autogenerate a tmp_file that uses this set file to createa Card::Set::Right::Address module which itself is extended with Card::Set. A set file is "just ruby" but is generally quite concise because Card uses its file location to autogenerate ruby module names and then uses Card::Set module to provide additional API. View definitions When you declare: view :view_name do |args| #...your code here end Methods are defined on the format The external api with checks: render(:viewname, args) ;T;[;[;I" A "Set" is a group of Cards to which "Rules" may be applied. Sets can be as specific as a single card, as general as all cards, or anywhere in between. Rules take two main forms: card rules and code rules. "Card rules" are defined in card content. These are generally configured via the web interface and are thus documented at http://wagn.org/rules. "Code rules" can be defined in a "set file" within any "Mod" (short for both "module" and "modification"). In accordance with Wagn's "MoVE" architecture, there are two main kinds of code rules you can create in a set file: Views, and Events. Events are associated with the Card class, and Views are associated with a Format class. You can also use set files to add or override Card and/or Format methods directly. The majority of Card code is contained in these files. (FIXME - define mod, add generator) Whenever you fetch or instantiate a card, it will automatically include all the set modules defined in set files associated with sets of which it is a member. This entails both simple model methods and "events", which are special methods explored in greater detail below. For example, say you have a Plaintext card named "Philipp+address", and you have set files for the following sets: * all cards * all Plaintext cards * all cards ending in +address When you run this: mycard = Card.fetch 'Philipp+address' ...then mycard will include the set modules associated with each of those sets in the above order. (The order is determined by the set pattern; see lib/card/set_pattern.rb for more information about set_ptterns and mod/core/set/all/fetch.rb for more about fetching.) Similarly, whenever a Format object is instantiated for a card, it includes all views associated with BOTH (a) sets of which the card is a member and (b) the current format or its ancestors. More on defining views below. In order to have a set file associated with "all cards ending in +address", you could create a file in mywagn/mod/mymod/set/right/address.rb. The recommended mechanism for doing so is running `wagn generate set modname set_pattern set_anchor`. In the current example, this would translate to `wagn generate set mymod right address`. Note that both the set_pattern and the set_anchor must correspond to the codename of a card in the database to function correctly but you can add arbitrary subdirectories to organize your code rules. The rule above for example could be saved in mywagn/mod/mymod/set/right/address/america/north/canada.rb. When a Card application loads, it uses these files to autogenerate a tmp_file that uses this set file to createa Card::Set::Right::Address module which itself is extended with Card::Set. A set file is "just ruby" but is generally quite concise because Card uses its file location to autogenerate ruby module names and then uses Card::Set module to provide additional API. View definitions When you declare: view :view_name do |args| #...your code here end Methods are defined on the format The external api with checks: render(:viewname, args) ;T;0; @;!F;"o;#;$F;%i;&iX;'@x;I"Card::Set::Format;F;+To; ; F; ;,;;;I"Card::Set#format;F;[[I"*format_names;T0[I" &block;T0;[[@}iv;F;: format;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I"%def format *format_names, &block;T;)T;*I"def format *format_names, &block if format_names.empty? format_names = [:base] elsif format_names.first == :all format_names = Card::Format.registered.reject {|f| Card::Format.aliases[f]} end format_names.each do |f| define_on_format f, &block end end;T;+To; ; F; ;,;;;I"Card::Set#define_on_format;F;[[I"format_name;TI" :base;T[I" &block;T0;[[@}i|;F;:define_on_format;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I"3def define_on_format format_name=:base, &block;T;)T;*I"def define_on_format format_name=:base, &block klass = Card::Format.format_class_name format_name # format class name, eg. HtmlFormat mod = const_get_or_set klass do # called on current set module, eg Card::Set::Type::Pointer m = Module.new # yielding set format module, eg Card::Set::Type::Pointer::HtmlFormat register_set_format Card.const_get(klass), m m.extend Card::Set::Format m end mod.class_eval &block end;T;+To; ; F; ;,;;;I"Card::Set#view;F;[[I" *args;T0[I" &block;T0;[[@}i;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I"def view *args, &block;T;)T;*I"Hdef view *args, &block format do view *args, &block end end;T;+To; ; F; ;,;;;I"Card::Set#event;F;[[I" event;T0[I" opts;TI"{};T[I" &final;T0;[[@}i;F;: event;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I"%def event event, opts={}, &final;T;)T;*I"def event event, opts={}, &final perform_later = (opts[:before] == :subsequent) || (opts[:after] == :subsequent) final_method = "#{event}_without_callbacks" #should be private? opts[:on] = [:create, :update ] if opts[:on] == :save Card.define_callbacks event class_eval do define_method final_method, &final end if perform_later defer_method = "#{event}_perform_later" define_event_perform_later_method event, defer_method define_active_job event, final_method, opts[:queue_as] define_event_method event, defer_method, opts else define_event_method event, final_method, opts end set_event_callbacks event, opts end;T;+To; ; F; ;,;;;I"0Card::Set#define_event_perform_later_method;F;[[I" event;T0[I"method_name;T0;[[@}i;F;:&define_event_perform_later_method;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I"=def define_event_perform_later_method event, method_name;T;)T;*I"fdef define_event_perform_later_method event, method_name class_eval do define_method method_name, proc { s_attr = self.serializable_attributes.each_with_object({}) do |name, hash| value = self.instance_variable_get("@#{name}") hash[name] = if Symbol === value # ActiveJob doesn't accept symbols as arguments { :value => value.to_s, :symbol => true } else { :value => value } end end Object.const_get(event.to_s.camelize).perform_later(self, s_attr) } end end;T;+To; ; F; ;,;;;I""Card::Set#define_event_method;F;[[I" event;T0[I"call_method;T0[I" opts;T0;[[@}i;F;:define_event_method;;;[;{;IC;" ;T; @%;.0;!F;[;[;I";T;0;'@x;(I"5def define_event_method event, call_method, opts;T;)T;*I"def define_event_method event, call_method, opts class_eval do define_method event do run_callbacks event do Card.with_logging :event, :message=>event, :context=>self.name, :details=>opts do send call_method end end end end end;T;+To; ; F; ;,;;;I" Card::Set#define_active_job;F;[[I" name;T0[I"final_method;T0[I" queue;TI" :default;T;[[@}i;T;:define_active_job;;;[;{;IC;"creates an Active Job. The scheduled job gets the card object as argument and all serializable attributes of the card. (when the job is executed ActiveJob fetches the card from the database so all attributes get lost) ;T;[;[ o;0 ;1I" param;F;2I"+the name for the ActiveJob child class;T;I" name;T;3[I" String;T; @8o;0 ;1I" param;F;2I"6the name of the card instance method to be queued;T;I"final_method;T;3[I" String;T; @8o:YARD::Tags::OptionTag ;1I" option;F;20;I" queue;T;30: @pairo:YARD::Tags::DefaultTag ;1I" option;F;2I"the name of the queue;T;I"(:default);T;3[I" Symbol;T:@defaults0; @8o;0 ;1I" param;F;2I""a customizable set of options;T;@W;3[I" Hash;T; @8;I"creates an Active Job. The scheduled job gets the card object as argument and all serializable attributes of the card. (when the job is executed ActiveJob fetches the card from the database so all attributes get lost) @param name [String] the name for the ActiveJob child class @param final_method [String] the name of the card instance method to be queued @option queue [Symbol] (:default) the name of the queue;T;0; @8;!F;"o;#;$F;%i;&i;'@x;(I"?def define_active_job name, final_method, queue = :default;T;)T;*I"xdef define_active_job name, final_method, queue = :default class_name = name.to_s.camelize eval %{ class ::#{class_name} < ActiveJob::Base queue_as #{queue} end } Object.const_get(class_name).class_eval do define_method :perform, proc { |card, attributes| attributes.each do |name, args| # symbols are not allowed so all symbols arrive here as strings # convert strings that were symbols before back to symbols value = args[:symbol] ? args[:value].to_sym : args[:value] card.instance_variable_set("@#{name}", value ) end card.send final_method } end end;T;+To; ; F; ;,;;;I"Card::Set#card_accessor;F;[[I" *args;T0;[[@}i;T;:card_accessor;;;[;{;IC;";ActiveCard support: accessing plus cards as attributes ;T;[;[;I"= ActiveCard support: accessing plus cards as attributes ;T;0; @g;!F;"o;#;$F;%i;&i;'@x;(I"def card_accessor *args;T;)T;*I"~def card_accessor *args options = args.extract_options! add_traits args, options.merge( :reader=>true, :writer=>true ) end;T;+To; ; F; ;,;;;I"Card::Set#card_reader;F;[[I" *args;T0;[[@}i;F;:card_reader;;;[;{;IC;" ;T; @w;.0;!F;[;[;I";T;0;'@x;(I"def card_reader *args;T;)T;*I"rdef card_reader *args options = args.extract_options! add_traits args, options.merge( :reader=>true ) end;T;+To; ; F; ;,;;;I"Card::Set#card_writer;F;[[I" *args;T0;[[@}i;F;:card_writer;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I"def card_writer *args;T;)T;*I"rdef card_writer *args options = args.extract_options! add_traits args, options.merge( :writer=>true ) end;T;+To; ; F; ; ;;;I"Card::Set.extended;F;[[I"mod;T0;[[@}i;T;: extended;;;[;{;IC;"7each set file calls `extend Card::Set` when loaded ;T;[;[;I"7each set file calls `extend Card::Set` when loaded;T;0; @;!F;"o;#;$F;%i;&i;'@x;(I"def extended mod;T;)T;*I",def extended mod register_set mod end;T;+To; ; F; ; ;;;I"Card::Set.register_set;F;[[I"set_module;T0;[[@}i;F;:register_set;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I" def register_set set_module;T;)T;*I"def register_set set_module if set_module.all_set? modules[ :base ] << set_module else modules[ :nonbase ][ set_module.shortname ] ||= [] modules[ :nonbase ][ set_module.shortname ] << set_module end end;T;+To; ; F; ; ;;;I"Card::Set.write_tmp_file;F;[ [I"set_pattern;T0[I" anchors;T0[I"from_file;T0[I"seq;T0;[[@}i ;F;:write_tmp_file;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I"true, :if=> proc { |c| c.singleton_class.include?( this_set_module ) and c.event_applies? opts } end end end end;T;+To; ; F; ;,;;b;I"Card::Set#get_traits;F;[[I"mod;T0;[[@}iu;F;:get_traits;;;[;{;IC;" ;T; @E;.0;!F;[;[;I";T;0;'@x;(I"def get_traits mod;T;)T;*I"kdef get_traits mod Card::Set.traits ||= {} Card::Set.traits[mod] or Card::Set.traits[mod] = {} end;T;+To; ; F; ;,;;b;I"Card::Set#add_traits;F;[[I" args;T0[I" options;T0;[[@}iz;F;:add_traits;;;[;{;IC;" ;T; @T;.0;!F;[;[;I";T;0;'@x;(I"!def add_traits args, options;T;)T;*I"def add_traits args, options mod = self # raise "Can't define card traits on all set" if mod == Card mod_traits = get_traits mod new_opts = options[:type] ? {:type=>options[:type]} : {} new_opts.merge!( {:content => options[:default]} ) if options[:default] args.each do |trait| define_trait_card trait, new_opts define_trait_reader trait if options[:reader] define_trait_writer trait if options[:writer] mod_traits[trait.to_sym] = options end end;T;+To; ; F; ;,;;b;I" Card::Set#define_trait_card;F;[[I" trait;T0[I" opts;T0;[[@}i;F;:define_trait_card;;;[;{;IC;" ;T; @e;.0;!F;[;[;I";T;0;'@x;(I"&def define_trait_card trait, opts;T;)T;*I"def define_trait_card trait, opts define_method "#{trait}_card" do trait_var "@#{trait}_card" do fetch :trait=>trait.to_sym, :new=>opts.clone end end end;T;+To; ; F; ;,;;b;I""Card::Set#define_trait_reader;F;[[I" trait;T0;[[@}i;F;:define_trait_reader;;;[;{;IC;" ;T; @v;.0;!F;[;[;I";T;0;'@x;(I""def define_trait_reader trait;T;)T;*I"def define_trait_reader trait define_method trait do trait_var "@#{trait}" do send( "#{trait}_card" ).content end end end;T;+To; ; F; ;,;;b;I""Card::Set#define_trait_writer;F;[[I" trait;T0;[[@}i;F;:define_trait_writer;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@x;(I""def define_trait_writer trait;T;)T;*I"def define_trait_writer trait define_method "#{trait}=" do |value| card = send "#{trait}_card" self.subcards ||= {} self.subcards[card.name] = {:type_id => card.type_id, :content=>value } instance_variable_set "@#{trait}", value end end;T;+T;9@x;:IC;[;9@x;;IC;[;9@x;T;,IC;={;>T;>T;?{;@[;[[@}i ;T;:Set;;;;;[;{;IC;"5remove_const :Set if const_defined?(:Set, false) ;T;[;[;I"5remove_const :Set if const_defined?(:Set, false);T;0; @x;!F;"o;#;$F;%i ;&i ;'@;I"Card::Set;F;+To;;IC;[o;V;[[I"lib/card/auth.rb;Ti ;F;:@@as_card;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Auth::@@as_card;F;(I"S@@as_card = @@as_id = @@current_id = @@current = @@simulating_setup_need = nil;T;*I"S@@as_card = @@as_id = @@current_id = @@current = @@simulating_setup_need = nil;T;6I"G@@as_id = @@current_id = @@current = @@simulating_setup_need = nil;T;+To;4;[[@i ;T;:NON_CREATEABLE_TYPES;;;;;[;{;IC;" NEED API ;T;[;[;I" NEED API;T;0; @;!F;"o;#;$F;%i ;&i ;'@;I"%Card::Auth::NON_CREATEABLE_TYPES;F;(I"?NON_CREATEABLE_TYPES = %w{ signup setting set } # NEED API;T;*I"4NON_CREATEABLE_TYPES = %w{ signup setting set };T;6I"%w{ signup setting set };T;+To;4;[[@i ;F;:NEED_SETUP_KEY;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Auth::NEED_SETUP_KEY;F;(I""NEED_SETUP_KEY = 'NEED_SETUP';T;*I""NEED_SETUP_KEY = 'NEED_SETUP';T;6I"'NEED_SETUP';T;+To; ; F; ; ;;;I"Card::Auth.authenticate;F;[[I" email;T0[I" password;T0;[[@i;T;:authenticate;;;[;{;IC;"GAuthenticates a user by their login name and unencrypted password. ;T;[;[;I"GAuthenticates a user by their login name and unencrypted password.;T;0; @;!F;"o;#;$F;%i;&i;'@;(I"%def authenticate email, password;T;)T;*I"def authenticate email, password accounted = Auth[ email ] if accounted and account = accounted.account and account.active? if Card.config.no_authentication or password_authenticated?( account, password.strip ) accounted.id end end end;T;+To; ; F; ; ;;;I"'Card::Auth.password_authenticated?;F;[[I" account;T0[I" password;T0;[[@i;F;:password_authenticated?;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @;I";T;0;'@;(I"2def password_authenticated? account, password;T;)T;*I"ndef password_authenticated? account, password account.password == encrypt( password, account.salt ) end;T;+To; ; F; ; ;;;I"Card::Auth.encrypt;F;[[I" password;T0[I" salt;T0;[[@i#;T;: encrypt;;;[;{;IC;"&Encrypts some data with the salt. ;T;[;[;I"&Encrypts some data with the salt.;T;0; @;!F;"o;#;$F;%i";&i";'@;(I"def encrypt password, salt;T;)T;*I"Udef encrypt password, salt Digest::SHA1.hexdigest "#{salt}--#{password}--" end;T;+To; ; F; ; ;;;I"Card::Auth.[];F;[[I" email;T0;[[@i(;T;;;;;[;{;IC;"find accounted by email ;T;[;[;I"find accounted by email;T;0; @ ;!F;"o;#;$F;%i';&i';'@;(I"def [] email;T;)T;*I"def [] email Auth.as_bot do Card.search( :right_plus=>[ {:id=>Card::AccountID}, {:right_plus=>[{:id=>Card::EmailID},{ :content=>email.strip.downcase }]} ]).first end end;T;+To; ; F; ; ;;;I"Card::Auth.signin;F;[[I"signin_id;T0;[[@i1;F;: signin;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def signin signin_id;T;)T;*I"cdef signin signin_id self.current_id = signin_id session[:user] = signin_id if session end;T;+To; ; F; ; ;;;I"Card::Auth.session;F;[;[[@i6;F;;;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@;(I"def session;T;)T;*I"*def session Card::Env[:session] end;T;+To; ; F; ; ;;;I"(Card::Auth.set_current_from_session;F;[;[[@i:;F;:set_current_from_session;;;[;{;IC;" ;T; @6;.0;!F;[;[;I";T;0;'@;(I"!def set_current_from_session;T;)T;*I"def set_current_from_session self.current_id = if session if card_id=session[:user] and Card.exists? card_id card_id else session[:user] = nil end end current_id end;T;+To; ; F; ; ;;;I"Card::Auth.current_id;F;[;[[@iF;F;:current_id;;;[;{;IC;" ;T; @C;.0;!F;[;[;I";T;0;'@;(I"def current_id;T;)T;*I"Card::CardtypeID, :return=>:name, :not => { :codename => ['in'] + NON_CREATEABLE_TYPES } end type_names.reject do |name| !Card.new( :type=>name ).ok? :create end.sort end;T;+To; ; F; ; ;;b;I"Card::Auth.account_count;F;[;[[@i;F;:account_count;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;(I"def account_count;T;)T;*I"Udef account_count as_bot { Card.count_by_wql :right=>Card[:account].name } end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i ;F;: Auth;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Auth;F;+To;;IC;[ o; ; F; ; ;;;I"Card::Diff.complete;F;[[I"a;T0[I"b;T0[I" opts;TI"{};T;[[I"lib/card/diff.rb;Ti ;F;: complete;;;[;{;IC;" ;T; @9 ;.0;!F;[;[;I";T;0;'@7 ;(I"$def self.complete a, b, opts={};T;)T;*I"Odef self.complete a, b, opts={} DiffBuilder.new(a, b, opts).complete end;T;+To; ; F; ; ;;;I"Card::Diff.summary;F;[[I"a;T0[I"b;T0[I" opts;TI"{};T;[[@E i;F;: summary;;;[;{;IC;" ;T; @N ;.0;!F;[;[;I";T;0;'@7 ;(I"#def self.summary a, b, opts={};T;)T;*I"Mdef self.summary a, b, opts={} DiffBuilder.new(a, b, opts).summary end;T;+To; ; F; ; ;;;I""Card::Diff.render_added_chunk;F;[[I" text;T0;[[@E i;F;:render_added_chunk;;;[;{;IC;" ;T; @b ;.0;!F;[;[;I";T;0;'@7 ;(I"%def self.render_added_chunk text;T;)T;*I"[def self.render_added_chunk text "#{text}" end;T;+To; ; F; ; ;;;I"$Card::Diff.render_deleted_chunk;F;[[I" text;T0[I" count;TI" true;T;[[@E i;F;:render_deleted_chunk;;;[;{;IC;" ;T; @q ;.0;!F;[;[;I";T;0;'@7 ;(I"3def self.render_deleted_chunk text, count=true;T;)T;*I"gdef self.render_deleted_chunk text, count=true "#{text}" end;T;+To; ; F; ; ;;;I"Card::Diff.render_chunk;F;[[I" action;T0[I" text;T0;[[@E i;F;:render_chunk;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@7 ;(I"'def self.render_chunk action, text;T;)T;*I"def self.render_chunk action, text case action when '+' then render_added_chunk text when :added then render_added_chunk text when '-' then render_deleted_chunk text when :deleted then render_deleted_chunk text else text end end;T;+To; ;IC;[ o; ; F; ;,;;;I"$Card::Diff::DiffBuilder#summary;F;[;[[@E i%;F;;;;;[;{;IC;"+Returns the value of attribute summary ;T; @ ;.0;!F;[;[;I"+Returns the value of attribute summary;T;0;'@ ;(I"def summary;T;*I"def summary @summary end;T;+To; ; F; ;,;;;I"%Card::Diff::DiffBuilder#complete;F;[;[[@E i%;F;;;;;[;{;IC;",Returns the value of attribute complete ;T; @ ;.0;!F;[;[;I",Returns the value of attribute complete;T;0;'@ ;(I"def complete;T;*I"!def complete @complete end;T;+To; ; F; ;,;;;I"'Card::Diff::DiffBuilder#initialize;F;[[I"old_version;T0[I"new_version;T0[I" opts;TI"{};T;[[@E i0;T;;|;;;[;{;IC;"Bdiff options :format => :html|:text|:pointer|:raw :html = maintain html structure, but compare only content :text = remove all html tags; compare plain text :pointer = remove all double square brackets :raw = escape html tags and compare everything :summary => {:length=> , :joint=> } ;T;[;[o;0 ;1I" return;F;2I""a new instance of DiffBuilder;T;0;3[I"DiffBuilder;F; @ ;I"Bdiff options :format => :html|:text|:pointer|:raw :html = maintain html structure, but compare only content :text = remove all html tags; compare plain text :pointer = remove all double square brackets :raw = escape html tags and compare everything :summary => {:length=> , :joint=> };T;0; @ ;!F;"o;#;$F;%i';&i.;'@ ;(I"6def initialize(old_version, new_version, opts={});T;)T;*I"?def initialize(old_version, new_version, opts={}) @new_version = new_version @old_version = old_version @lcs_opts = lcs_opts_for_format opts[:format] @lcs_opts[:summary] = opts[:summary] @dels_cnt = 0 @adds_cnt = 0 if not @new_version @complete = '' @summary = '' else lcs_diff end end;T;+To; ; F; ;,;;;I"!Card::Diff::DiffBuilder#red?;F;[;[[@E i@;F;: red?;;;[;{;IC;" ;T; @ ;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @ ;I";T;0;'@ ;(I" def red?;T;)T;*I""def red? @dels_cnt > 0 end;T;+To; ; F; ;,;;;I"#Card::Diff::DiffBuilder#green?;F;[;[[@E iD;F;: green?;;;[;{;IC;" ;T; @ ;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @ ;I";T;0;'@ ;(I"def green?;T;)T;*I"$def green? @adds_cnt > 0 end;T;+To; ; F; ;,;;;I"0Card::Diff::DiffBuilder#lcs_opts_for_format;F;[[I" format;T0;[[@E iH;F;:lcs_opts_for_format;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"#def lcs_opts_for_format format;T;)T;*I"def lcs_opts_for_format format opts = {} case format when :html opts[:exclude] = /^') end when :pointer opts[:preprocess] = Proc.new do |word| word.gsub('[[','').gsub(']]','') end else #:raw opts[:preprocess] = Proc.new do |word| CGI::escapeHTML(word) end end opts end;T;+To; ; F; ;,;;;I"%Card::Diff::DiffBuilder#lcs_diff;F;[;[[@E i^;F;: lcs_diff;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def lcs_diff;T;)T;*I"def lcs_diff @lcs = LCS.new(@old_version, @new_version, @lcs_opts) @summary = @lcs.summary @complete = @lcs.complete @dels_cnt = @lcs.dels_cnt @adds_cnt = @lcs.adds_cnt end;T;+To; ;IC;[o; ; F; ;,;;;I"*Card::Diff::DiffBuilder::LCS#adds_cnt;F;[;[[@E ih;F;: adds_cnt;;;[;{;IC;",Returns the value of attribute adds_cnt ;T; @ ;.0;!F;[;[;I",Returns the value of attribute adds_cnt;T;0;'@ ;(I"def adds_cnt;T;*I"!def adds_cnt @adds_cnt end;T;+To; ; F; ;,;;;I"*Card::Diff::DiffBuilder::LCS#dels_cnt;F;[;[[@E ih;F;: dels_cnt;;;[;{;IC;",Returns the value of attribute dels_cnt ;T; @ ;.0;!F;[;[;I",Returns the value of attribute dels_cnt;T;0;'@ ;(I"def dels_cnt;T;*I"!def dels_cnt @dels_cnt end;T;+To; ; F; ;,;;;I",Card::Diff::DiffBuilder::LCS#initialize;F;[ [I" old_text;T0[I" new_text;T0[I" opts;T0[I" summary;TI"nil;T;[[@E ii;F;;|;;;[;{;IC;" ;T; @& ;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of LCS;T;0;3[I"LCS;F; @& ;I";T;0;'@ ;(I"9def initialize old_text, new_text, opts, summary=nil;T;)T;*I"Vdef initialize old_text, new_text, opts, summary=nil @reject_pattern = opts[:reject] # regex; remove match completely from diff @exclude_pattern = opts[:exclude] # regex; put back to the result after diff @preprocess = opts[:preprocess] # block; called with every word @postprocess = opts[:postprocess] # block; called with complete diff @adds_cnt = 0 @dels_cnt = 0 @splitters = %w( <[^>]+> \[\[[^\]]+\]\] \{\{[^}]+\}\} \s+ ) @disjunction_pattern = /^\s/ @summary ||= Summary.new opts[:summary] if not old_text list = split_and_preprocess(new_text) if @exclude_pattern list = list.reject{ |word| word.match @exclude_pattern } end text = postprocess list.join @result = added_chunk text @summary.add text else init_diff old_text, new_text run_diff end end;T;+To; ; F; ;,;;;I")Card::Diff::DiffBuilder::LCS#summary;F;[;[[@E i~;F;;;;;[;{;IC;" ;T; @A ;.0;!F;[;[;I";T;0;'@ ;(I"def summary;T;)T;*I"'def summary @summary.result end;T;+To; ; F; ;,;;;I"*Card::Diff::DiffBuilder::LCS#complete;F;[;[[@E i;F;;;;;[;{;IC;" ;T; @N ;.0;!F;[;[;I";T;0;'@ ;(I"def complete;T;)T;*I"def complete @result end;T;+To; ; F; ;,;;b;I"+Card::Diff::DiffBuilder::LCS#init_diff;F;[[I" old_text;T0[I" new_text;T0;[[@E i;F;:init_diff;;;[;{;IC;" ;T; @[ ;.0;!F;[;[;I";T;0;'@ ;(I"%def init_diff old_text, new_text;T;)T;*I"|def init_diff old_text, new_text @adds = [] @dels = [] @result = '' old_words, old_ex = separate_comparables_from_excludees old_text new_words, new_ex = separate_comparables_from_excludees new_text @words = { :old => old_words, :new => new_words } @excludees = { :old => ExcludeeIterator.new(old_ex), :new => ExcludeeIterator.new(new_ex) } end;T;+To; ; F; ;,;;b;I"*Card::Diff::DiffBuilder::LCS#run_diff;F;[;[[@E i;F;: run_diff;;;[;{;IC;" ;T; @l ;.0;!F;[;[;I";T;0;'@ ;(I"def run_diff;T;)T;*I"def run_diff prev_action = nil ::Diff::LCS.traverse_balanced(@words[:old], @words[:new]) do |word| if prev_action if prev_action != word.action and !(prev_action == '-' and word.action == '!') and !(prev_action == '!' and word.action == '+') # delete and/or add section stops here; write changes to result write_dels write_adds write_excludees # new neutral section starts, we can just write excludees to result else # current word belongs to edit of previous word case word.action when '-' del_old_excludees when '+' add_new_excludees when '!' del_old_excludees add_new_excludees else write_excludees end end else write_excludees end process_word word prev_action = word.action end write_dels write_adds write_excludees @result = postprocess @result end;T;+To; ; F; ;,;;b;I"-Card::Diff::DiffBuilder::LCS#added_chunk;F;[[I" text;T0[I" count;TI" true;T;[[@E i;F;:added_chunk;;;[;{;IC;" ;T; @y ;.0;!F;[;[;I";T;0;'@ ;(I"%def added_chunk text, count=true;T;)T;*I"hdef added_chunk text, count=true @adds_cnt += 1 if count Card::Diff.render_added_chunk text end;T;+To; ; F; ;,;;b;I"/Card::Diff::DiffBuilder::LCS#deleted_chunk;F;[[I" text;T0[I" count;TI" true;T;[[@E i;F;:deleted_chunk;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"'def deleted_chunk text, count=true;T;)T;*I"ldef deleted_chunk text, count=true @dels_cnt += 1 if count Card::Diff.render_deleted_chunk text end;T;+To; ; F; ;,;;b;I"1Card::Diff::DiffBuilder::LCS#write_unchanged;F;[[I" text;T0;[[@E i;F;:write_unchanged;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def write_unchanged text;T;)T;*I"Cdef write_unchanged text @result << text @summary.omit end;T;+To; ; F; ;,;;b;I",Card::Diff::DiffBuilder::LCS#write_dels;F;[;[[@E i;F;:write_dels;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def write_dels;T;)T;*I"def write_dels if !@dels.empty? @result << deleted_chunk(@dels.join) @summary.delete @dels.join @dels = [] end end;T;+To; ; F; ;,;;b;I",Card::Diff::DiffBuilder::LCS#write_adds;F;[;[[@E i;F;:write_adds;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def write_adds;T;)T;*I"}def write_adds if !@adds.empty? @result << added_chunk(@adds.join) @summary.add @adds.join @adds = [] end end;T;+To; ; F; ;,;;b;I"1Card::Diff::DiffBuilder::LCS#write_excludees;F;[;[[@E i;F;:write_excludees;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def write_excludees;T;)T;*I"adef write_excludees while ex = @excludees[:new].next @result << ex[:element] end end;T;+To; ; F; ;,;;b;I"3Card::Diff::DiffBuilder::LCS#del_old_excludees;F;[;[[@E i;F;:del_old_excludees;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def del_old_excludees;T;)T;*I"def del_old_excludees while ex = @excludees[:old].next if ex[:type] == :disjunction @dels << ex[:element] else write_dels @result << ex[:element] end end end;T;+To; ; F; ;,;;b;I"3Card::Diff::DiffBuilder::LCS#add_new_excludees;F;[;[[@E i;F;:add_new_excludees;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def add_new_excludees;T;)T;*I"def add_new_excludees while ex = @excludees[:new].next if ex[:type] == :disjunction @adds << ex[:element] else write_adds @result << ex[:element] end end end;T;+To; ; F; ;,;;b;I".Card::Diff::DiffBuilder::LCS#process_word;F;[[I" word;T0;[[@E i;F;:process_word;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def process_word word;T;)T;*I"`def process_word word process_element word.old_element, word.new_element, word.action end;T;+To; ; F; ;,;;b;I"1Card::Diff::DiffBuilder::LCS#process_element;F;[[I"old_element;T0[I"new_element;T0[I" action;T0;[[@E i;F;:process_element;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"9def process_element old_element, new_element, action;T;)T;*I"def process_element old_element, new_element, action case action when '-' @dels << old_element @excludees[:old].word_step when '+' @adds << new_element @excludees[:new].word_step when '!' @dels << old_element @adds << new_element @excludees[:old].word_step @excludees[:new].word_step else write_unchanged new_element @excludees[:new].word_step end end;T;+To; ; F; ;,;;b;I"ECard::Diff::DiffBuilder::LCS#separate_comparables_from_excludees;F;[[I" text;T0;[[@E i;F;:(separate_comparables_from_excludees;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"1def separate_comparables_from_excludees text;T;)T;*I"idef separate_comparables_from_excludees text # return two arrays, one with all words, one with pairs (index in word list, html_tag) list = split_and_preprocess text if @exclude_pattern list.each_with_index.inject([[],[]]) do |res, pair| element, index = pair if element.match @disjunction_pattern res[1] << {:chunk_index=>index, :element=>element, :type=>:disjunction} elsif element.match @exclude_pattern res[1] << {:chunk_index=>index, :element=>element, :type=>:excludee} else res[0] << element end res end else [list, []] end end;T;+To; ; F; ;,;;b;I"6Card::Diff::DiffBuilder::LCS#split_and_preprocess;F;[[I" text;T0;[[@E i+;F;:split_and_preprocess;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I""def split_and_preprocess text;T;)T;*I"def split_and_preprocess text splitted = split_to_list_of_words(text).select do |s| s.size > 0 and (!@reject_pattern or !s.match @reject_pattern) end @preprocess ? splitted.map {|s| @preprocess.call(s) } : splitted end;T;+To; ; F; ;,;;b;I"8Card::Diff::DiffBuilder::LCS#split_to_list_of_words;F;[[I" text;T0;[[@E i2;F;:split_to_list_of_words;;;[;{;IC;" ;T; @- ;.0;!F;[;[;I";T;0;'@ ;(I"$def split_to_list_of_words text;T;)T;*I"mdef split_to_list_of_words text split_regex = /(#{@splitters.join '|'})/ text.split(split_regex) end;T;+To; ; F; ;,;;b;I",Card::Diff::DiffBuilder::LCS#preprocess;F;[[I" text;T0;[[@E i7;F;:preprocess;;;[;{;IC;" ;T; @< ;.0;!F;[;[;I";T;0;'@ ;(I"def preprocess text;T;)T;*I"^def preprocess text if @preprocess @preprocess.call(text) else text end end;T;+To; ; F; ;,;;b;I"-Card::Diff::DiffBuilder::LCS#postprocess;F;[[I" text;T0;[[@E i?;F;:postprocess;;;[;{;IC;" ;T; @K ;.0;!F;[;[;I";T;0;'@ ;(I"def postprocess text;T;)T;*I"adef postprocess text if @postprocess @postprocess.call(text) else text end end;T;+To; ;IC;[ o; ; F; ;,;;;I"5Card::Diff::DiffBuilder::LCS::Summary#initialize;F;[[I" opts;T0;[[@E iI;F;;|;;;[;{;IC;" ;T; @\ ;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of Summary;T;0;3[I" Summary;F; @\ ;I";T;0;'@Z ;(I"def initialize opts;T;)T;*I"def initialize opts opts ||= {} @remaining_chars = opts[:length] || 50 @joint = opts[:joint] || '...' @summary = nil @chunks = [] end;T;+To; ; F; ;,;;;I"1Card::Diff::DiffBuilder::LCS::Summary#result;F;[;[[@E iR;F;: result;;;[;{;IC;" ;T; @p ;.0;!F;[;[;I";T;0;'@Z ;(I"def result;T;)T;*I"0def result @summary ||= render_chunks end;T;+To; ; F; ;,;;;I".Card::Diff::DiffBuilder::LCS::Summary#add;F;[[I" text;T0;[[@E iV;F;:add;;;[;{;IC;" ;T; @} ;.0;!F;[;[;I";T;0;'@Z ;(I"def add text;T;)T;*I".def add text add_chunk text, :added end;T;+To; ; F; ;,;;;I"1Card::Diff::DiffBuilder::LCS::Summary#delete;F;[[I" text;T0;[[@E iZ;F;;|;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@Z ;(I"def delete text;T;)T;*I"3def delete text add_chunk text, :deleted end;T;+To; ; F; ;,;;;I"/Card::Diff::DiffBuilder::LCS::Summary#omit;F;[;[[@E i^;F;: omit;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@Z ;(I" def omit;T;)T;*I"sdef omit if @chunks.empty? or @chunks.last[:action] != :ellipsis add_chunk @joint, :ellipsis end end;T;+To; ; F; ;,;;b;I"4Card::Diff::DiffBuilder::LCS::Summary#add_chunk;F;[[I" text;T0[I" action;T0;[[@E if;F;:add_chunk;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@Z ;(I"def add_chunk text, action;T;)T;*I"def add_chunk text, action if @remaining_chars > 0 @chunks << {:action => action, :text=>text} @remaining_chars -= text.size end end;T;+To; ; F; ;,;;b;I"8Card::Diff::DiffBuilder::LCS::Summary#render_chunks;F;[;[[@E im;F;:render_chunks;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@Z ;(I"def render_chunks;T;)T;*I"def render_chunks truncate_overlap @chunks.map do |chunk| Card::Diff.render_chunk chunk[:action], chunk[:text] end.join end;T;+To; ; F; ;,;;b;I";Card::Diff::DiffBuilder::LCS::Summary#truncate_overlap;F;[;[[@E it;F;:truncate_overlap;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@Z ;(I"def truncate_overlap;T;)T;*I"def truncate_overlap if @remaining_chars < 0 if @chunks.last[:action] == :ellipsis @chunks.pop @remaining_chars += @joint.size end index = @chunks.size - 1 while @remaining_chars < @joint.size and index >= 0 if @remaining_chars + @chunks[index][:text].size == @joint.size # d @chunks.pop if index-1 >= 0 if @chunks[index-1][:action] == :added @chunks << {:action => :ellipsis, :text=>@joint} elsif @chunks[index-1][:action] == :deleted @chunks << {:action => :added, :text=>@joint} end end break elsif @remaining_chars + @chunks[index][:text].size > @joint.size @chunks[index][:text] = @chunks[index][:text][0..(@remaining_chars-@joint.size-1)] @chunks[index][:text] += @joint break else @remaining_chars += @chunks[index][:text].size @chunks.delete_at(index) end index -= 1 end end end;T;+T;9@Z ;:IC;[;9@Z ;;IC;[;9@Z ;T;,IC;={;>T;>T;?{;@[;[[@E iH;F;: Summary;;;;;[;{;IC;" ;T; @Z ;.0;!F;[;[;I";T;0;'@ ;I"*Card::Diff::DiffBuilder::LCS::Summary;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+To; ;IC;[o; ; F; ;,;;;I">Card::Diff::DiffBuilder::LCS::ExcludeeIterator#initialize;F;[[I" list;T0;[[@E i;F;;|;;;[;{;IC;" ;T; @ ;.0;!F;[;[o;0 ;1I" return;F;2I"'a new instance of ExcludeeIterator;T;0;3[I"ExcludeeIterator;F; @ ;I";T;0;'@ ;(I"def initialize list;T;)T;*I"Kdef initialize list @list = list @index = 0 @chunk_index = 0 end;T;+To; ; F; ;,;;;I"=Card::Diff::DiffBuilder::LCS::ExcludeeIterator#word_step;F;[;[[@E i;F;:word_step;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def word_step;T;)T;*I"*def word_step @chunk_index += 1 end;T;+To; ; F; ;,;;;I"8Card::Diff::DiffBuilder::LCS::ExcludeeIterator#next;F;[;[[@E i;F;: next;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I" def next;T;)T;*I"def next if @index < @list.size and @list[@index][:chunk_index] == @chunk_index res = @list[@index] @index += 1 @chunk_index +=1 res end end;T;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;>T;>T;?{;@[;[[@E i;F;:ExcludeeIterator;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"3Card::Diff::DiffBuilder::LCS::ExcludeeIterator;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;IC;={;@ ;0;>T;IC;={;@ ;0;>T;>T;>T;?{;@[;[[@E ig;F;:LCS;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"!Card::Diff::DiffBuilder::LCS;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;IC;={;@ ;0;>T;IC;={;@ ;0;>T;>T;>T;?{;@[;[[@E i$;F;:DiffBuilder;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@7 ;I"Card::Diff::DiffBuilder;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+T;9@7 ;:IC;[;9@7 ;;IC;[;9@7 ;T;,IC;={;>T;>T;?{;@[;[[@E i;F;: Diff;;;;;[;{;IC;" ;T; @7 ;.0;!F;[;[;I";T;0;'o;C ;D0;E0;F0;;;'@;H@;O0;I"Card::Diff;Fo; ;IC;[ o; ; F; ;,;;;I"Card::Name#star?;F;[;[[I"lib/card/name.rb;Ti;F;: star?;;;[;{;IC;" ;T; @^ ;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @^ ;I";T;0;'@\ ;(I"def star?;T;)T;*I".def star? simple? and '*' == s[0,1] end;T;+To; ; F; ;,;;;I"Card::Name#rstar?;F;[;[[@c i;F;: rstar?;;;[;{;IC;" ;T; @q ;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @q ;I";T;0;'@\ ;(I"def rstar?;T;)T;*I"1def rstar? right and '*' == right[0,1] end;T;+To; ; F; ;,;;;I"Card::Name#trait_name?;F;[[I"*traitlist;T0;[[@c i;F;:trait_name?;;;[;{;IC;" ;T; @ ;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @ ;I";T;0;'@\ ;(I"def trait_name? *traitlist;T;)T;*I"def trait_name? *traitlist junction? && begin right_key = right_name.key !!traitlist.find do |codename| card_id = Card::Codename[ codename ] and card = Card.fetch( card_id, :skip_modules=>true, :skip_virtual=>true ) and card.key == right_key end end end;T;+To; ; F; ;,;;;I"Card::Name#trait_name;F;[[I" tag_code;T0;[[@c i$;F;:trait_name;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@\ ;(I"def trait_name tag_code;T;)T;*I"def trait_name tag_code card_id = Card::Codename[ tag_code ] and card = Card.fetch( card_id, :skip_modules=>true, :skip_virtual=>true ) and [ self, card.cardname ].to_name end;T;+To; ; F; ;,;;;I"Card::Name#trait;F;[[I" tag_code;T0;[[@c i);F;: trait;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@\ ;(I"def trait tag_code;T;)T;*I"def trait tag_code name = trait_name( tag_code ) name ? name.s : ( raise Card::NotFound, "unknown codename: #{tag_code}" ) end;T;+To; ; F; ;,;;;I"Card::Name#code;F;[;[[@c i.;F;: code;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@\ ;(I" def code;T;)T;*I"8def code Card::Codename[ Card.fetch_id self ] end;T;+To; ; F; ;,;;;I"Card::Name#is_a_field_of?;F;[[I"context_name;T0;[[@c i3;F;:is_a_field_of?;;;[;{;IC;" ;T; @ ;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @ ;I";T;0;'@\ ;(I"$def is_a_field_of? context_name;T;)T;*I"hdef is_a_field_of? context_name if context_name.present? # Do I still equal myself after I've been relativised in the context of context_name? relative_name = self.to_show(*context_name.to_name.parts).to_name absolute_name = self.to_absolute_name(context_name) relative_name.key != absolute_name.key else self.s.match /^\s*\+/ end end;T;+T;9@\ ;:IC;[;9@\ ;;IC;[;9@\ ;T;,IC;={;>T;>T;?{;@[;[[@c i ;F;: Name;;;;;[;{;IC;" ;T; @\ ;.0;!F;[;[;I";T;0;'@;I"Card::Name;F;Bo;C ;D0;E0;F0;:SmartName;'@;H0;O; ;+To; ;IC;[o;4;[[I"lib/card/query.rb;Ti;F;:MODIFIERS;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"Card::Query::MODIFIERS;F;(I"tMODIFIERS = {}; %w{ conj return sort sort_as group dir limit offset }.each{|key| MODIFIERS[key.to_sym] = nil };T;*I"MODIFIERS = {};T;6I"{};T;+To;4;[[@ i;F;:OPERATORS;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"Card::Query::OPERATORS;F;(I"OOPERATORS = %w{ != = =~ < > in ~ }.inject({}) {|h,v| h[v]=nil; h }.merge({;T;*I"OPERATORS = %w{ != = =~ < > in ~ }.inject({}) {|h,v| h[v]=nil; h }.merge({ :eq => '=', :gt => '>', :lt => '<', :match => '~', :ne => '!=', 'not in' => nil }.stringify_keys);T;6I"%w{ != = =~ < > in ~ }.inject({}) {|h,v| h[v]=nil; h }.merge({ :eq => '=', :gt => '>', :lt => '<', :match => '~', :ne => '!=', 'not in' => nil }.stringify_keys);T;+To; ; F; ;,;;;I"Card::Query#initialize;F;[[I" query;T0;[[@ i;F;;|;;;[;{;IC;" ;T; @ ;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of Query;T;0;3[I" Query;F; @ ;I";T;0;'@ ;(I"def initialize query;T;)T;*I"Edef initialize query @card_clause = CardClause.build query end;T;+To; ; F; ;,;;;I"Card::Query#query;F;[;[[@ i;F;: query;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def query;T;)T;*I"'def query @card_clause.query end;T;+To; ; F; ;,;;;I"Card::Query#sql;F;[;[[@ i;F;:sql;;;[;{;IC;" ;T; @% ;.0;!F;[;[;I";T;0;'@ ;(I" def sql;T;)T;*I"/def sql @sql ||= @card_clause.to_sql end;T;+To; ; F; ;,;;;I"Card::Query#run;F;[;[[@ i!;F;:run;;;[;{;IC;" ;T; @2 ;.0;!F;[;[;I";T;0;'@ ;(I" def run;T;)T;*I"def run retrn = query[:return].present? ? query[:return].to_s : 'card' if retrn == 'card' simple_run('name').map do |name| Card.fetch name, :new=>{} end else simple_run retrn end end;T;+To; ; F; ;,;;;I"Card::Query#simple_run;F;[[I" retrn;T0;[[@ i-;F;:simple_run;;;[;{;IC;" ;T; @? ;.0;!F;[;[;I";T;0;'@ ;(I"def simple_run retrn;T;)T;*I"def simple_run retrn rows = run_sql case retrn when 'name' #common case if query[:prepend] || query[:append] rows.map do |row| [ query[:prepend], row['name'], query[:append] ].compact * '+' end else rows.map { |row| row['name'] } end when 'count' rows.first['count'].to_i when 'raw' rows when /id$/ rows.map { |row| row[retrn].to_i } else rows.map { |row| row[retrn] } end end;T;+To; ; F; ;,;;;I"Card::Query#run_sql;F;[;[[@ iD;F;: run_sql;;;[;{;IC;" ;T; @N ;.0;!F;[;[;I";T;0;'@ ;(I"def run_sql;T;)T;*I"Fdef run_sql ActiveRecord::Base.connection.select_all( sql ) end;T;+To; ;IC;[o; ; F; ;,;;;I" Card::Query::SqlCond#to_sql;F;[[I" *args;T0;[[@ iJ;F;: to_sql;;;[;{;IC;" ;T; @] ;.0;!F;[;[;I";T;0;'@[ ;(I"def to_sql(*args) self end;T;)T;*I"def to_sql(*args) self end;T;+T;9@[ ;:IC;[;9@[ ;;IC;[;9@[ ;T;,IC;={;>T;>T;?{;@[;[[@ iI;F;: SqlCond;;;;;[;{;IC;" ;T; @[ ;.0;!F;[;[;I";T;0;'@ ;I"Card::Query::SqlCond;F;Bo;C ;D0;E0;F0;: String;'@ ;H0;O; ;+To; ;IC;[o; ; F; ;,;;;I"%Card::Query::SqlStatement#fields;F;[;[[@ iO;F;: fields;;;[;{;IC;"*Returns the value of attribute fields ;T; @ ;.0;!F;[;[;I"*Returns the value of attribute fields;T;0;'@} ;(I"def fields;T;*I"def fields @fields end;T;+To; ; F; ;,;;;I"&Card::Query::SqlStatement#fields=;F;[[I" value;T0;[[@ iO;F;: fields=;;;[;{;IC;"Sets the attribute fields ;T; @ ;.0;!F;[;[o;0 ;1I" param;F;2I".the value to set the attribute fields to.;T;I" value;T;30; @ ;I"USets the attribute fields @param value the value to set the attribute fields to.;T;0;'@} ;(I"def fields=(value);T;*I"-def fields=(value) @fields = value end;T;+To; ; F; ;,;;;I"%Card::Query::SqlStatement#tables;F;[;[[@ iO;F;: tables;;;[;{;IC;"*Returns the value of attribute tables ;T; @ ;.0;!F;[;[;I"*Returns the value of attribute tables;T;0;'@} ;(I"def tables;T;*I"def tables @tables end;T;+To; ; F; ;,;;;I"&Card::Query::SqlStatement#tables=;F;[[I" value;T0;[[@ iO;F;: tables=;;;[;{;IC;"Sets the attribute tables ;T; @ ;.0;!F;[;[o;0 ;1I" param;F;2I".the value to set the attribute tables to.;T;I" value;T;30; @ ;I"USets the attribute tables @param value the value to set the attribute tables to.;T;0;'@} ;(I"def tables=(value);T;*I"-def tables=(value) @tables = value end;T;+To; ; F; ;,;;;I"$Card::Query::SqlStatement#joins;F;[;[[@ iO;F;: joins;;;[;{;IC;")Returns the value of attribute joins ;T; @ ;.0;!F;[;[;I")Returns the value of attribute joins;T;0;'@} ;(I"def joins;T;*I"def joins @joins end;T;+To; ; F; ;,;;;I"%Card::Query::SqlStatement#joins=;F;[[I" value;T0;[[@ iO;F;: joins=;;;[;{;IC;"Sets the attribute joins ;T; @ ;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute joins to.;T;I" value;T;30; @ ;I"SSets the attribute joins @param value the value to set the attribute joins to.;T;0;'@} ;(I"def joins=(value);T;*I"+def joins=(value) @joins = value end;T;+To; ; F; ;,;;;I")Card::Query::SqlStatement#conditions;F;[;[[@ iO;F;:conditions;;;[;{;IC;".Returns the value of attribute conditions ;T; @ ;.0;!F;[;[;I".Returns the value of attribute conditions;T;0;'@} ;(I"def conditions;T;*I"%def conditions @conditions end;T;+To; ; F; ;,;;;I"*Card::Query::SqlStatement#conditions=;F;[[I" value;T0;[[@ iO;F;:conditions=;;;[;{;IC;""Sets the attribute conditions ;T; @ ;.0;!F;[;[o;0 ;1I" param;F;2I"2the value to set the attribute conditions to.;T;I" value;T;30; @ ;I"]Sets the attribute conditions @param value the value to set the attribute conditions to.;T;0;'@} ;(I"def conditions=(value);T;*I"5def conditions=(value) @conditions = value end;T;+To; ; F; ;,;;;I"$Card::Query::SqlStatement#group;F;[;[[@ iO;F;: group;;;[;{;IC;")Returns the value of attribute group ;T; @ ;.0;!F;[;[;I")Returns the value of attribute group;T;0;'@} ;(I"def group;T;*I"def group @group end;T;+To; ; F; ;,;;;I"%Card::Query::SqlStatement#group=;F;[[I" value;T0;[[@ iO;F;: group=;;;[;{;IC;"Sets the attribute group ;T; @ ;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute group to.;T;I" value;T;30; @ ;I"SSets the attribute group @param value the value to set the attribute group to.;T;0;'@} ;(I"def group=(value);T;*I"+def group=(value) @group = value end;T;+To; ; F; ;,;;;I"$Card::Query::SqlStatement#order;F;[;[[@ iO;F;: order;;;[;{;IC;")Returns the value of attribute order ;T; @;.0;!F;[;[;I")Returns the value of attribute order;T;0;'@} ;(I"def order;T;*I"def order @order end;T;+To; ; F; ;,;;;I"%Card::Query::SqlStatement#order=;F;[[I" value;T0;[[@ iO;F;: order=;;;[;{;IC;"Sets the attribute order ;T; @,;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute order to.;T;I" value;T;30; @,;I"SSets the attribute order @param value the value to set the attribute order to.;T;0;'@} ;(I"def order=(value);T;*I"+def order=(value) @order = value end;T;+To; ; F; ;,;;;I"$Card::Query::SqlStatement#limit;F;[;[[@ iO;F;: limit;;;[;{;IC;")Returns the value of attribute limit ;T; @?;.0;!F;[;[;I")Returns the value of attribute limit;T;0;'@} ;(I"def limit;T;*I"def limit @limit end;T;+To; ; F; ;,;;;I"%Card::Query::SqlStatement#limit=;F;[[I" value;T0;[[@ iO;F;: limit=;;;[;{;IC;"Sets the attribute limit ;T; @L;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute limit to.;T;I" value;T;30; @L;I"SSets the attribute limit @param value the value to set the attribute limit to.;T;0;'@} ;(I"def limit=(value);T;*I"+def limit=(value) @limit = value end;T;+To; ; F; ;,;;;I"%Card::Query::SqlStatement#offset;F;[;[[@ iO;F;: offset;;;[;{;IC;"*Returns the value of attribute offset ;T; @_;.0;!F;[;[;I"*Returns the value of attribute offset;T;0;'@} ;(I"def offset;T;*I"def offset @offset end;T;+To; ; F; ;,;;;I"&Card::Query::SqlStatement#offset=;F;[[I" value;T0;[[@ iO;F;: offset=;;;[;{;IC;"Sets the attribute offset ;T; @l;.0;!F;[;[o;0 ;1I" param;F;2I".the value to set the attribute offset to.;T;I" value;T;30; @l;I"USets the attribute offset @param value the value to set the attribute offset to.;T;0;'@} ;(I"def offset=(value);T;*I"-def offset=(value) @offset = value end;T;+To; ; F; ;,;;;I"'Card::Query::SqlStatement#distinct;F;[;[[@ iO;F;: distinct;;;[;{;IC;",Returns the value of attribute distinct ;T; @;.0;!F;[;[;I",Returns the value of attribute distinct;T;0;'@} ;(I"def distinct;T;*I"!def distinct @distinct end;T;+To; ; F; ;,;;;I"(Card::Query::SqlStatement#distinct=;F;[[I" value;T0;[[@ iO;F;:distinct=;;;[;{;IC;" Sets the attribute distinct ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I"0the value to set the attribute distinct to.;T;I" value;T;30; @;I"YSets the attribute distinct @param value the value to set the attribute distinct to.;T;0;'@} ;(I"def distinct=(value);T;*I"1def distinct=(value) @distinct = value end;T;+To; ; F; ;,;;;I")Card::Query::SqlStatement#initialize;F;[;[[@ iQ;F;;|;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I"#a new instance of SqlStatement;T;0;3[I"SqlStatement;F; @;I";T;0;'@} ;(I"def initialize;T;)T;*I"def initialize @fields, @joins, @conditions = [],[],[],[] @tables = @group = @order = @limit = @offset = @distinct = nil end;T;+To; ; F; ;,;;;I"#Card::Query::SqlStatement#to_s;F;[;[[@ iV;F;: to_s;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@} ;(I" def to_s;T;)T;*I"def to_s select = fields.reject(&:blank?) * ', ' where = conditions.reject(&:blank?) * ' and ' ['(SELECT', distinct, select, 'FROM', tables, joins, 'WHERE', where, group, order, limit, offset, ')'].compact * ' ' end;T;+T;9@} ;:IC;[;9@} ;;IC;[;9@} ;T;,IC;={;IC;={;@ ;@ ;>T;IC;={;@ ;@ ;>T;IC;={;@ ;@ ;>T;IC;={;@ ;@ ;>T;IC;={;@ ;@ ;>T;IC;={;@;@,;>T;IC;={;@?;@L;>T;!IC;={;@_;@l;>T;#IC;={;@;@;>T;>T;>T;?{;@[;[[@ iN;F;:SqlStatement;;;;;[;{;IC;" ;T; @} ;.0;!F;[;[;I";T;0;'@ ;I"Card::Query::SqlStatement;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+To; ;IC;[ o; ; F; ;,;;;I"Card::Query::Clause#clause;F;[;[[I"lib/card/query/clause.rb;Ti;F;: clause;;;[;{;IC;"*Returns the value of attribute clause ;T; @;.0;!F;[;[;I"*Returns the value of attribute clause;T;0;'@;(I"def clause;T;*I"def clause @clause end;T;+To; ; F; ;,;;;I" Card::Query::Clause#clause=;F;[[I" value;T0;[[@i;F;: clause=;;;[;{;IC;"Sets the attribute clause ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I".the value to set the attribute clause to.;T;I" value;T;30; @;I"USets the attribute clause @param value the value to set the attribute clause to.;T;0;'@;(I"def clause=(value);T;*I"-def clause=(value) @clause = value end;T;+To; ; F; ;,;;;I"!Card::Query::Clause#safe_sql;F;[[I"txt;T0;[[@i ;F;: safe_sql;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def safe_sql(txt);T;)T;*I"def safe_sql(txt) txt = txt.to_s txt.match( /[^\w\*\(\)\s\.\,]/ ) ? raise( "WQL contains disallowed characters: #{txt}" ) : txt end;T;+To; ; F; ;,;;;I"Card::Query::Clause#quote;F;[[I"v;T0;[[@i;F;: quote;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;(I">def quote(v) ActiveRecord::Base.connection.quote(v) end;T;)T;*I">def quote(v) ActiveRecord::Base.connection.quote(v) end;T;+To; ; F; ;,;;;I"#Card::Query::Clause#match_prep;F;[[I"v;T0;[[@i;F;:match_prep;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def match_prep(v);T;)T;*I"Mdef match_prep(v) cxn ||= ActiveRecord::Base.connection [cxn, v] end;T;+To; ; F; ;,;;;I""Card::Query::Clause#cast_type;F;[[I" type;T0;[[@i;F;:cast_type;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@;(I"def cast_type(type);T;)T;*I"def cast_type(type) cxn ||= ActiveRecord::Base.connection (val = cxn.cast_types[type.to_sym]) ? val[:name] : safe_sql(type) end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;'IC;={;@;@;>T;>T;>T;?{;@[;[[@i;F;: Clause;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'o;C ;D0;EI"Card::Query;T;F@;: Query;'o;C ;D0;E0;F0;;;'@;H@;O0;H@ ;O0;I"Card::Query::Clause;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0o; ;IC;[ o;4;[[I"!lib/card/query/ref_clause.rb;Ti;F;:REFERENCE_DEFINITIONS;;;;;[;{;IC;" ;T; @N;.0;!F;[;[;I";T;0;'@L;I"2Card::Query::RefClause::REFERENCE_DEFINITIONS;F;(I"REFERENCE_DEFINITIONS = {;T;*I"xREFERENCE_DEFINITIONS = { # syntax: # wql query key => [ direction, {reference_type} ] # direction = :out | :in # reference_type = 'L' | 'I' | 'P' :refer_to => [ :out, 'L','I' ], :referred_to_by => [ :in, 'L','I' ], :link_to => [ :out, 'L' ], :linked_to_by => [ :in, 'L' ], :include => [ :out, 'I' ], :included_by => [ :in, 'I' ] };T;6I"`{ # syntax: # wql query key => [ direction, {reference_type} ] # direction = :out | :in # reference_type = 'L' | 'I' | 'P' :refer_to => [ :out, 'L','I' ], :referred_to_by => [ :in, 'L','I' ], :link_to => [ :out, 'L' ], :linked_to_by => [ :in, 'L' ], :include => [ :out, 'I' ], :included_by => [ :in, 'I' ] };T;+To;4;[[@Qi;F;:REFERENCE_FIELDS;;;;;[;{;IC;" ;T; @\;.0;!F;[;[;I";T;0;'@L;I"-Card::Query::RefClause::REFERENCE_FIELDS;F;(I"REFERENCE_FIELDS = {;T;*I"jREFERENCE_FIELDS = { :out => [ :referer_id, :referee_id ], :in => [ :referee_id, :referer_id ] };T;6I"W{ :out => [ :referer_id, :referee_id ], :in => [ :referee_id, :referer_id ] };T;+To; ; F; ;,;;;I"&Card::Query::RefClause#initialize;F;[[I"key;T0[I"val;T0[I" parent;T0;[[@Qi;F;;|;;;[;{;IC;" ;T; @i;.0;!F;[;[o;0 ;1I" return;F;2I" a new instance of RefClause;T;0;3[I"RefClause;F; @i;I";T;0;'@L;(I"$def initialize key, val, parent;T;)T;*I"Qdef initialize key, val, parent @key, @val, @parent = key, val, parent end;T;+To; ; F; ;,;;;I""Card::Query::RefClause#to_sql;F;[[I" *args;T0;[[@Qi;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@L;(I"def to_sql *args;T;)T;*I"def to_sql *args dir, *type = REFERENCE_DEFINITIONS[ @key.to_sym ] field1, field2 = REFERENCE_FIELDS[ dir ] cond = [] if type.present? operator = (type.size==1 ? '=' : 'IN') quoted_letters = type.map { |letter| "'#{letter}'" } * ', ' cond << "ref_type #{operator} (#{quoted_letters})" end sql = %[select distinct #{field1} as ref_id from card_references] if @val == '_none' cond << "present = 0" else cardclause = CardClause.build(:return=>'id', :_parent=>@parent).merge(@val) sql << %[ join #{ cardclause.to_sql } as c on #{field2} = c.id] end sql << %[ where #{ cond * ' and ' }] if cond.any? "(#{sql})" end;T;+T;9@L;:IC;[;9@L;;IC;[;9@L;T;,IC;={;>T;>T;?{;@[;[[@Qi;F;:RefClause;;;;;[;{;IC;" ;T; @L;.0;!F;[;[;I";T;0;'@ ;I"Card::Query::RefClause;F;Bo;C ;D0;E0;F0;;-;'@G;H@;O0;+To; ;IC;[Go;4;[[I""lib/card/query/card_clause.rb;Ti ;F;:ATTRIBUTES;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"(Card::Query::CardClause::ATTRIBUTES;F;(I"ATTRIBUTES = {;T;*I"ATTRIBUTES = { :basic => %w{ name type_id content id key updater_id left_id right_id creator_id updater_id codename }, :relational => %w{ type part left right editor_of edited_by last_editor_of last_edited_by creator_of created_by member_of member }, :plus_relational => %w{ plus left_plus right_plus }, :ref_relational => %w{ refer_to referred_to_by link_to linked_to_by include included_by }, :conjunction => %w{ and or all any }, :special => %w{ found_by not sort match complete extension_type }, :ignore => %w{ prepend append view params vars size } }.inject({}) {|h,pair| pair[1].each {|v| h[v.to_sym]=pair[0] }; h };T;6I"{ :basic => %w{ name type_id content id key updater_id left_id right_id creator_id updater_id codename }, :relational => %w{ type part left right editor_of edited_by last_editor_of last_edited_by creator_of created_by member_of member }, :plus_relational => %w{ plus left_plus right_plus }, :ref_relational => %w{ refer_to referred_to_by link_to linked_to_by include included_by }, :conjunction => %w{ and or all any }, :special => %w{ found_by not sort match complete extension_type }, :ignore => %w{ prepend append view params vars size } }.inject({}) {|h,pair| pair[1].each {|v| h[v.to_sym]=pair[0] }; h };T;+To;4;[[@i;F;:DEFAULT_ORDER_DIRS;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"0Card::Query::CardClause::DEFAULT_ORDER_DIRS;F;(I"FDEFAULT_ORDER_DIRS = { :update => "desc", :relevance => "desc" };T;*I"FDEFAULT_ORDER_DIRS = { :update => "desc", :relevance => "desc" };T;6I"0{ :update => "desc", :relevance => "desc" };T;+To;4;[[@i;F;:CONJUNCTIONS;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"*Card::Query::CardClause::CONJUNCTIONS;F;(I"MCONJUNCTIONS = { :any=>:or, :in=>:or, :or=>:or, :all=>:and, :and=>:and };T;*I"MCONJUNCTIONS = { :any=>:or, :in=>:or, :or=>:or, :all=>:and, :and=>:and };T;6I">{ :any=>:or, :in=>:or, :or=>:or, :all=>:and, :and=>:and };T;+To; ; F; ;,;;;I" Card::Query::CardClause#sql;F;[;[[@i;F;; ;;;[;{;IC;"'Returns the value of attribute sql ;T; @;.0;!F;[;[;I"'Returns the value of attribute sql;T;0;'@;(I" def sql;T;*I"def sql @sql end;T;+To; ; F; ;,;;;I""Card::Query::CardClause#query;F;[;[[@i;F;; ;;;[;{;IC;")Returns the value of attribute query ;T; @;.0;!F;[;[;I")Returns the value of attribute query;T;0;'@;(I"def query;T;*I"def query @query end;T;+To; ; F; ;,;;;I"&Card::Query::CardClause#rawclause;F;[;[[@i;F;:rawclause;;;[;{;IC;"-Returns the value of attribute rawclause ;T; @;.0;!F;[;[;I"-Returns the value of attribute rawclause;T;0;'@;(I"def rawclause;T;*I"#def rawclause @rawclause end;T;+To; ; F; ;,;;;I"%Card::Query::CardClause#selfname;F;[;[[@i;F;: selfname;;;[;{;IC;",Returns the value of attribute selfname ;T; @;.0;!F;[;[;I",Returns the value of attribute selfname;T;0;'@;(I"def selfname;T;*I"!def selfname @selfname end;T;+To; ; F; ;,;;;I""Card::Query::CardClause#joins;F;[;[[@i;F;;;;;[;{;IC;")Returns the value of attribute joins ;T; @;.0;!F;[;[;I")Returns the value of attribute joins;T;0;'@;(I"def joins;T;*I"def joins @joins end;T;+To; ; F; ;,;;;I"#Card::Query::CardClause#joins=;F;[[I" value;T0;[[@i;F;;;;;[;{;IC;"Sets the attribute joins ;T; @ ;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute joins to.;T;I" value;T;30; @ ;I"SSets the attribute joins @param value the value to set the attribute joins to.;T;0;'@;(I"def joins=(value);T;*I"+def joins=(value) @joins = value end;T;+To; ; F; ;,;;;I"'Card::Query::CardClause#join_count;F;[;[[@i;F;:join_count;;;[;{;IC;".Returns the value of attribute join_count ;T; @;.0;!F;[;[;I".Returns the value of attribute join_count;T;0;'@;(I"def join_count;T;*I"%def join_count @join_count end;T;+To; ; F; ;,;;;I"(Card::Query::CardClause#join_count=;F;[[I" value;T0;[[@i;F;:join_count=;;;[;{;IC;""Sets the attribute join_count ;T; @,;.0;!F;[;[o;0 ;1I" param;F;2I"2the value to set the attribute join_count to.;T;I" value;T;30; @,;I"]Sets the attribute join_count @param value the value to set the attribute join_count to.;T;0;'@;(I"def join_count=(value);T;*I"5def join_count=(value) @join_count = value end;T;+To; ; F; ; ;;;I""Card::Query::CardClause.build;F;[[I" query;T0;[[@i;F;: build;;;[;{;IC;" ;T; @?;.0;!F;[;[;I";T;0;'@;(I"def build query;T;)T;*I"^def build query cardclause = self.new query cardclause.merge cardclause.rawclause end;T;+To; ; F; ;,;;;I"'Card::Query::CardClause#initialize;F;[[I" query;T0;[[@i";F;;|;;;[;{;IC;" ;T; @N;.0;!F;[;[o;0 ;1I" return;F;2I"!a new instance of CardClause;T;0;3[I"CardClause;F; @N;I";T;0;'@;(I"def initialize query;T;)T;*I"def initialize query @mods = MODIFIERS.clone @clause, @joins = {}, {} @selfname, @parent = '', nil @sql = SqlStatement.new @query = query.clone @query.merge! @query.delete(:params) if @query[:params] @vars = @query.delete(:vars) || {} @vars.symbolize_keys! @query = clean(@query) @rawclause = @query.deep_clone @sql.distinct = 'DISTINCT' if @parent self end;T;+To; ; F; ;,;;;I""Card::Query::CardClause#clean;F;[[I" query;T0;[[@i:;F;: clean;;;[;{;IC;" ;T; @b;.0;!F;[;[;I";T;0;'@;(I"def clean query;T;)T;*I"def clean query query = query.symbolize_keys if s = query.delete(:context) then @selfname = s end if p = query.delete(:_parent) then @parent = p end query.each do |key,val| query[key] = clean_val val end query end;T;+To; ; F; ;,;;;I"&Card::Query::CardClause#clean_val;F;[[I"val;T0;[[@iD;F;:clean_val;;;[;{;IC;" ;T; @q;.0;!F;[;[;I";T;0;'@;(I"def clean_val val;T;)T;*I"def clean_val val case val when String if val =~ /^\$(\w+)$/ val = @vars[$1.to_sym].to_s.strip end absolute_name val when Card::Name ; clean_val val.s when Hash ; clean val when Array ; val.map { |v| clean_val v } when Integer, Float, Symbol ; val else ; raise BadQuery, "unknown WQL value type: #{val.class}" end end;T;+To; ; F; ;,;;;I"!Card::Query::CardClause#root;F;[;[[@iS;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I" def root;T;)T;*I"1def root @parent ? @parent.root : self end;T;+To; ; F; ;,;;;I"*Card::Query::CardClause#absolute_name;F;[[I" name;T0;[[@iW;F;:absolute_name;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def absolute_name name;T;)T;*I"`def absolute_name name name =~ /\b_/ ? name.to_name.to_absolute(root.selfname) : name end;T;+To; ; F; ;,;;;I""Card::Query::CardClause#merge;F;[[I"s;T0;[[@ia;F;: merge;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def merge s;T;)T;*I"ndef merge s s = hashify s translate_to_attributes s ready_to_sqlize s @clause.merge! s self end;T;+To; ; F; ;,;;;I"$Card::Query::CardClause#hashify;F;[[I"s;T0;[[@ii;F;: hashify;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def hashify s;T;)T;*I"def hashify s case s when String; { :key => s.to_name.key } when Integer; { :id => s } when Hash; s else; raise BadQuery, "Invalid cardclause args #{s.inspect}" end end;T;+To; ; F; ;,;;;I"4Card::Query::CardClause#translate_to_attributes;F;[[I" clause;T0;[[@ir;F;:translate_to_attributes;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"'def translate_to_attributes clause;T;)T;*I"def translate_to_attributes clause content = nil clause.each do |key,val| if key == :_parent @parent = clause.delete(key) elsif OPERATORS.has_key?(key.to_s) && !ATTRIBUTES[key] clause.delete(key) content = [key,val] elsif MODIFIERS.has_key?(key) next if clause[key].is_a? Hash val = clause.delete key @mods[key] = Array === val ? val : val.to_s end end clause[:content] = content if content end;T;+To; ; F; ;,;;;I",Card::Query::CardClause#ready_to_sqlize;F;[[I" clause;T0;[[@i;F;:ready_to_sqlize;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def ready_to_sqlize clause;T;)T;*I"def ready_to_sqlize clause clause.each do |key,val| keyroot = field_root(key).to_sym if keyroot==:cond # internal SQL cond (already ready) elsif ATTRIBUTES[keyroot] == :basic # sqlize knows how to handle these keys; just process value clause[key] = ValueClause.new(val, self) else # keys need additional processing val = clause.delete key is_array = Array===val case ATTRIBUTES[keyroot] when :ignore #noop when :relational, :special, :conjunction ; relate is_array, keyroot, val, :send when :ref_relational ; relate is_array, keyroot, val, :refclause when :plus_relational # Arrays can have multiple interpretations for these, so we have to look closer... subcond = is_array && ( Array===val.first || conjunction(val.first) ) relate subcond, keyroot, val, :send else ; raise BadQuery, "Invalid attribute #{key}" end end end end;T;+To; ; F; ;,;;;I"#Card::Query::CardClause#relate;F;[ [I" subcond;T0[I"key;T0[I"val;T0[I" method;T0;[[@i;F;: relate;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I")def relate subcond, key, val, method;T;)T;*I"def relate subcond, key, val, method if subcond conj = conjunction( val.first ) ? conjunction( val.shift ) : :and if conj == current_conjunction # same conjunction as container, no need for subcondition val.each { |v| send method, key, v } else send conj, val.inject({}) { |h,v| h[field key] = v; h } # subcondition end else send method, key, val end end;T;+To; ; F; ;,;;;I"&Card::Query::CardClause#refclause;F;[[I"key;T0[I"val;T0;[[@i;F;:refclause;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def refclause key, val;T;)T;*I"mdef refclause key, val add_join :ref, RefClause.new( key, val, self ).to_sql, :id, :ref_id end;T;+To; ; F; ;,;;;I"(Card::Query::CardClause#conjunction;F;[[I"val;T0;[[@i;F;:conjunction;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def conjunction val;T;)T;*I"gdef conjunction val if [String, Symbol].member? val.class CONJUNCTIONS[val.to_sym] end end;T;+To; ; F; ;,;;;I"!Card::Query::CardClause#type;F;[[I"val;T0;[[@i;T;: type;;;[;{;IC;"~~~~~~ RELATIONAL ;T;[;[;I"~~~~~~ RELATIONAL;T;0; @ ;!F;"o;#;$F;%i;&i;'@;(I"def type val;T;)T;*I".def type val restrict :type_id, val end;T;+To; ; F; ;,;;;I"!Card::Query::CardClause#part;F;[[I"val;T0;[[@i;F;: part;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def part val;T;)T;*I"tdef part val right = Integer===val ? val : val.clone subcondition :left=>val, :right=>right, :conj=>:or end;T;+To; ; F; ;,;;;I"!Card::Query::CardClause#left;F;[[I"val;T0;[[@i;F;: left;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@;(I"def left val;T;)T;*I".def left val restrict :left_id, val end;T;+To; ; F; ;,;;;I""Card::Query::CardClause#right;F;[[I"val;T0;[[@i;F;: right;;;[;{;IC;" ;T; @;;.0;!F;[;[;I";T;0;'@;(I"def right val;T;)T;*I"0def right val restrict :right_id, val end;T;+To; ; F; ;,;;;I"&Card::Query::CardClause#editor_of;F;[[I"val;T0;[[@i;F;:editor_of;;;[;{;IC;" ;T; @J;.0;!F;[;[;I";T;0;'@;(I"def editor_of val;T;)T;*I"Qdef editor_of val action_clause :actor_id, "card_actions.card_id", val end;T;+To; ; F; ;,;;;I"&Card::Query::CardClause#edited_by;F;[[I"val;T0;[[@i;F;:edited_by;;;[;{;IC;" ;T; @Y;.0;!F;[;[;I";T;0;'@;(I"def edited_by val;T;)T;*I"Qdef edited_by val action_clause "card_actions.card_id", :actor_id, val end;T;+To; ; F; ;,;;;I"+Card::Query::CardClause#last_editor_of;F;[[I"val;T0;[[@i;F;:last_editor_of;;;[;{;IC;" ;T; @h;.0;!F;[;[;I";T;0;'@;(I"def last_editor_of val;T;)T;*I"Rdef last_editor_of val restrict_by_join :id, val, :return=>'updater_id' end;T;+To; ; F; ;,;;;I"+Card::Query::CardClause#last_edited_by;F;[[I"val;T0;[[@i;F;:last_edited_by;;;[;{;IC;" ;T; @w;.0;!F;[;[;I";T;0;'@;(I"def last_edited_by val;T;)T;*I";def last_edited_by val restrict :updater_id, val end;T;+To; ; F; ;,;;;I"'Card::Query::CardClause#creator_of;F;[[I"val;T0;[[@i;F;:creator_of;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def creator_of val;T;)T;*I"Ndef creator_of val restrict_by_join :id, val, :return=>'creator_id' end;T;+To; ; F; ;,;;;I"'Card::Query::CardClause#created_by;F;[[I"val;T0;[[@i;F;:created_by;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def created_by val;T;)T;*I"7def created_by val restrict :creator_id, val end;T;+To; ; F; ;,;;;I"&Card::Query::CardClause#member_of;F;[[I"val;T0;[[@i;F;:member_of;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def member_of val;T;)T;*I"Tdef member_of val merge field(:right_plus) => [RolesID, {:refer_to=>val}] end;T;+To; ; F; ;,;;;I"#Card::Query::CardClause#member;F;[[I"val;T0;[[@i;F;: member;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def member val;T;)T;*I"Xdef member val merge field(:referred_to_by) => {:left=>val, :right=>RolesID } end;T;+To; ; F; ;,;;;I"&Card::Query::CardClause#left_plus;F;[[I"val;T0;[[@i;T;:left_plus;;;[;{;IC;"~~~~~~ PLUS RELATIONAL ;T;[;[;I"~~~~~~ PLUS RELATIONAL;T;0; @;!F;"o;#;$F;%i;&i;'@;(I"def left_plus val;T;)T;*I"0def left_plus val junction :left, val end;T;+To; ; F; ;,;;;I"'Card::Query::CardClause#right_plus;F;[[I"val;T0;[[@i;F;:right_plus;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def right_plus val;T;)T;*I"2def right_plus val junction :right, val end;T;+To; ; F; ;,;;;I"!Card::Query::CardClause#plus;F;[[I"val;T0;[[@i;F;: plus;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def plus val;T;)T;*I"Odef plus val any( { :left_plus=>val, :right_plus=>val.deep_clone } ) end;T;+To; ; F; ;,;;;I"%Card::Query::CardClause#junction;F;[[I" side;T0[I"val;T0;[[@i;F;: junction;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def junction side, val;T;)T;*I"def junction side, val part_clause, junction_clause = val.is_a?(Array) ? val : [ val, {} ] restrict_by_join :id, junction_clause, side=>part_clause, :return=>"#{ side==:left ? :right : :left}_id" end;T;+To; ; F; ;,;;;I" Card::Query::CardClause#and;F;[[I"val;T0;[[@i;T;:and;;;[;{;IC;"~~~~~~~ CONJUNCTION ;T;[;[;I"~~~~~~~ CONJUNCTION;T;0; @;!F;"o;#;$F;%i;&i;'@;(I"def and val;T;)T;*I"'def and val subcondition val end;T;+To; ; F; ;,;;;I" Card::Query::CardClause#all;F;[;[[@i;F;:all;;;[;{;IC;"~~~~~~~ CONJUNCTION;T; @;.0;!F;[;[;I"~~~~~~~ CONJUNCTION ;T;0;"0;'@;(@;*I"'def and val subcondition val end;T;+To; ; F; ;,;;;I"Card::Query::CardClause#or;F;[[I"val;T0;[[@i;F;:or;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def or val;T;)T;*I"2def or val subcondition val, :conj=>:or end;T;+To; ; F; ;,;;;I" Card::Query::CardClause#any;F;[;[[@i ;F;:any;;;[;{;IC;";T; @,;.0;!F;[;[;I" ;T;0;"0;'@;(@*;*I"2def or val subcondition val, :conj=>:or end;T;+To; ; F; ;,;;;I"%Card::Query::CardClause#found_by;F;[[I"val;T0;[[@i;F;: found_by;;;[;{;IC;" ;T; @8;.0;!F;[;[;I";T;0;'@;(I"def found_by val;T;)T;*I"def found_by val cards = if Hash===val Query.new(val).run else Array.wrap(val).map do |v| Card.fetch absolute_name(val), :new=>{} end end cards.each do |c| unless c && [SearchTypeID,SetID].include?(c.type_id) raise BadQuery, %{"found_by" value needs to be valid Search, but #{c.name} is a #{c.type_name}} end restrict_by_join :id, CardClause.new(c.get_query).rawclause end end;T;+To; ; F; ;,;;;I" Card::Query::CardClause#not;F;[[I"val;T0;[[@i ;F;:not;;;[;{;IC;" ;T; @G;.0;!F;[;[;I";T;0;'@;(I"def not val;T;)T;*I"def not val subselect = CardClause.build(:return=>:id, :_parent=>self).merge(val).to_sql join_alias = add_join :not, subselect, :id, :id, :side=>'LEFT' merge field(:cond) => SqlCond.new("#{join_alias}.id is null") end;T;+To; ; F; ;,;;;I"!Card::Query::CardClause#sort;F;[[I"val;T0;[[@i&;F;: sort;;;[;{;IC;" ;T; @V;.0;!F;[;[;I";T;0;'@;(I"def sort val;T;)T;*I"Bdef sort val return nil if @parent val[:return] = val[:return] ? safe_sql(val[:return]) : 'db_content' item = val.delete(:item) || 'left' if val[:return] == 'count' cs_args = { :return=>'count', :group=>'sort_join_field', :_parent=>self } @mods[:sort] = "coalesce(count,0)" # needed for postgres case item when 'referred_to' join_field = 'id' cs = CardClause.build cs_args.merge( field(:cond)=>SqlCond.new("referer_id in #{CardClause.build( val.merge(:return=>'id')).to_sql}") ) cs.add_join :wr, :card_references, :id, :referee_id else raise BadQuery, "count with item: #{item} not yet implemented" end else join_field = case item when 'left' ; 'left_id' when 'right' ; 'right_id' else ; raise BadQuery, "sort item: #{item} not yet implemented" end cs = CardClause.build(val) end cs.sql.fields << "#{cs.table_alias}.#{join_field} as sort_join_field" join_table = add_join :sort, cs.to_sql, :id, :sort_join_field, :side=>'LEFT' @mods[:sort] ||= "#{join_table}.#{val[:return]}" end;T;+To; ; F; ;,;;;I""Card::Query::CardClause#match;F;[[I"val;T0;[[@iE;F;: match;;;[;{;IC;" ;T; @e;.0;!F;[;[;I";T;0;'@;(I"def match(val);T;)T;*I"def match(val) cxn, val = match_prep val val.gsub! /[^#{Card::Name::OK4KEY_RE}]+/, ' ' return nil if val.strip.empty? cond = begin val_list = val.split(/\s+/).map do |v| name_or_content = ["replace(#{self.table_alias}.name,'+',' ')","#{self.table_alias}.db_content"].map do |field| %{#{field} #{ cxn.match quote("[[:<:]]#{v}[[:>:]]") }} end "(#{name_or_content.join ' OR '})" end "(#{val_list.join ' AND '})" end merge field(:cond)=>SqlCond.new(cond) end;T;+To; ; F; ;,;;;I"%Card::Query::CardClause#complete;F;[[I"val;T0;[[@iY;F;;;;;[;{;IC;" ;T; @t;.0;!F;[;[;I";T;0;'@;(I"def complete(val);T;)T;*I"def complete(val) no_plus_card = (val=~/\+/ ? '' : "and right_id is null") #FIXME -- this should really be more nuanced -- it breaks down after one plus merge field(:cond) => SqlCond.new(" lower(name) LIKE lower(#{quote(val.to_s+'%')}) #{no_plus_card}") end;T;+To; ; F; ;,;;;I"+Card::Query::CardClause#extension_type;F;[[I"val;T0;[[@i^;F;:extension_type;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def extension_type val;T;)T;*I"def extension_type val # DEPRECATED LONG AGO!!! Rails.logger.info "using DEPRECATED extension_type in WQL" merge field(:right_plus) => AccountID end;T;+To; ; F; ;,;;;I"(Card::Query::CardClause#table_alias;F;[;[[@ij;F;:table_alias;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def table_alias;T;)T;*I"def table_alias case when @mods[:return]=='condition' @parent ? @parent.table_alias : "t" when @parent @parent.table_alias + "x" else "t" end end;T;+To; ; F; ;,;;;I"%Card::Query::CardClause#add_join;F;[ [I" name;T0[I" table;T0[I"cardfield;T0[I"otherfield;T0[I" opts;TI"{};T;[[@iu;F;: add_join;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I">def add_join(name, table, cardfield, otherfield, opts={});T;)T;*I"def add_join(name, table, cardfield, otherfield, opts={}) root.join_count = root.join_count.to_i + 1 join_alias = "#{name}_#{root.join_count}" on = "#{table_alias}.#{cardfield} = #{join_alias}.#{otherfield}" #is_subselect = !table.is_a?( Symbol ) if @mods[:conj] == 'or' #and is_subselect opts[:side] ||= 'LEFT' merge field(:cond) => SqlCond.new(on) end @joins[join_alias] = ["\n ", opts[:side], 'JOIN', table, 'AS', join_alias, 'ON', on, "\n"].compact.join ' ' join_alias end;T;+To; ; F; ;,;;;I""Card::Query::CardClause#field;F;[[I" name;T0;[[@i;F;: field;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def field name;T;)T;*I"tdef field name @fields ||= {} @fields[name] ||= 0 @fields[name] += 1 "#{ name }_#{ @fields[name] }" end;T;+To; ; F; ;,;;;I"'Card::Query::CardClause#field_root;F;[[I"key;T0;[[@i;F;:field_root;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def field_root key;T;)T;*I"7def field_root key key.to_s.gsub /\_\d+/, '' end;T;+To; ; F; ;,;;;I")Card::Query::CardClause#subcondition;F;[[I"val;T0[I" args;TI"{};T;[[@i;F;:subcondition;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"#def subcondition(val, args={});T;)T;*I"def subcondition(val, args={}) args = { :return=>:condition, :_parent=>self }.merge(args) cardclause = CardClause.build( args ) merge field(:cond) => cardclause.merge(val) self.joins.merge! cardclause.joins end;T;+To; ; F; ;,;;;I"*Card::Query::CardClause#action_clause;F;[[I" field;T0[I"linkfield;T0[I"val;T0;[[@i;F;:action_clause;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"-def action_clause(field, linkfield, val);T;)T;*I"xdef action_clause(field, linkfield, val) card_select = CardClause.build(:_parent=>self, :return=>'id').merge(val).to_sql sql = "(SELECT DISTINCT #{field} AS join_card_id FROM card_acts INNER JOIN card_actions ON card_acts.id = card_act_id " sql += " JOIN (#{card_select}) AS ss ON #{linkfield}=ss.id AND (draft is not true))" add_join :ac, sql, :id, :join_card_id end;T;+To; ; F; ;,;;;I"+Card::Query::CardClause#id_from_clause;F;[[I" clause;T0;[[@i;F;:id_from_clause;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def id_from_clause clause;T;)T;*I"udef id_from_clause clause case clause when Integer ; clause when String ; Card.fetch_id(clause) end end;T;+To; ; F; ;,;;;I"%Card::Query::CardClause#restrict;F;[[I" id_field;T0[I"val;T0[I" opts;TI"{};T;[[@i;F;: restrict;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;(I"(def restrict id_field, val, opts={};T;)T;*I"def restrict id_field, val, opts={} if id = id_from_clause(val) merge field(id_field) => id else restrict_by_join id_field, val, opts end end;T;+To; ; F; ;,;;;I"-Card::Query::CardClause#restrict_by_join;F;[[I" id_field;T0[I"val;T0[I" opts;TI"{};T;[[@i;F;:restrict_by_join;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"0def restrict_by_join id_field, val, opts={};T;)T;*I"def restrict_by_join id_field, val, opts={} opts.reverse_merge!(:return=>:id, :_parent=>self) subselect = CardClause.build(opts).merge(val).to_sql add_join "card_#{id_field}", subselect, id_field, opts[:return] end;T;+To; ; F; ;,;;;I"#Card::Query::CardClause#to_sql;F;[[I" *args;T0;[[@i;F;;;;;[;{;IC;" ;T; @1;.0;!F;[;[;I";T;0;'@;(I"def to_sql *args;T;)T;*I"def to_sql *args sql.conditions << basic_conditions if @mods[:return]=='condition' conds = sql.conditions.last return conds.blank? ? nil : "(#{conds})" end if pconds = permission_conditions sql.conditions << pconds end sql.fields.unshift fields_to_sql sql.order = sort_to_sql # has side effects! sql.tables = "cards #{table_alias}" sql.joins += @joins.values sql.conditions << "#{table_alias}.trash is false" sql.group = "GROUP BY #{safe_sql(@mods[:group])}" if !@mods[:group].blank? unless @parent or @mods[:return]=='count' if @mods[:limit].to_i > 0 sql.limit = "LIMIT #{ @mods[:limit ].to_i }" sql.offset = "OFFSET #{ @mods[:offset].to_i }" if !@mods[:offset].blank? end end sql.to_s end;T;+To; ; F; ;,;;;I"-Card::Query::CardClause#basic_conditions;F;[;[[@i;F;:basic_conditions;;;[;{;IC;" ;T; @@;.0;!F;[;[;I";T;0;'@;(I"def basic_conditions;T;)T;*I"def basic_conditions @clause.map { |key, val| val.to_sql field_root(key) }.compact.join " #{ current_conjunction } " end;T;+To; ; F; ;,;;;I"0Card::Query::CardClause#current_conjunction;F;[;[[@i;F;:current_conjunction;;;[;{;IC;" ;T; @M;.0;!F;[;[;I";T;0;'@;(I"def current_conjunction;T;)T;*I"Ldef current_conjunction @mods[:conj].blank? ? :and : @mods[:conj] end;T;+To; ; F; ;,;;;I"2Card::Query::CardClause#permission_conditions;F;[;[[@i;F;:permission_conditions;;;[;{;IC;" ;T; @Z;.0;!F;[;[;I";T;0;'@;(I"def permission_conditions;T;)T;*I"def permission_conditions unless Auth.always_ok? #or ( Card::Query.root_perms_only && !root? ) read_rules = Auth.as_card.read_rules read_rule_list = read_rules.nil? ? 1 : read_rules.join(',') "(#{table_alias}.read_rule_id IN (#{ read_rule_list }))" end end;T;+To; ; F; ;,;;;I"*Card::Query::CardClause#fields_to_sql;F;[;[[@i;F;:fields_to_sql;;;[;{;IC;" ;T; @g;.0;!F;[;[;I";T;0;'@;(I"def fields_to_sql;T;)T;*I"\def fields_to_sql field = @mods[:return] case (field.blank? ? :card : field.to_sym) when :raw; "#{table_alias}.*" when :card; "#{table_alias}.name" when :count; "coalesce(count(*),0) as count" when :content; "#{table_alias}.db_content" else ATTRIBUTES[field.to_sym]==:basic ? "#{table_alias}.#{field}" : safe_sql(field) end end;T;+To; ; F; ;,;;;I"(Card::Query::CardClause#sort_to_sql;F;[;[[@i;F;:sort_to_sql;;;[;{;IC;" ;T; @t;.0;!F;[;[;I";T;0;'@;(I"def sort_to_sql;T;)T;*I"def sort_to_sql #fail "order_key = #{@mods[:sort]}, class = #{order_key.class}" return nil if @parent or @mods[:return]=='count' #FIXME - extend to all root-only clauses order_key ||= @mods[:sort].blank? ? "update" : @mods[:sort] order_directives = [order_key].flatten.map do |key| dir = @mods[:dir].blank? ? (DEFAULT_ORDER_DIRS[key.to_sym]||'asc') : safe_sql(@mods[:dir]) #wonky sort_field key, @mods[:sort_as], dir end.join ', ' "ORDER BY #{order_directives}" end;T;+To; ; F; ;,;;;I"'Card::Query::CardClause#sort_field;F;[[I"key;T0[I"as;T0[I"dir;T0;[[@i;F;:sort_field;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I" def sort_field key, as, dir;T;)T;*I"def sort_field key, as, dir order_field = case key when "id"; "#{table_alias}.id" when "update"; "#{table_alias}.updated_at" when "create"; "#{table_alias}.created_at" when /^(name|alpha)$/; "LOWER( #{table_alias}.key )" when 'content'; "#{table_alias}.db_content" when "relevance"; "#{table_alias}.updated_at" #deprecated else safe_sql(key) end order_field = "CAST(#{order_field} AS #{cast_type(as)})" if as "#{order_field} #{dir}" end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={ ; IC;={;@;0;>T; IC;={;@;0;>T;5IC;={;@;0;>T;6IC;={;@;0;>T;IC;={;@;@ ;>T;7IC;={;@;@,;>T;>T;>T;?{@;T@,;V;@[;[[@i ;F;:CardClause;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@ ;I"Card::Query::CardClause;F;Bo;C ;D0;E0;F0;;-;'@G;H@;O0;+To; ;IC;[ o; ; F; ;,;;;I"(Card::Query::ValueClause#initialize;F;[[I" clause;T0[I"cardclause;T0;[[I"#lib/card/query/value_clause.rb;Ti;F;;|;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I""a new instance of ValueClause;T;0;3[I"ValueClause;F; @;I";T;0;'@;(I"&def initialize clause, cardclause;T;)T;*I"#def initialize clause, cardclause @cardclause = cardclause # bare value shortcut @clause = case clause when ValueClause; clause.instance_variable_get('@clause') # FIXME what a hack (what's this for?) when Array; clause when String; ['=', clause] when Integer; ['=', clause] else raise("Invalid Condition Clause #{clause.inspect}") end # operator aliases @clause[0] = @clause[0].to_s if target = OPERATORS[@clause[0]] @clause[0] = target end # check valid operator raise("Invalid Operator #{@clause[0]}") unless OPERATORS.has_key?(@clause[0]) # handle IN #FIXME -- shouldn't this handle "not in", too? if @clause[0]=='in' and !@clause[1].is_a?(CardClause) and !@clause[1].is_a?(RefClause) @clause = [@clause[0], @clause[1..-1]] end end;T;+To; ; F; ;,;;;I" Card::Query::ValueClause#op;F;[;[[@i#;F;:op;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I" def op;T;)T;*I"def op @clause[0] end;T;+To; ; F; ;,;;;I"$Card::Query::ValueClause#sqlize;F;[[I"v;T0;[[@i';F;: sqlize;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def sqlize(v);T;)T;*I"def sqlize(v) case v when CardClause, RefClause, SqlCond; v.to_sql when Array; "(" + v.flatten.collect {|x| sqlize(x)}.join(',') + ")" else quote(v.to_s) end end;T;+To; ; F; ;,;;;I"$Card::Query::ValueClause#to_sql;F;[[I" field;T0;[[@i/;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def to_sql field;T;)T;*I"def to_sql field op,v = @clause #warn "to_sql(#{field}), #{op}, #{v}, #{@cardclause.inspect}" v=@cardclause.selfname if v=='_self' table = @cardclause.table_alias #warn "to_sql #{field}, #{v} (#{op})" field, v = case field when "cond"; return "(#{sqlize(v)})" when "name"; ["#{table}.key", [v].flatten.map(&:to_name).map(&:key)] when "content"; ["#{table}.db_content", v] else; ["#{table}.#{safe_sql(field)}", v] end v = v[0] if Array===v && v.length==1 && op != 'in' if op=='~' cxn, v = match_prep(v) %{#{field} #{cxn.match(sqlize(v))}} else "#{field} #{op} #{sqlize(v)}" end end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i;F;:ValueClause;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@ ;I"Card::Query::ValueClause;F;Bo;C ;D0;E0;F0;;-;'@G;H@;O0;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;>T;>T;?{;@[;[ [@ i[@Qi[@i[@i;F;;.;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@I;I"Card::Query;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+To; ;IC;[&o;4;[[I"lib/card/cache.rb;Ti;F;:TEST_ENVS;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Cache::TEST_ENVS;F;(I""TEST_ENVS = %w{test cucumber};T;*I""TEST_ENVS = %w{test cucumber};T;6I"%w{test cucumber};T;+To;V;[[@i;F;:@@prepopulating;;;;;[;{;IC;" ;T; @$;.0;!F;[;[;I";T;0;'@;I"!Card::Cache::@@prepopulating;F;(I"7@@prepopulating = TEST_ENVS.include? Rails.env;T;*I"7@@prepopulating = TEST_ENVS.include? Rails.env;T;6I"!TEST_ENVS.include? Rails.env;T;+To;V;[[@i;F;:@@using_rails_cache;;;;;[;{;IC;" ;T; @1;.0;!F;[;[;I";T;0;'@;I"%Card::Cache::@@using_rails_cache;F;(I"7@@using_rails_cache = TEST_ENVS.include? Rails.env;T;*I"7@@using_rails_cache = TEST_ENVS.include? Rails.env;T;6I"!TEST_ENVS.include? Rails.env;T;+To;V;[[@i;F;:@@cache_by_class;;;;;[;{;IC;" ;T; @>;.0;!F;[;[;I";T;0;'@;I""Card::Cache::@@cache_by_class;F;(I"@@cache_by_class = {};T;*I"@@cache_by_class = {};T;6I"{};T;+To; ; F; ; ;;;I"Card::Cache.[];F;[[I" klass;T0;[[@i;F;;;;;[;{;IC;" ;T; @K;.0;!F;[;[;I";T;0;'@;(I"def [] klass;T;)T;*I"def [] klass raise "nil klass" if klass.nil? cache_by_class[klass] ||= new :class=>klass, :store=>(@@using_rails_cache ? nil : Cardio.cache) end;T;+To; ; F; ; ;;;I"Card::Cache.renew;F;[;[[@i$;F;: renew;;;[;{;IC;" ;T; @Z;.0;!F;[;[;I";T;0;'@;(I"def renew;T;)T;*I"def renew cache_by_class.keys do |klass| if klass.cache cache_by_class[klass].system_prefix = system_prefix(klass) else raise "renewing nil cache: #{klass}" end end reset_local end;T;+To; ; F; ; ;;;I"Card::Cache.prefix_root;F;[;[[@i/;F;:prefix_root;;;[;{;IC;" ;T; @g;.0;!F;[;[;I";T;0;'@;(I"def prefix_root;T;)T;*I"def prefix_root @@prefix_root ||= ( cfg = Cardio.config and cfg = cfg.database_configuration and cfg[Rails.env]['database'] ) end;T;+To; ; F; ; ;;;I"Card::Cache.system_prefix;F;[[I" klass;T0;[[@i4;F;:system_prefix;;;[;{;IC;" ;T; @t;.0;!F;[;[;I";T;0;'@;(I"def system_prefix klass;T;)T;*I"@def system_prefix klass "#{ prefix_root }/#{ klass }" end;T;+To; ; F; ; ;;;I"Card::Cache.restore;F;[[I" klass;TI"nil;T;[[@i8;F;: restore;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def restore klass=nil;T;)T;*I":def restore klass=nil reset_local prepopulate end;T;+To; ; F; ; ;;;I""Card::Cache.generate_cache_id;F;[;[[@i=;F;:generate_cache_id;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def generate_cache_id;T;)T;*I"zdef generate_cache_id ((Time.now.to_f * 100).to_i).to_s + ('a'..'z').to_a[rand(26)] + ('a'..'z').to_a[rand(26)] end;T;+To; ; F; ; ;;;I"Card::Cache.reset_global;F;[;[[@iA;F;:reset_global;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def reset_global;T;)T;*I"def reset_global cache_by_class.each do |klass, cache| cache.reset hard=true end Card::Codename.reset_cache Cardio.delete_tmp_files end;T;+To; ; F; ; ;;;I"Card::Cache.reset_local;F;[;[[@iI;F;:reset_local;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def reset_local;T;)T;*I"def reset_local cache_by_class.each do |cc, cache| if Card::Cache===cache cache.reset_local else warn "reset class #{cc}, #{cache.class} #{caller[0..8]*"\n"} ???" end end end;T;+To; ; F; ; ;;;I"Card::Cache.obj_to_key;F;[[I"obj;T0;[[@iQ;F;:obj_to_key;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def obj_to_key obj;T;)T;*I"def obj_to_key obj case obj when Hash obj.sort.map do |key, value| "#{key}=>(#{obj_to_key(value)})" end.join "," when Array obj.map do |value| obj_to_key(value) end.join "," else obj.to_s end end;T;+To; ; F; ; ;;b;I"Card::Cache.prepopulate;F;[;[[@ib;F;:prepopulate;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def prepopulate;T;)T;*I"def prepopulate if @@prepopulating @@rule_cache ||= Card.rule_cache @@read_rule_cache ||= Card.read_rule_cache @@user_ids_cache ||= Card.user_ids_cache @@rule_keys_cache ||= Card.rule_keys_cache Card.cache.write_local 'RULES', @@rule_cache Card.cache.write_local 'READRULES', @@read_rule_cache Card.cache.write_local 'USER_IDS', @@user_ids_cache Card.cache.write_local 'RULE_KEYS', @@rule_keys_cache end end;T;+To; ; F; ;,;;;I"Card::Cache#prefix;F;[;[[@is;F;: prefix;;;[;{;IC;"*Returns the value of attribute prefix ;T; @;.0;!F;[;[;I"*Returns the value of attribute prefix;T;0;'@;(I"def prefix;T;*I"def prefix @prefix end;T;+To; ; F; ;,;;;I"Card::Cache#store;F;[;[[@is;F;: store;;;[;{;IC;")Returns the value of attribute store ;T; @;.0;!F;[;[;I")Returns the value of attribute store;T;0;'@;(I"def store;T;*I"def store @store end;T;+To; ; F; ;,;;;I"Card::Cache#klass;F;[;[[@is;F;: klass;;;[;{;IC;")Returns the value of attribute klass ;T; @;.0;!F;[;[;I")Returns the value of attribute klass;T;0;'@;(I"def klass;T;*I"def klass @klass end;T;+To; ; F; ;,;;;I"Card::Cache#local;F;[;[[@it;F;: local;;;[;{;IC;")Returns the value of attribute local ;T; @;.0;!F;[;[;I")Returns the value of attribute local;T;0;'@;(I"def local;T;*I"def local @local end;T;+To; ; F; ;,;;;I"Card::Cache#local=;F;[[I" value;T0;[[@it;F;: local=;;;[;{;IC;"Sets the attribute local ;T; @ ;.0;!F;[;[o;0 ;1I" param;F;2I"-the value to set the attribute local to.;T;I" value;T;30; @ ;I"SSets the attribute local @param value the value to set the attribute local to.;T;0;'@;(I"def local=(value);T;*I"+def local=(value) @local = value end;T;+To; ; F; ;,;;;I"Card::Cache#initialize;F;[[I" opts;TI"{};T;[[@iv;F;;|;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of Cache;T;0;3[I" Cache;F; @;I";T;0;'@;(I"def initialize opts={};T;)T;*I"def initialize opts={} #warn "new cache #{opts.inspect}" @klass = opts[:class] @store = opts[:store] @local = Hash.new self.system_prefix = opts[:prefix] || self.class.system_prefix(opts[:class]) cache_by_class[klass] = self end;T;+To; ; F; ;,;;;I"Card::Cache#system_prefix=;F;[[I"system_prefix;T0;[[@i{;F;:system_prefix=;;;[;{;IC;" ;T; @2;.0;!F;[;[;I";T;0;'@;(I"%def system_prefix= system_prefix;T;)T;*I"vdef system_prefix= system_prefix @system_prefix = system_prefix if @store.nil? @prefix = system_prefix + self.class.generate_cache_id + "/" else @system_prefix += '/' unless @system_prefix[-1] == '/' @cache_id = @store.fetch(@system_prefix + "cache_id") do self.class.generate_cache_id end @prefix = @system_prefix + @cache_id + "/" end end;T;+To; ; F; ;,;;;I"Card::Cache#read;F;[[I"key;T0;[[@i;F;;;;;[;{;IC;" ;T; @A;.0;!F;[;[;I";T;0;'@;(I"def read key;T;)T;*I"def read key if @local.has_key? key read_local key elsif @store write_local key, @store.read(@prefix + key) end end;T;+To; ; F; ;,;;;I"Card::Cache#read_local;F;[[I"key;T0;[[@i;F;:read_local;;;[;{;IC;" ;T; @P;.0;!F;[;[;I";T;0;'@;(I"def read_local key;T;)T;*I")def read_local key @local[key] end;T;+To; ; F; ;,;;;I"Card::Cache#write_variable;F;[[I"key;T0[I" variable;T0[I" value;T0;[[@i;F;:write_variable;;;[;{;IC;" ;T; @_;.0;!F;[;[;I";T;0;'@;(I",def write_variable key, variable, value;T;)T;*I"def write_variable key, variable, value key = @prefix + key if @store and object = @store.read(key) object.instance_variable_set "@#{ variable }", value @store.write key, object end value end;T;+To; ; F; ;,;;;I"Card::Cache#write;F;[[I"key;T0[I" value;T0;[[@i;F;;;;;[;{;IC;" ;T; @r;.0;!F;[;[;I";T;0;'@;(I"def write key, value;T;)T;*I"edef write key, value @store.write(@prefix + key, value) if @store write_local key, value end;T;+To; ; F; ;,;;;I"Card::Cache#write_local;F;[[I"key;T0[I" value;T0;[[@i;F;:write_local;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def write_local key, value;T;)T;*I"9def write_local key, value @local[key] = value end;T;+To; ; F; ;,;;;I"Card::Cache#fetch;F;[[I"key;T0[I" &block;T0;[[@i;F;: fetch;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def fetch key, &block;T;)T;*I"def fetch key, &block fetch_local key do if @store @store.fetch(@prefix + key, &block) else block.call end end end;T;+To; ; F; ;,;;;I"Card::Cache#fetch_local;F;[[I"key;T0;[[@i;F;:fetch_local;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def fetch_local key;T;)T;*I"Gdef fetch_local key read_local key or write_local key, yield end;T;+To; ; F; ;,;;;I"Card::Cache#delete;F;[[I"key;T0;[[@i;F;;|;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def delete key;T;)T;*I"Tdef delete key @store.delete(@prefix + key) if @store @local.delete key end;T;+To; ; F; ;,;;;I"Card::Cache#dump;F;[;[[@i;F;: dump;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I" def dump;T;)T;*I"ldef dump p "dumping local...." @local.each do |k, v| p "#{k} --> #{v.inspect[0..30]}" end end;T;+To; ; F; ;,;;;I"Card::Cache#reset;F;[[I" hard;TI" false;T;[[@i;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def reset hard=false;T;)T;*I"fdef reset hard=false reset_local @cache_id = self.class.generate_cache_id if @store if hard begin @store.clear rescue => e Rails.logger.debug "Problem clearing cache: #{e.message}" end else @store.write @system_prefix + "cache_id", @cache_id end end @prefix = @system_prefix + @cache_id + "/" end;T;+To; ; F; ;,;;;I"Card::Cache#reset_local;F;[;[[@i;F;;z;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def reset_local;T;)T;*I"&def reset_local @local = {} end;T;+To; ; F; ;,;;;I"Card::Cache#exist?;F;[[I"key;T0;[[@i;F;: exist?;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @;I";T;0;'@;(I"def exist? key;T;)T;*I"Ddef exist? key @local.has_key?(key) || @store.exist?(key) end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={ ;}IC;={;@;0;>T;~IC;={;@;0;>T;IC;={;@;0;>T;IC;={;@;@ ;>T;>T;>T;?{;@[;[[@i;F;: Cache;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Cache;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+To;;IC;[ o; ; F; ; ;;;I"Card::Chunk.register_class;F;[[I" klass;T0[I" hash;T0;[[I"lib/card/chunk.rb;Ti;F;:register_class;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"#def register_class klass, hash;T;)T;*I"def register_class klass, hash klass.config = hash.merge :class => klass prefix_index = hash[:idx_char] || :default # this is gross and needs to be moved out. prefix_map[prefix_index] = klass.config end;T;+To; ; F; ; ;;;I"Card::Chunk.register_list;F;[[I"key;T0[I" list;T0;[[@!i;F;:register_list;;;[;{;IC;" ;T; @*;.0;!F;[;[;I";T;0;'@;(I" def register_list key, list;T;)T;*I";def register_list key, list raw_list[key] = list end;T;+To; ; F; ; ;;;I"%Card::Chunk.find_class_by_prefix;F;[[I" prefix;T0;[[@!i";F;:find_class_by_prefix;;;[;{;IC;" ;T; @;;.0;!F;[;[;I";T;0;'@;(I"$def find_class_by_prefix prefix;T;)T;*I"def find_class_by_prefix prefix config = prefix_map[ prefix[0,1] ] || prefix_map[ prefix[-1,1] ] || prefix_map[:default] #prefix identified by first character, last character, or default. a little ugly... config[:class] end;T;+To; ; F; ; ;;;I""Card::Chunk.get_prefix_regexp;F;[[I"chunk_list_key;T0;[[@!i(;F;:get_prefix_regexp;;;[;{;IC;" ;T; @J;.0;!F;[;[;I";T;0;'@;(I")def get_prefix_regexp chunk_list_key;T;)T;*I"3def get_prefix_regexp chunk_list_key prefix_regexp_by_list[chunk_list_key] ||= begin chunk_types = raw_list[chunk_list_key].map { |chunkname| const_get chunkname } prefix_res = chunk_types.map do |chunk_class| chunk_class.config[:prefix_re] end /(?:#{ prefix_res * '|' })/m end end;T;+To; ;IC;[o; ; F; ;,;;;I"Card::Chunk::Abstract#text;F;[;[[@!i<;F;: text;;;[;{;IC;"(Returns the value of attribute text ;T; @[;.0;!F;[;[;I"(Returns the value of attribute text;T;0;'@Y;(I" def text;T;*I"def text @text end;T;+To; ; F; ;,;;;I"(Card::Chunk::Abstract#process_chunk;F;[;[[@!i<;F;:process_chunk;;;[;{;IC;"1Returns the value of attribute process_chunk ;T; @h;.0;!F;[;[;I"1Returns the value of attribute process_chunk;T;0;'@Y;(I"def process_chunk;T;*I"+def process_chunk @process_chunk end;T;+To; ; F; ; ;;;I"%Card::Chunk::Abstract.full_match;F;[[I" content;T0[I" prefix;TI"nil;T;[[@!i?;F;:full_match;;;[;{;IC;" ;T; @u;.0;!F;[;[;I";T;0;'@Y;(I"'def full_match content, prefix=nil;T;)T;*I"def full_match content, prefix=nil # warn "attempting full match on #{content}. class = #{self}" content.match full_re( prefix ) end;T;+To; ; F; ; ;;;I""Card::Chunk::Abstract.full_re;F;[[I" prefix;T0;[[@!iD;F;: full_re;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@Y;(I"def full_re prefix;T;)T;*I".def full_re prefix config[:full_re] end;T;+To; ; F; ; ;;;I"&Card::Chunk::Abstract.context_ok?;F;[[I" content;T0[I"chunk_start;T0;[[@!iH;F;:context_ok?;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @;I";T;0;'@Y;(I")def context_ok? content, chunk_start;T;)T;*I"4def context_ok? content, chunk_start true end;T;+To; ; F; ;,;;;I"%Card::Chunk::Abstract#initialize;F;[[I" match;T0[I" content;T0;[[@!iM;F;;|;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of Abstract;T;0;3[I" Abstract;F; @;I";T;0;'@Y;(I""def initialize match, content;T;)T;*I"~def initialize match, content @text = match[0] @processed = nil @content = content interpret match, content self end;T;+To; ; F; ;,;;;I"$Card::Chunk::Abstract#interpret;F;[[I"match_string;T0[I" content;T0[I" params;T0;[[@!iU;F;:interpret;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@Y;(I"0def interpret match_string, content, params;T;)T;*I"def interpret match_string, content, params Rails.logger.info "no #interpret method found for chunk class: #{self.class}" end;T;+To; ; F; ;,;;;I"!Card::Chunk::Abstract#format;F;[;[[@!iY;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@Y;(I"def format;T;)T;*I"%def format @content.format end;T;+To; ; F; ;,;;;I"Card::Chunk::Abstract#card;F;[;[[@!i];F;: card;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@Y;(I" def card;T;)T;*I"!def card @content.card end;T;+To; ; F; ;,;;;I"Card::Chunk::Abstract#to_s;F;[;[[@!ia;F;;%;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@Y;(I" def to_s;T;)T;*I"9def to_s @process_chunk || @processed || @text end;T;+To; ; F; ;,;;;I""Card::Chunk::Abstract#inspect;F;[;[[@!ie;F;: inspect;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@Y;(I"def inspect;T;)T;*I"1def inspect "<##{self.class}##{to_s}>" end;T;+To; ; F; ;,;;;I""Card::Chunk::Abstract#as_json;F;[[I" options;TI"{};T;[[@!ii;F;: as_json;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@Y;(I"def as_json(options={});T;)T;*I"udef as_json(options={}) @process_chunk || @processed|| "not rendered #{self.class}, #{card and card.name}" end;T;+T;9@Y;:IC;[;9@Y;;IC;[;9@Y;T;,IC;={;IC;={;@[;0;>T;IC;={;@h;0;>T;>T;>T;?{;@[;[[@!i:;F;: Abstract;;;;;[;{;IC;" ;T; @Y;.0;!F;[;[;I";T;0;'@;I"Card::Chunk::Abstract;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@!i;T;: Chunk;;;;;[;{;IC;"A chunk is a pattern of text that can be protected and interrogated by a format. Each Chunk class has a +pattern+ that states what sort of text it matches. Chunks are initalized by passing in the result of a match by its pattern. ;T;[;[;I"A chunk is a pattern of text that can be protected and interrogated by a format. Each Chunk class has a +pattern+ that states what sort of text it matches. Chunks are initalized by passing in the result of a match by its pattern.;T;0; @;!F;"o;#;$F;%i;&i;'@;I"Card::Chunk;F;+To; ;IC;[Ho;4;[[I"lib/card/format.rb;Ti ;F;:DEPRECATED_VIEWS;;;;;[;{;IC;" ;T; @?;.0;!F;[;[;I";T;0;'@=;I"#Card::Format::DEPRECATED_VIEWS;F;(I"cDEPRECATED_VIEWS = { :view=>:open, :card=>:open, :line=>:closed, :bare=>:core, :naked=>:core };T;*I"cDEPRECATED_VIEWS = { :view=>:open, :card=>:open, :line=>:closed, :bare=>:core, :naked=>:core };T;6I"P{ :view=>:open, :card=>:open, :line=>:closed, :bare=>:core, :naked=>:core };T;+To;4;[[@Bi ;F;:INCLUSION_MODES;;;;;[;{;IC;" ;T; @M;.0;!F;[;[;I";T;0;'@=;I""Card::Format::INCLUSION_MODES;F;(I"SINCLUSION_MODES = { :closed=>:closed, :closed_content=>:closed, :edit=>:edit,;T;*I"INCLUSION_MODES = { :closed=>:closed, :closed_content=>:closed, :edit=>:edit, :layout=>:layout, :new=>:edit, :setup=>:edit, :normal=>:normal, :template=>:template };T;6I"{ :closed=>:closed, :closed_content=>:closed, :edit=>:edit, :layout=>:layout, :new=>:edit, :setup=>:edit, :normal=>:normal, :template=>:template };T;+To; ; F; ;,;;;I"Card::Format#card;F;[;[[@Bi;F;;;;;[;{;IC;"(Returns the value of attribute card ;T; @Z;.0;!F;[;[;I"(Returns the value of attribute card;T;0;'@=;(I" def card;T;*I"def card @card end;T;+To; ; F; ;,;;;I"Card::Format#root;F;[;[[@Bi;F;;;;;[;{;IC;"(Returns the value of attribute root ;T; @g;.0;!F;[;[;I"(Returns the value of attribute root;T;0;'@=;(I" def root;T;*I"def root @root end;T;+To; ; F; ;,;;;I"Card::Format#parent;F;[;[[@Bi;F;;s;;;[;{;IC;"*Returns the value of attribute parent ;T; @t;.0;!F;[;[;I"*Returns the value of attribute parent;T;0;'@=;(I"def parent;T;*I"def parent @parent end;T;+To; ; F; ;,;;;I"Card::Format#main_opts;F;[;[[@Bi;F;:main_opts;;;[;{;IC;"-Returns the value of attribute main_opts ;T; @;.0;!F;[;[;I"-Returns the value of attribute main_opts;T;0;'@=;(I"def main_opts;T;*I"#def main_opts @main_opts end;T;+To; ; F; ;,;;;I"Card::Format#form;F;[;[[@Bi;F;: form;;;[;{;IC;"(Returns the value of attribute form ;T; @;.0;!F;[;[;I"(Returns the value of attribute form;T;0;'@=;(I" def form;T;*I"def form @form end;T;+To; ; F; ;,;;;I"Card::Format#form=;F;[[I" value;T0;[[@Bi;F;: form=;;;[;{;IC;"Sets the attribute form ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I",the value to set the attribute form to.;T;I" value;T;30; @;I"QSets the attribute form @param value the value to set the attribute form to.;T;0;'@=;(I"def form=(value);T;*I")def form=(value) @form = value end;T;+To; ; F; ;,;;;I"Card::Format#error_status;F;[;[[@Bi;F;:error_status;;;[;{;IC;"0Returns the value of attribute error_status ;T; @;.0;!F;[;[;I"0Returns the value of attribute error_status;T;0;'@=;(I"def error_status;T;*I")def error_status @error_status end;T;+To; ; F; ;,;;;I"Card::Format#error_status=;F;[[I" value;T0;[[@Bi;F;:error_status=;;;[;{;IC;"$Sets the attribute error_status ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I"4the value to set the attribute error_status to.;T;I" value;T;30; @;I"aSets the attribute error_status @param value the value to set the attribute error_status to.;T;0;'@=;(I"def error_status=(value);T;*I"9def error_status=(value) @error_status = value end;T;+To; ; F; ;,;;;I" Card::Format#inclusion_opts;F;[;[[@Bi;F;:inclusion_opts;;;[;{;IC;"2Returns the value of attribute inclusion_opts ;T; @;.0;!F;[;[;I"2Returns the value of attribute inclusion_opts;T;0;'@=;(I"def inclusion_opts;T;*I"-def inclusion_opts @inclusion_opts end;T;+To; ; F; ;,;;;I"!Card::Format#inclusion_opts=;F;[[I" value;T0;[[@Bi;F;:inclusion_opts=;;;[;{;IC;"&Sets the attribute inclusion_opts ;T; @;.0;!F;[;[o;0 ;1I" param;F;2I"6the value to set the attribute inclusion_opts to.;T;I" value;T;30; @;I"eSets the attribute inclusion_opts @param value the value to set the attribute inclusion_opts to.;T;0;'@=;(I"def inclusion_opts=(value);T;*I"=def inclusion_opts=(value) @inclusion_opts = value end;T;+To;V;[[@Bi;F;:@@registered;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;I"Card::Format::@@registered;F;(I"@@registered = [];T;*I"@@registered = [];T;6I"[];T;+To; ; F; ; ;;;I"Card::Format.register;F;[[I" format;T0;[[@Bi;F;: register;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def register format;T;)T;*I":def register format @@registered << format.to_s end;T;+To; ; F; ; ;;;I"#Card::Format.format_class_name;F;[[I" format;T0;[[@Bi;F;:format_class_name;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@=;(I"!def format_class_name format;T;)T;*I"def format_class_name format format = format.to_s format = '' if format == 'base' format = @@aliases[ format ] if @@aliases[ format ] "#{ format.camelize }Format" end;T;+To; ; F; ; ;;;I"$Card::Format.extract_class_vars;F;[[I" view;T0[I" opts;T0;[[@Bi(;F;:extract_class_vars;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"&def extract_class_vars view, opts;T;)T;*I"def extract_class_vars view, opts return unless opts.present? perms[view] = opts.delete(:perms) if opts[:perms] error_codes[view] = opts.delete(:error_code) if opts[:error_code] denial_views[view] = opts.delete(:denial) if opts[:denial] closed_views[view] = opts.delete(:closed) if opts[:closed] if tags = opts.delete(:tags) Array.wrap(tags).each do |tag| view_tags[view] ||= {} view_tags[view][tag] = true end end end;T;+To; ; F; ; ;;;I"Card::Format.new;F;[[I" card;T0[I" opts;TI"{};T;[[@Bi8;F;:new;;;[;{;IC;" ;T; @*;.0;!F;[;[;I";T;0;'@=;(I"def new card, opts={};T;)T;*I"def new card, opts={} if self != Format super else klass = Card.const_get format_class_name( opts[:format] || :html ) self == klass ? super : klass.new( card, opts ) end end;T;+To; ; F; ; ;;;I"Card::Format.tagged;F;[[I" view;T0[I"tag;T0;[[@BiA;F;: tagged;;;[;{;IC;" ;T; @<;.0;!F;[;[;I";T;0;'@=;(I"def tagged view, tag;T;)T;*I"odef tagged view, tag view and tag and view_tags = @@view_tags[view.to_sym] and view_tags[tag.to_sym] end;T;+To; ; F; ; ;;;I"!Card::Format.format_ancestry;F;[;[[@BiF;F;:format_ancestry;;;[;{;IC;" ;T; @M;.0;!F;[;[;I";T;0;'@=;(I"def format_ancestry;T;)T;*I"def format_ancestry ancestry = [ self ] unless self == Card::Format ancestry = ancestry + superclass.format_ancestry end ancestry end;T;+To; ; F; ; ;;;I"Card::Format.max_depth;F;[;[[@BiN;F;:max_depth;;;[;{;IC;" ;T; @Z;.0;!F;[;[;I";T;0;'@=;(I"def max_depth;T;)T;*I".def max_depth Card.config.max_depth end;T;+To; ; F; ;,;;;I"Card::Format#initialize;F;[[I" card;T0[I" opts;TI"{};T;[[@BiV;T;;|;;;[;{;IC;"~~~~~ INSTANCE METHODS ;T;[;[o;0 ;1I" return;F;2I"a new instance of Format;T;0;3[I" Format;F; @g;I"~~~~~ INSTANCE METHODS;T;0; @g;!F;"o;#;$F;%iT;&iT;'@=;(I"!def initialize card, opts={};T;)T;*I"5def initialize card, opts={} @card = card or raise Card::Error, "format initialized without card" opts.each do |key, value| instance_variable_set "@#{key}", value end @mode ||= :normal @depth ||= 0 @root ||= self @context_names = get_context_names include_set_format_modules self end;T;+To; ; F; ;,;;;I"#Card::Format#get_context_names;F;[;[[@Bie;F;:get_context_names;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def get_context_names;T;)T;*I"8def get_context_names case when @context_names part_keys = @card.cardname.part_names.map &:key @context_names.reject { |n| !part_keys.include? n.key } when params[:slot] context_name_list = params[:slot][:name_context].to_s context_name_list.split(',').map &:to_name else [] end end;T;+To; ; F; ;,;;;I",Card::Format#include_set_format_modules;F;[;[[@Bir;F;:include_set_format_modules;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"#def include_set_format_modules;T;)T;*I"def include_set_format_modules self.class.format_ancestry.reverse.each do |klass| card.set_format_modules( klass ).each do |m| singleton_class.send :include, m end end end;T;+To; ; F; ;,;;;I"$Card::Format#inclusion_defaults;F;[[I"nested_card;T0;[[@Biz;F;:inclusion_defaults;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"'def inclusion_defaults nested_card;T;)T;*I"def inclusion_defaults nested_card @inclusion_defaults ||= begin defaults = get_inclusion_defaults(nested_card).clone defaults.merge! @inclusion_opts if @inclusion_opts defaults end end;T;+To; ; F; ;,;;;I"(Card::Format#get_inclusion_defaults;F;[[I"nested_card;T0;[[@Bi};F;:get_inclusion_defaults;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"+def get_inclusion_defaults nested_card;T;)T;*I"Ddef get_inclusion_defaults nested_card { :view => :name } end;T;+To; ; F; ;,;;;I"Card::Format#params;F;[;[[@Bi;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def params;T;)T;*I" def params Env.params end;T;+To; ; F; ;,;;;I"Card::Format#controller;F;[;[[@Bi;F;:controller;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def controller;T;)T;*I"Adef controller Env[:controller] ||= CardController.new end;T;+To; ; F; ;,;;;I"Card::Format#session;F;[;[[@Bi;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def session;T;)T;*I""def session Env.session end;T;+To; ; F; ;,;;;I"Card::Format#showname;F;[[I" title;TI"nil;T;[[@Bi;F;: showname;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def showname title=nil;T;)T;*I"def showname title=nil if title title.to_name.to_absolute_name(card.cardname).to_show *@context_names else @showname ||= card.cardname.to_show *@context_names end end;T;+To; ; F; ;,;;;I"#Card::Format#with_name_context;F;[[I" name;T0;[[@Bi;F;:with_name_context;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def with_name_context name;T;)T;*I"def with_name_context name old_context = @context_names add_name_context name result = yield @context_names = old_context result end;T;+To; ; F; ;,;;;I"Card::Format#main?;F;[;[[@Bi;F;: main?;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @;I";T;0;'@=;(I"def main?;T;)T;*I" def main? @depth == 0 end;T;+To; ; F; ;,;;;I"Card::Format#focal?;F;[;[[@Bi;T;: focal?;;;[;{;IC;"3meaning the current card is the requested card ;T;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @;I"3meaning the current card is the requested card;T;0; @;!F;"o;#;$F;%i;&i;'@=;(I"@def focal? # meaning the current card is the requested card;T;)T;*I"zdef focal? # meaning the current card is the requested card if Env.ajax? @depth == 0 else main? end end;T;+To; ; F; ;,;;;I"Card::Format#template;F;[;[[@Bi;F;: template;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@=;(I"def template;T;)T;*I"def template @template ||= begin c = controller t = ActionView::Base.new c.class.view_paths, {:_routes=>c._routes}, c t.extend c.class._helpers t end end;T;+To; ; F; ;,;;;I" Card::Format#method_missing;F;[[I" method;T0[I" *opts;T0[I" &proc;T0;[[@Bi;F;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@=;(I",def method_missing method, *opts, &proc;T;)T;*I"9def method_missing method, *opts, &proc case method when /(_)?(optional_)?render(_(\w+))?/ view = $3 ? $4 : opts.shift args = opts[0] ? opts.shift.clone : {} args.merge!( :optional=>true, :default_visibility=>opts.shift) if $2 args[ :skip_permissions ] = true if $1 render view, args when /^_view_(\w+)/ view = @current_view || $1 unsupported_view view else proc = proc { |*a| raw yield *a } if proc response = root.template.send method, *opts, &proc String===response ? root.template.raw( response ) : response end end;T;+To; ; F; ;,;;;I"Card::Format#render;F;[[I" view;T0[I" args;TI"{};T;[[@Bi;F;: render;;;[;{;IC;" ;T; @B;.0;!F;[;[;I";T;0;'@=;(I"def render view, args={};T;)T;*I"def render view, args={} unless args.delete(:optional) && !show_view?( view, args ) @current_view = view = ok_view canonicalize_view( view ), args args = default_render_args view, args with_inclusion_mode view do Card.with_logging :view, :message=>view, :context=>card.name, :details=>args do Card::ViewCache.fetch(self, view, args) do send "_view_#{ view }", args end end end end rescue => e rescue_view e, view end;T;+To; ; F; ;,;;;I"Card::Format#show_view?;F;[[I" view;T0[I" args;T0;[[@Bi;F;:show_view?;;;[;{;IC;" ;T; @T;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @T;I";T;0;'@=;(I"def show_view? view, args;T;)T;*I"def show_view? view, args default = args.delete(:default_visibility) || :show #FIXME - ugly view_key = canonicalize_view view api_option = args["optional_#{ view_key }".to_sym] case # args remove option when api_option == :always ; true when api_option == :never ; false # wagneer's choice when show_views( args ).member?( view_key ) ; true when hide_views( args ).member?( view_key ) ; false # args override default when api_option == :show ; true when api_option == :hide ; false # default else ; default==:show end end;T;+To; ; F; ;,;;;I"Card::Format#show_views;F;[[I" args;T0;[[@Bi;F;:show_views;;;[;{;IC;" ;T; @j;.0;!F;[;[;I";T;0;'@=;(I"def show_views args;T;)T;*I"@def show_views args parse_view_visibility args[:show] end;T;+To; ; F; ;,;;;I"Card::Format#hide_views;F;[[I" args;T0;[[@Bi;F;:hide_views;;;[;{;IC;" ;T; @y;.0;!F;[;[;I";T;0;'@=;(I"def hide_views args;T;)T;*I"@def hide_views args parse_view_visibility args[:hide] end;T;+To; ; F; ;,;;;I"'Card::Format#parse_view_visibility;F;[[I"val;T0;[[@Bi;F;:parse_view_visibility;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I""def parse_view_visibility val;T;)T;*I"def parse_view_visibility val case val when Array; val when String; val.split(/[\s,]+/) when NilClass; [] else raise Card::Error, "bad show/hide argument: #{val}" end.map{ |view| canonicalize_view view } end;T;+To; ; F; ;,;;;I"%Card::Format#default_render_args;F;[[I" view;T0[I"a;TI"nil;T;[[@Bi;F;:default_render_args;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"(def default_render_args view, a=nil;T;)T;*I"[def default_render_args view, a=nil args = case a when nil ; {} when Hash ; a.clone when Array ; a[0].merge a[1] else ; raise Card::Error, "bad render args: #{a}" end view_key = canonicalize_view view default_method = "default_#{ view }_args" if respond_to? default_method send default_method, args end args end;T;+To; ; F; ;,;;;I"Card::Format#rescue_view;F;[[I"e;T0[I" view;T0;[[@Bi;F;:rescue_view;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def rescue_view e, view;T;)T;*I"ndef rescue_view e, view if Rails.env =~ /^cucumber|test$/ raise e else Rails.logger.info "\nError rendering #{error_cardname} / #{view}: #{e.class} : #{e.message}" Card::Error.current = e card.notable_exception_raised if (debug = Card[:debugger]) && debug.content == 'on' raise e else rendering_error e, view end end end;T;+To; ; F; ;,;;;I" Card::Format#error_cardname;F;[;[[@Bi ;F;:error_cardname;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def error_cardname;T;)T;*I"Udef error_cardname card && card.name.present? ? card.name : 'unknown card' end;T;+To; ; F; ;,;;;I""Card::Format#unsupported_view;F;[[I" view;T0;[[@Bi$;F;:unsupported_view;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def unsupported_view view;T;)T;*I"Ydef unsupported_view view "view (#{view}) not supported for #{error_cardname}" end;T;+To; ; F; ;,;;;I"!Card::Format#rendering_error;F;[[I"exception;T0[I" view;T0;[[@Bi(;F;:rendering_error;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"(def rendering_error exception, view;T;)T;*I"bdef rendering_error exception, view "Error rendering: #{error_cardname} (#{view} view)" end;T;+To; ; F; ;,;;;I"Card::Format#subformat;F;[[I" subcard;T0;[[@Bi0;T;:subformat;;;[;{;IC;"C------------- Sub Format and Inclusion Processing ------------ ;T;[;[;I"E ------------- Sub Format and Inclusion Processing ------------ ;T;0; @;!F;"o;#;$F;%i,;&i.;'@=;(I"def subformat subcard;T;)T;*I"{def subformat subcard subcard = Card.fetch( subcard, :new=>{} ) if String===subcard sub = self.class.new subcard, :parent=>self, :depth=>@depth+1, :root=>@root, # FIXME - the following four should not be hard-coded here. need a generalized mechanism # for attribute inheritance :context_names=>@context_names, :mode=>@mode, :mainline=>@mainline, :form=>@form end;T;+To; ; F; ;,;;;I"!Card::Format#process_content;F;[[I" content;TI"nil;T[I" opts;TI"{};T;[[@Bi9;F;:process_content;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"-def process_content content=nil, opts={};T;)T;*I"^def process_content content=nil, opts={} process_content_object(content, opts).to_s end;T;+To; ; F; ;,;;;I"(Card::Format#process_content_object;F;[[I" content;TI"nil;T[I" opts;TI"{};T;[[@Bi=;F;:process_content_object;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@=;(I"4def process_content_object content=nil, opts={};T;)T;*I"def process_content_object content=nil, opts={} return content unless card content = card.raw_content || '' if content.nil? obj_content = Card::Content===content ? content : Card::Content.new( content, format=self, opts.delete(:content_opts) ) card.update_references( obj_content, refresh=true ) if card.references_expired # I thik we need this generalized obj_content.process_content_object do |chunk_opts| prepare_nest chunk_opts.merge(opts) { yield } end end;T;+To; ; F; ;,;;;I"Card::Format#ok_view;F;[[I" view;T0[I" args;TI"{};T;[[@BiH;F;: ok_view;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def ok_view view, args={};T;)T;*I"Zdef ok_view view, args={} return view if args.delete :skip_permissions approved_view = case when @depth >= Card.config.max_depth # prevent recursion. @depth tracks subformats :too_deep when @@perms[view] == :none # permission skipping specified in view definition view when args.delete(:skip_permissions) # permission skipping specified in args view when !card.known? && !tagged(view, :unknown_ok) # handle unknown cards (where view not exempt) view_for_unknown view, args else # run explicit permission checks permitted_view view, args end args[:denied_view] = view if approved_view != view if focal? && error_code = @@error_codes[ approved_view ] root.error_status = error_code end approved_view end;T;+To; ; F; ;,;;;I"Card::Format#tagged;F;[[I" view;T0[I"tag;T0;[[@Bi^;F;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@=;(I"def tagged view, tag;T;)T;*I";def tagged view, tag self.class.tagged view, tag end;T;+To; ; F; ;,;;;I" Card::Format#permitted_view;F;[[I" view;T0[I" args;T0;[[@Bib;F;:permitted_view;;;[;{;IC;" ;T; @@;.0;!F;[;[;I";T;0;'@=;(I""def permitted_view view, args;T;)T;*I"cdef permitted_view view, args perms_required = @@perms[view] || :read args[:denied_task] = if Proc === perms_required :read if !(perms_required.call self) # read isn't quite right else [perms_required].flatten.find { |task| !ok? task } end if args[:denied_task] @@denial_views[view] || :denial else view end end;T;+To; ; F; ;,;;;I"Card::Format#ok?;F;[[I" task;T0;[[@Bir;F;:ok?;;;[;{;IC;" ;T; @Q;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @Q;I";T;0;'@=;(I"def ok? task;T;)T;*I"def ok? task task = :create if task == :update && card.new_card? @ok ||= {} @ok[task] = card.ok? task if @ok[task].nil? @ok[task] end;T;+To; ; F; ;,;;;I""Card::Format#view_for_unknown;F;[[I" view;T0[I" args;T0;[[@Biy;F;:view_for_unknown;;;[;{;IC;" ;T; @e;.0;!F;[;[;I";T;0;'@=;(I"$def view_for_unknown view, args;T;)T;*I"fdef view_for_unknown view, args # note: overridden in HTML focal? ? :not_found : :missing end;T;+To; ; F; ;,;;;I"#Card::Format#canonicalize_view;F;[[I" view;T0;[[@Bi~;F;:canonicalize_view;;;[;{;IC;" ;T; @v;.0;!F;[;[;I";T;0;'@=;(I"def canonicalize_view view;T;)T;*I"def canonicalize_view view unless view.blank? view_key = view.to_viewname.key.to_sym DEPRECATED_VIEWS[view_key] || view_key end end;T;+To; ; F; ;,;;;I"%Card::Format#with_inclusion_mode;F;[[I" mode;T0;[[@Bi;F;:with_inclusion_mode;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"!def with_inclusion_mode mode;T;)T;*I"def with_inclusion_mode mode if switch_mode = INCLUSION_MODES[ mode ] and @mode != switch_mode old_mode, @mode = @mode, switch_mode @inclusion_defaults = nil end result = yield if old_mode @inclusion_defaults = nil @mode = old_mode end result end;T;+To; ; F; ;,;;;I"Card::Format#prepare_nest;F;[[I" opts;T0;[[@Bi;F;:prepare_nest;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def prepare_nest opts;T;)T;*I"fdef prepare_nest opts @char_count ||= 0 opts ||= {} case when opts.has_key?(:comment) # commented nest opts[:comment] when @mode == :closed && @char_count > Card.config.max_char_count # move on; content out of view '' when opts[:inc_name] == '_main' && show_layout? && @depth==0 # the main card within a layout expand_main opts else # standard nest result = nest fetch_nested_card(opts), opts @char_count += result.length if @mode == :closed && result result end end;T;+To; ; F; ;,;;;I"Card::Format#expand_main;F;[[I" opts;T0;[[@Bi;F;:expand_main;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def expand_main opts;T;)T;*I" def expand_main opts opts.merge! root.main_opts if root.main_opts legacy_main_opts_tweaks! opts #opts[:view] ||= :open with_inclusion_mode :normal do @mainline = true result = wrap_main nest( root.card, opts ) @mainline = false result end end;T;+To; ; F; ;,;;;I"*Card::Format#legacy_main_opts_tweaks!;F;[[I" opts;T0;[[@Bi;F;:legacy_main_opts_tweaks!;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"&def legacy_main_opts_tweaks! opts;T;)T;*I"def legacy_main_opts_tweaks! opts if val=params[:size] and val.present? opts[:size] = val.to_sym end if val=params[:item] and val.present? opts[:items] = (opts[:items] || {}).reverse_merge :view=>val.to_sym end end;T;+To; ; F; ;,;;;I"Card::Format#wrap_main;F;[[I" content;T0;[[@Bi;F;:wrap_main;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def wrap_main content;T;)T;*I"Edef wrap_main content content #no wrapping in base format end;T;+To; ; F; ;,;;;I"Card::Format#nest;F;[[I"nested_card;T0[I" opts;TI"{};T;[[@Bi;F;: nest;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I""def nest nested_card, opts={};T;)T;*I"def nest nested_card, opts={} #ActiveSupport::Notifications.instrument('card', message: "nest: #{nested_card.name}, #{opts}") do opts.delete_if { |k,v| v.nil? } opts.reverse_merge! inclusion_defaults(nested_card) sub = nil if opts[:inc_name] =~ /^_(self)?$/ sub = self else sub = subformat nested_card sub.inclusion_opts = opts[:items] ? opts[:items].clone : {} end view = canonicalize_view opts.delete :view opts[:home_view] = [:closed, :edit].member?(view) ? :open : view # FIXME: special views should be represented in view definitions view = case @mode when :edit not_ready_for_form = @@perms[view]==:none || nested_card.structure || nested_card.key.blank? # eg {{_self|type}} on new cards not_ready_for_form ? :blank : :edit_in_form when :template :template_rule when :closed case when @@closed_views[view] == true || @@error_codes[view] ; view when specified_view = @@closed_views[view] ; specified_view when !nested_card.known? ; :closed_missing else ; :closed_content end else view end sub.optional_render view, opts #end end;T;+To; ; F; ;,;;;I"'Card::Format#get_inclusion_content;F;[[I" cardname;T0;[[@Bi;F;:get_inclusion_content;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"'def get_inclusion_content cardname;T;)T;*I"def get_inclusion_content cardname content = params[cardname.to_s.gsub(/\+/,'_')] # CLEANME This is a hack to get it so plus cards re-populate on failed signups if p = params['subcards'] and card_params = p[cardname.to_s] content = card_params['content'] end content if content.present? # why is this necessary? - efm # probably for blanks? -- older/wiser efm end;T;+To; ; F; ;,;;;I"#Card::Format#fetch_nested_card;F;[[I" options;T0;[[@Bi;F;:fetch_nested_card;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I""def fetch_nested_card options;T;)T;*I"edef fetch_nested_card options args = { :name=>options[:inc_name], :type=>options[:type], :supercard=>card } args.delete(:supercard) if options[:inc_name].strip.blank? # special case. gets absolutized incorrectly. fix in smartname? if options[:inc_name] =~ /^_main\+/ # FIXME this is a rather hacky (and untested) way to get @superleft to work on new cards named _main+whatever args[:name] = args[:name].gsub /^_main\+/, '+' args[:supercard] = root.card end if content=get_inclusion_content(options[:inc_name]) args[:content]=content end Card.fetch options[:inc_name], :new=>args end;T;+To; ; F; ;,;;;I"#Card::Format#default_item_view;F;[;[[@Bi;F;:default_item_view;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I"def default_item_view;T;)T;*I"&def default_item_view :name end;T;+To; ; F; ;,;;;I"Card::Format#add_class;F;[[I" options;T0[I" klass;T0;[[@Bi;T;:add_class;;;[;{;IC;"'------------ LINKS --------------- ;T;[;[;I") ------------ LINKS --------------- ;T;0; @ ;!F;"o;#;$F;%i;&i;'@=;(I"!def add_class options, klass;T;)T;*I"jdef add_class options, klass options[:class] = [ options[:class], klass ].flatten.compact * ' ' end;T;+To;;IC;[o; ; F; ;,;;;I"%Card::Format::Location#page_path;F;[[I" title;T0[I" opts;TI"{};T;[[@Bi;T;:page_path;;;[;{;IC;" TESTME ;T;[;[;I" TESTME;T;0; @!;!F;"o;#;$F;%i;&i;'@;(I"!def page_path title, opts={};T;)T;*I"def page_path title, opts={} Rails.logger.warn "Pass only Card::Name to page_path #{title.class}, #{title}" unless Card::Name===title format = opts[:format] ? ".#{opts.delete(:format)}" : '' action = opts[:action] ? "#{opts.delete(:action)}/" : '' query = opts.present? ? "?#{opts.to_param}" : '' card_path "#{action}#{title.to_name.url_key}#{format}#{query}" end;T;+To; ; F; ;,;;;I"%Card::Format::Location#card_path;F;[[I" rel_path;T0;[[@Bi;F;:card_path;;;[;{;IC;" ;T; @4;.0;!F;[;[;I";T;0;'@;(I"def card_path rel_path;T;)T;*I"def card_path rel_path Rails.logger.warn "Pass only strings to card_path: #{rel_path.class}, #{rel_path}" unless String===rel_path if rel_path =~ /^\// rel_path else "#{ Wagn.config.relative_url_root }/#{ rel_path }" end end;T;+To; ; F; ;,;;;I"$Card::Format::Location#card_url;F;[[I"rel;T0;[[@Bi$;F;: card_url;;;[;{;IC;" ;T; @C;.0;!F;[;[;I";T;0;'@;(I"def card_url rel;T;)T;*I"def card_url rel if rel =~ /^https?\:/ rel else "#{ Card::Env[:protocol] }#{ Card::Env[:host] }#{ card_path rel }" end end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@Bi ;F;: Location;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;I"Card::Format::Location;F;+To; ; F; ;,;;;I"Card::Format#unique_id;F;[;[[@Bi/;F;:unique_id;;;[;{;IC;" ;T; @b;.0;!F;[;[;I";T;0;'@=;(I"def unique_id;T;)T;*I"Bdef unique_id "#{card.key}-#{Time.now.to_i}-#{rand(3)}" end;T;+To; ; F; ;,;;;I"Card::Format#format_date;F;[[I" date;T0[I"include_time;TI" true;T;[[@Bi3;F;:format_date;;;[;{;IC;" ;T; @o;.0;!F;[;[;I";T;0;'@=;(I".def format_date date, include_time = true;T;)T;*I"Qdef format_date date, include_time = true # Must use DateTime because Time doesn't support %e on at least some platforms if include_time DateTime.new(date.year, date.mon, date.day, date.hour, date.min, date.sec).strftime("%B %e, %Y %H:%M:%S") else DateTime.new(date.year, date.mon, date.day).strftime("%B %e, %Y") end end;T;+To; ; F; ;,;;;I""Card::Format#add_name_context;F;[[I" name;TI"nil;T;[[@Bi<;F;:add_name_context;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@=;(I""def add_name_context name=nil;T;)T;*I"~def add_name_context name=nil name ||= card.name @context_names += name.to_name.part_names @context_names.uniq! end;T;+T;9@=;:IC;[;9@=;;IC;[o;C ;D0;E0;F0;;;'@=;H@;O: module;9@=;T;,IC;={ ;IC;={;@Z;0;>T;IC;={;@g;0;>T;sIC;={;@t;0;>T;IC;={;@;0;>T;IC;={;@;@;>T;IC;={;@;@;>T;IC;={;@;@;>T;>T;>T;?{;@[;[[@Bi ;F;;;;;;;[;{;IC;" ;T; @=;.0;!F;[;[;I";T;0;'@;I"Card::Format;F;Bo;C ;D0;E0;F0;;G;'@;H@;O; ;+To; ; F; ; ;;;I"Card.config;F;[;[[I"lib/card/loader.rb;Ti ;F;: config;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def config;T;)T;*I"#def config Cardio.config end;T;+To; ; F; ; ;;;I"Card.paths;F;[;[[@i;F;: paths;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def paths;T;)T;*I"!def paths Cardio.paths end;T;+To;;IC;[o; ; F; ; ;;;I"Card::Loader.load_mods;F;[;[[@i;F;:load_mods;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def load_mods;T;)T;*I"def load_mods load_set_patterns load_formats load_sets if Wagn.config.performance_logger Card::Log::Performance.load_config Wagn.config.performance_logger end end;T;+To; ; F; ; ;;;I"Card::Loader.load_chunks;F;[;[[@i#;F;:load_chunks;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def load_chunks;T;)T;*I"Xdef load_chunks mod_dirs.each do |mod| load_dir "#{mod}/chunk/*.rb" end end;T;+To; ; F; ; ;;;I"Card::Loader.load_layouts;F;[;[[@i);F;:load_layouts;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def load_layouts;T;)T;*I"6def load_layouts mod_dirs.inject({}) do |hash, mod| dirname = "#{mod}/layout" if File.exists? dirname Dir.foreach( dirname ) do |filename| next if filename =~ /^\./ hash[ filename.gsub /\.html$/, '' ] = File.read( [dirname, filename] * '/' ) end end hash end end;T;+To; ; F; ; ;;;I"Card::Loader.mod_dirs;F;[;[[@i6;F;: mod_dirs;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def mod_dirs;T;)T;*I"def mod_dirs @@mod_dirs ||= begin if Card.paths['local-mod'] Card.paths['mod'] << Card.paths['local-mod'] Rails.logger.warn 'DEPRECATION WARNING: Append to paths[\'mod\'] vs. local-mod for configuring location of local (deck) modules.' end Card.paths['mod'].existent.map do |dirname| Dir.entries( dirname ).sort.map do |filename| "#{dirname}/#{filename}" if filename !~ /^\./ end.compact end.flatten.compact end end;T;+To; ; F; ; ;;b;I"#Card::Loader.load_set_patterns;F;[;[[@iG;F;:load_set_patterns;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def load_set_patterns;T;)T;*I"def load_set_patterns if rewrite_tmp_files? load_set_patterns_from_source end load_dir "#{Card.paths['tmp/set_pattern'].first}/*.rb" end;T;+To; ; F; ; ;;b;I"/Card::Loader.load_set_patterns_from_source;F;[;[[@iN;F;:"load_set_patterns_from_source;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"&def load_set_patterns_from_source;T;)T;*I"def load_set_patterns_from_source prepare_tmp_dir 'tmp/set_pattern' seq = 100 mod_dirs.each do |mod| dirname = "#{mod}/set_pattern" if Dir.exists? dirname Dir.entries( dirname ).sort.each do |filename| if m = filename.match( /^(\d+_)?([^\.]*).rb/) and key = m[2] filename = [ dirname, filename ] * '/' SetPattern.write_tmp_file key, filename, seq seq = seq + 1 end end end end end;T;+To; ; F; ; ;;b;I"Card::Loader.load_formats;F;[;[[@i_;F;:load_formats;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def load_formats;T;)T;*I"def load_formats #cheating on load issues now by putting all inherited-from formats in core mod. mod_dirs.each do |mod| load_dir "#{mod}/format/*.rb" end end;T;+To; ; F; ; ;;b;I"Card::Loader.load_sets;F;[;[[@if;F;:load_sets;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@;(I"def load_sets;T;)T;*I"~def load_sets prepare_tmp_dir 'tmp/set' load_sets_by_pattern Set.process_base_modules Set.clean_empty_modules end;T;+To; ; F; ; ;;b;I"&Card::Loader.load_sets_by_pattern;F;[;[[@in;F;:load_sets_by_pattern;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;(I"def load_sets_by_pattern;T;)T;*I"xdef load_sets_by_pattern Card.set_patterns.reverse.map(&:pattern_code).each do |set_pattern| pattern_tmp_dir = "#{Card.paths['tmp/set'].first}/#{set_pattern}" if rewrite_tmp_files? Dir.mkdir pattern_tmp_dir load_implicit_sets_from_source set_pattern end if Dir.exists? pattern_tmp_dir load_dir "#{pattern_tmp_dir}/**/*.rb" end end end;T;+To; ; F; ; ;;b;I"0Card::Loader.load_implicit_sets_from_source;F;[[I"set_pattern;T0;[[@i{;F;:#load_implicit_sets_from_source;;;[;{;IC;" ;T; @<;.0;!F;[;[;I";T;0;'@;(I"3def load_implicit_sets_from_source set_pattern;T;)T;*I"def load_implicit_sets_from_source set_pattern seq = 1000 mod_dirs.each do |mod_dir| dirname = [mod_dir, 'set', set_pattern] * '/' next unless File.exists?( dirname ) old_pwd = Dir.pwd Dir.chdir dirname Dir.glob( "**/*.rb" ).sort.each do |anchor_path| path_parts = anchor_path.gsub(/\.rb/,'').split(File::SEPARATOR) filename = File.join dirname, anchor_path Set.write_tmp_file set_pattern, path_parts, filename, seq seq = seq + 1 end Dir.chdir old_pwd end end;T;+To; ; F; ; ;;b;I"!Card::Loader.prepare_tmp_dir;F;[[I" path;T0;[[@i;F;:prepare_tmp_dir;;;[;{;IC;" ;T; @K;.0;!F;[;[;I";T;0;'@;(I"def prepare_tmp_dir path;T;)T;*I"def prepare_tmp_dir path if rewrite_tmp_files? p = Card.paths[ path ] if p.existent.first FileUtils.rm_rf p.first, :secure=>true end Dir.mkdir p.first end end;T;+To; ; F; ; ;;b;I"$Card::Loader.rewrite_tmp_files?;F;[;[[@i;F;:rewrite_tmp_files?;;;[;{;IC;" ;T; @Z;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @Z;I";T;0;'@;(I"def rewrite_tmp_files?;T;)T;*I"def rewrite_tmp_files? if defined?( @@rewrite ) @@rewrite else @@rewrite = !( Rails.env.production? and Card.paths['tmp/set'].existent.first ) end end;T;+To; ; F; ; ;;b;I"Card::Loader.load_dir;F;[[I"dir;T0;[[@i;F;: load_dir;;;[;{;IC;" ;T; @l;.0;!F;[;[;I";T;0;'@;(I"def load_dir dir;T;)T;*I"def load_dir dir Dir[dir].sort.each do |file| # puts Benchmark.measure("from #load_dir: rd: #{file}") { require_dependency file # }.format("%n: %t %r") end end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i;F;: Loader;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Loader;F;+To; ;IC;[o;V;[[I"lib/card/mailer.rb;Ti ;F;:@@defaults;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Mailer::@@defaults;F;(I"2@@defaults = Card.config.email_defaults || {};T;*I"2@@defaults = Card.config.email_defaults || {};T;6I"%Card.config.email_defaults || {};T;+To; ; F; ; ;;;I"Card::Mailer.new_mail;F;[[I" *args;T0[I" &block;T0;[[@i;F;: new_mail;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I" def new_mail(*args, &block);T;)T;*I"8def new_mail(*args, &block) mail = Mail.new(args, &block) method = Card::Mailer.delivery_method mail.delivery_method(method, Card::Mailer.send(:"#{method}_settings")) mail.perform_deliveries = Card::Mailer.perform_deliveries mail.raise_delivery_errors = Card::Mailer.raise_delivery_errors mail end;T;+To; ; F; ; ;;;I"Card::Mailer.layout;F;[[I" message;T0;[[@i;F;: layout;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def layout message;T;)T;*I"}def layout message %{ #{message} } end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i ;F;: Mailer;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Mailer;F;Bo;C ;D0;EI"ActionMailer::Base;T;F@;: Base;'o;C ;D0;E0;F0;:ActionMailer;'@;H0;O0;H0;O; ;+To; ;IC;[o; ; F; ;,;;;I"Card::Content#revision;F;[;[[I"lib/card/content.rb;Ti ;F;: revision;;;[;{;IC;",Returns the value of attribute revision ;T; @;.0;!F;[;[;I",Returns the value of attribute revision;T;0;'@;(I"def revision;T;*I"!def revision @revision end;T;+To; ; F; ;,;;;I"Card::Content#format;F;[;[[@i ;F;;;;;[;{;IC;"*Returns the value of attribute format ;T; @;.0;!F;[;[;I"*Returns the value of attribute format;T;0;'@;(I"def format;T;*I"def format @format end;T;+To; ; F; ;,;;;I"Card::Content#chunks;F;[;[[@i ;F;: chunks;;;[;{;IC;"*Returns the value of attribute chunks ;T; @;.0;!F;[;[;I"*Returns the value of attribute chunks;T;0;'@;(I"def chunks;T;*I"def chunks @chunks end;T;+To; ; F; ;,;;;I"Card::Content#opts;F;[;[[@i ;F;: opts;;;[;{;IC;"(Returns the value of attribute opts ;T; @;.0;!F;[;[;I"(Returns the value of attribute opts;T;0;'@;(I" def opts;T;*I"def opts @opts end;T;+To; ; F; ;,;;;I"Card::Content#initialize;F;[[I" content;T0[I"format_or_card;T0[I" opts;TI"{};T;[[@i;F;;|;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of Content;T;0;3[I" Content;F; @;I";T;0;'@;(I"4def initialize content, format_or_card, opts={};T;)T;*I"def initialize content, format_or_card, opts={} @format = if Card===format_or_card Format.new format_or_card, :format=>nil else format_or_card end @opts = opts || {} unless Array === content content = parse_content content end super content end;T;+To; ; F; ;,;;;I"Card::Content#card;F;[;[[@i;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I" def card;T;)T;*I"def card format.card end;T;+To; ; F; ;,;;;I"Card::Content#chunk_list;F;[;[[@i!;F;:chunk_list;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@;(I"def chunk_list;T;)T;*I"Bdef chunk_list @opts[:chunk_list] || @format.chunk_list end;T;+To; ; F; ;,;;;I"Card::Content#to_s;F;[;[[@i%;F;;%;;;[;{;IC;" ;T; @8;.0;!F;[;[;I";T;0;'@;(I" def to_s;T;)T;*I"def to_s case __getobj__ when Array; map(&:to_s)*'' when String; __getobj__ when NilClass; '' #raise "Nil Card::Content" else __getobj__.to_s end end;T;+To; ; F; ;,;;;I"Card::Content#inspect;F;[;[[@i.;F;;;;;[;{;IC;" ;T; @E;.0;!F;[;[;I";T;0;'@;(I"def inspect;T;)T;*I">def inspect "<#{__getobj__.class}:#{card}:#{self}>" end;T;+To; ; F; ;,;;;I"Card::Content#each_chunk;F;[;[[@i2;F;:each_chunk;;;[;{;IC;" ;T; @R;.0;!F;[;[;I";T;0;'@;(I"def each_chunk;T;)T;*I"def each_chunk return enum_for(:each_chunk) unless block_given? case __getobj__ when Hash; each { |k,v| yield v if Chunk::Abstract===v } when Array; each { |e| yield e if Chunk::Abstract===e } when String; # strings are all parsed in self, so no chunks in a String else Rails.logger.warn "error self is unrecognized type #{self.class} #{self.__getobj__.class}" end end;T;+To; ; F; ;,;;;I"Card::Content#find_chunks;F;[[I"chunk_type;T0;[[@i=;F;:find_chunks;;;[;{;IC;" ;T; @_;.0;!F;[;[;I";T;0;'@;(I"def find_chunks chunk_type;T;)T;*I"^def find_chunks chunk_type each_chunk.select { |chunk| chunk.kind_of?(chunk_type) } end;T;+To; ; F; ;,;;;I")Card::Content#process_content_object;F;[[I" &block;T0;[[@iA;F;;;;;[;{;IC;" ;T; @n;.0;!F;[;[;I";T;0;'@;(I"&def process_content_object &block;T;)T;*I"edef process_content_object &block each_chunk { |chunk| chunk.process_chunk &block } self end;T;+To; ; F; ;,;;;I" Card::Content#parse_content;F;[[I" content;T0;[[@iF;F;:parse_content;;;[;{;IC;" ;T; @};.0;!F;[;[;I";T;0;'@;(I"def parse_content content;T;)T;*I" def parse_content content @chunks = [] if String===content position = last_position = 0 prefix_regexp = Chunk.get_prefix_regexp chunk_list interval_string = '' while prefix_match = content[position..-1].match( prefix_regexp ) prefix = prefix_match[0] # prefix of matched chunk chunk_start = prefix_match.begin(0) + position # content index of beginning of chunk if prefix_match.begin(0) > 0 # if matched chunk is not beginning of test string interval_string += content[ position..chunk_start-1 ] # hold onto the non-chunk part of the string end chunk_class = Chunk.find_class_by_prefix prefix # get the chunk class from the prefix match, offset = chunk_class.full_match content[chunk_start..-1], prefix # see whether the full chunk actually matches (as opposed to bogus prefix) context_ok = chunk_class.context_ok? content, chunk_start # make sure there aren't contextual reasons for ignoring this chunk position = chunk_start # move scanning position up to beginning of chunk if match # we have a chunk match position += ( match.end(0) - offset.to_i ) # move scanning position up to end of chunk if context_ok # @chunks << interval_string if interval_string.size > 0 # add the nonchunk string to the chunk list @chunks << chunk_class.new( match, self ) # add the chunk to the chunk list interval_string = '' # reset interval string for next go-round last_position = position # note that the end of the chunk was the last place where a chunk was found (so far) end else position += 1 # no match. look at the next character end if !match || !context_ok interval_string += content[chunk_start..position-1] # moving beyond the alleged chunk. append failed string to "nonchunk" string end end end if chunks.any? if last_position < content.size remainder = content[ last_position..-1] # handle any leftover nonchunk string at the end of content @chunks << remainder end chunks else content end end;T;+To;4;[[@i{;F;:ALLOWED_TAGS;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I" Card::Content::ALLOWED_TAGS;F;(I"ALLOWED_TAGS = {};T;*I"ALLOWED_TAGS = {};T;6I"{};T;+To;4;[[@i;F;:ATTR_VALUE_RE;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"!Card::Content::ATTR_VALUE_RE;F;(I"HATTR_VALUE_RE = [ /(?<=^')[^']+(?=')/, /(?<=^")[^"]+(?=")/, /\S+/ ];T;*I"HATTR_VALUE_RE = [ /(?<=^')[^']+(?=')/, /(?<=^")[^"]+(?=")/, /\S+/ ];T;6I"8[ /(?<=^')[^']+(?=')/, /(?<=^")[^"]+(?=")/, /\S+/ ];T;+To; ; F; ; ;;;I"Card::Content.clean!;F;[[I" string;T0[I" tags;TI"ALLOWED_TAGS;T;[[@i;T;: clean!;;;[;{;IC;"Qthis has been hacked for card to allow classes if the class begins with "w-" ;T;[;[;I"Qthis has been hacked for card to allow classes if the class begins with "w-";T;0; @;!F;"o;#;$F;%i;&i;'@;(I".def clean!( string, tags = ALLOWED_TAGS );T;)T;*I"Gdef clean!( string, tags = ALLOWED_TAGS ) string.gsub( /<(\/*)(\w+)([^>]*)>/ ) do raw = $~ tag = raw[2].downcase if attrs = tags[tag] "<#{raw[1]}#{ attrs.inject([tag]) do |pcs, attr| q='"' rest_value=nil if raw[3] =~ /\b#{attr}\s*=\s*(?=(.))/i rest_value = $' idx = %w{' "}.index($1) and q = $1 re = ATTR_VALUE_RE[ idx || 2 ] if match = rest_value.match(re) rest_value = match[0] if attr == 'class' rest_value = rest_value.split(/\s+/).find_all {|s| s=~/^w-/i}*' ' end end end pcs << "#{attr}=#{q}#{rest_value}#{q}" unless rest_value.blank? pcs end * ' ' }>" else " " end end.gsub(/<\!--.*?-->/, '') end;T;+To; ; F; ;,;;;I")Card::Content#clean_with_space_last!;F;[[I" string;T0[I" tags;TI"ALLOWED_TAGS;T;[[@i;F;:clean_with_space_last!;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I";def clean_with_space_last! string, tags = ALLOWED_TAGS;T;)T;*I"def clean_with_space_last! string, tags = ALLOWED_TAGS clean_without_space_last!(string, tags).gsub(/(?:^|\b) ((?: )+)/, '\1 ') end;T;+To; ; F; ; ;;;I"2Card::Content.truncatewords_with_closing_tags;F;[[I" input;T0[I" words;TI"25;T[I"truncate_string;TI" "...";T;[[@i;F;:$truncatewords_with_closing_tags;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"Tdef truncatewords_with_closing_tags(input, words = 25, truncate_string = "...");T;)T;*I"def truncatewords_with_closing_tags(input, words = 25, truncate_string = "...") if input.nil? then return end wordlist = input.to_s.split l = words.to_i - 1 l = 0 if l < 0 wordstring = wordlist.length > l ? wordlist[0..l].join(" ") : input.to_s # nuke partial tags at end of snippet wordstring.gsub!(/(<[^\>]+)$/,'') tags = [] # match tags with or without self closing (ie. ) wordstring.scan(/\<([^\>\s\/]+)[^\>]*?\>/).each { |t| tags.unshift(t[0]) } # match tags with self closing and mark them as closed wordstring.scan(/\<([^\>\s\/]+)[^\>]*?\/\>/).each { |t| if !(x=tags.index(t[0])).nil? then tags.slice!(x) end } # match close tags wordstring.scan(/\<\/([^\>\s\/]+)[^\>]*?\>/).each { |t| if !(x=tags.rindex(t[0])).nil? then tags.slice!(x) end } tags.each {|t| wordstring += "" } wordstring +='...' if wordlist.length > l # wordstring += '...' if wordlist.length > l wordstring.gsub! /<[\/]?br[\s\/]*>/, ' ' ## Also a hack -- get rid of
    's -- they make line view ugly. wordstring.gsub! /<[\/]?p[^>]*>/, ' ' ## Also a hack -- get rid of
    's -- they make line view ugly. wordstring end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={ ;IC;={;@;0;>T;IC;={;@;0;>T;IC;={;@;0;>T;IC;={;@;0;>T;>T;>T;?{;@[;[[@i ;F;: Content;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Content;F;Bo;C ;D0;E0;F0;:SimpleDelegator;'@;H0;O; ;+To;;IC;[o; ; F; ; ;;;I"Card::Version.release;F;[;[[I"lib/card/version.rb;Ti ;F;: release;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def release;T;)T;*I"edef release @@version ||= File.read( File.expand_path '../../../VERSION', __FILE__ ).strip end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i;F;: Version;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'o;C ;D0;E0;F0;;;'@;H@;O0;I"Card::Version;Fo; ;IC;[ o;V;[[I"lib/card/codename.rb;Ti ;F;:@@codehash;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Codename::@@codehash;F;(I"@@codehash=nil;T;*I"@@codehash=nil;T;6I"nil;T;+To; ; F; ; ;;;I"Card::Codename.[];F;[[I"key;T0;[[@i;T;;;;;[;{;IC;"Mreturns codename for id and vice versa. not in love with this api --efm ;T;[;[;I"Mreturns codename for id and vice versa. not in love with this api --efm;T;0; @&;!F;"o;#;$F;%i;&i;'@;(I"def [] key;T;)T;*I"ddef [] key if !key.nil? key = key.to_sym unless Integer===key codehash[key] end end;T;+To; ; F; ; ;;;I"Card::Codename.codehash;F;[;[[@i;F;: codehash;;;[;{;IC;" ;T; @6;.0;!F;[;[;I";T;0;'@;(I"def codehash;T;)T;*I"/def codehash @@codehash || load_hash end;T;+To; ; F; ; ;;;I"Card::Codename.reset_cache;F;[;[[@i;F;:reset_cache;;;[;{;IC;" ;T; @C;.0;!F;[;[;I";T;0;'@;(I"def reset_cache;T;)T;*I"Idef reset_cache @@codehash = nil cache.write 'CODEHASH', nil end;T;+To; ; F; ; ;;;I"Card::Codename.bootdata;F;[[I" hash;T0;[[@i";T;: bootdata;;;[;{;IC;"only used in migration ;T;[;[;I"only used in migration;T;0; @P;!F;"o;#;$F;%i!;&i!;'@;(I"def bootdata hash;T;)T;*I".def bootdata hash @@codehash = hash end;T;+To; ; F; ; ;;b;I"Card::Codename.cache;F;[;[[@i);F;: cache;;;[;{;IC;" ;T; @`;.0;!F;[;[;I";T;0;'@;(I"def cache;T;)T;*I"*def cache Card::Cache[Codename] end;T;+To; ; F; ; ;;b;I"Card::Codename.load_hash;F;[;[[@i-;F;:load_hash;;;[;{;IC;" ;T; @m;.0;!F;[;[;I";T;0;'@;(I"def load_hash;T;)T;*I"Ndef load_hash @@codehash = cache.read('CODEHASH') || begin codehash = {} sql = 'select id, codename from cards where codename is not NULL' ActiveRecord::Base.connection.select_all(sql).each do |row| #FIXME: remove duplicate checks, put them in other tools code, cid = row['codename'].to_sym, row['id'].to_i if codehash.has_key?(code) or codehash.has_key?(cid) warn "dup code ID:#{cid} (#{codehash[code]}), CD:#{code} (#{codehash[cid]})" end codehash[code] = cid; codehash[cid] = code end cache.write 'CODEHASH', codehash end end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i ;F;: Codename;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::Codename;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0;+To; ; F; ; ;;;I"Card.const_missing;F;[[I" const;T0;[[@iA;F;:const_missing;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"!def self.const_missing const;T;)T;*I"def self.const_missing const if const.to_s =~ /^([A-Z]\S*)ID$/ and code=$1.underscore.to_sym if card_id = Codename[code] const_set const, card_id else raise "Missing codename #{code} (#{const})" end else super end end;T;+To; ;IC;[ o;V;[[I"lib/card/view_name.rb;Ti ;F;:@@name2viewnameobject;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"*Card::ViewName::@@name2viewnameobject;F;(I"@@name2viewnameobject = {};T;*I"@@name2viewnameobject = {};T;6I"{};T;+To; ; F; ; ;;;I"Card::ViewName.new;F;[[I"obj;T0;[[@i;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def new obj;T;)T;*I"def new obj return obj if self.class===obj str = Array===obj ? obj*joint : obj.to_s if known_name = @@name2viewnameobject[str] known_name else super str.strip end end;T;+To; ; F; ;,;;;I"Card::ViewName#initialize;F;[[I"str;T0;[[@i;F;;|;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of ViewName;T;0;3[I" ViewName;F; @;I";T;0;'@;(I"def initialize str;T;)T;*I"def initialize str @s = str.to_s.strip @s = @s.encode('UTF-8') if RUBYENCODING @key = if @s.index(self.class.joint) @parts = @s.split(/\s*#{JOINT_RE}\s*/) @parts << '' if @s[-1,1] == self.class.joint @simple = false @parts.map { |p| p.to_name.key } * self.class.joint else @parts = [str] @simple = true str.empty? ? '' : simple_key end @@name2viewnameobject[str] = self end;T;+To; ; F; ;,;;;I"Card::ViewName#simple_key;F;[;[[@i+;F;:simple_key;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def simple_key;T;)T;*I"jdef simple_key decoded.underscore.gsub(/[^#{OK4KEY_RE}]+/,'_').split(/_+/).reject(&:empty?)*'_' end;T;+To; ; F; ;,;;;I"Card::ViewName#to_viewname;F;[;[[@i/;F;;M;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def to_viewname() self end;T;)T;*I"def to_viewname() self end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i ;F;: ViewName;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;I"Card::ViewName;F;Bo;C ;D0;E0;F0;;;'@;H0;O; ;+To; ;IC;[o; ; F; ; ;;;I"Card::Migration.type;F;[;[[I"lib/card/migration.rb;Ti;T;;D;;;[;{;IC;"Rake tasks use class methods, migrations use instance methods. To avoid repetition a lot of instance methods here just call class methods. The subclass Card::CoreMigration needs a different @type so we can't use a class variable @@type. It has to be a class instance variable. Migrations are subclasses of Card::Migration or Card::CoreMigration but they don't inherit the @type. The method below solves this problem. ;T;[;[;I"Rake tasks use class methods, migrations use instance methods. To avoid repetition a lot of instance methods here just call class methods. The subclass Card::CoreMigration needs a different @type so we can't use a class variable @@type. It has to be a class instance variable. Migrations are subclasses of Card::Migration or Card::CoreMigration but they don't inherit the @type. The method below solves this problem.;T;0; @;!F;"o;#;$F;%i ;&i;'@;(I" def type;T;)T;*I"@def type @type || (ancestors[1] && ancestors[1].type) end;T;+To; ; F; ; ;;;I"%Card::Migration.find_unused_name;F;[[I"base_name;T0;[[@i;F;:find_unused_name;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;(I"#def find_unused_name base_name;T;)T;*I"def find_unused_name base_name test_name = base_name add = 1 while Card.exists?(test_name) do test_name = "#{base_name}#{add}" add +=1 end test_name end;T;+To; ; F; ; ;;;I"$Card::Migration.migration_paths;F;[[I" mig_type;TI" type;T;[[@i!;F;:migration_paths;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"&def migration_paths mig_type=type;T;)T;*I"Ldef migration_paths mig_type=type Cardio.migration_paths mig_type end;T;+To; ; F; ; ;;;I"Card::Migration.schema;F;[[I" mig_type;TI" type;T;[[@i%;F;: schema;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@;(I"def schema mig_type=type;T;)T;*I":def schema mig_type=type Cardio.schema mig_type end;T;+To; ; F; ; ;;;I""Card::Migration.schema_suffix;F;[[I" mig_type;TI" type;T;[[@i);F;:schema_suffix;;;[;{;IC;" ;T; @8;.0;!F;[;[;I";T;0;'@;(I"$def schema_suffix mig_type=type;T;)T;*I"Hdef schema_suffix mig_type=type Cardio.schema_suffix mig_type end;T;+To; ; F; ; ;;;I" Card::Migration.schema_mode;F;[[I" mig_type;TI" type;T;[[@i-;F;:schema_mode;;;[;{;IC;" ;T; @H;.0;!F;[;[;I";T;0;'@;(I""def schema_mode mig_type=type;T;)T;*I"Xdef schema_mode mig_type=type new_suffix = schema_suffix mig_type original_suffix = ActiveRecord::Base.table_name_suffix ActiveRecord::Base.table_name_suffix = new_suffix ActiveRecord::SchemaMigration.reset_table_name yield ActiveRecord::Base.table_name_suffix = original_suffix ActiveRecord::SchemaMigration.reset_table_name end;T;+To; ; F; ; ;;;I"1Card::Migration.assume_migrated_upto_version;F;[;[[@i8;F;:!assume_migrated_upto_version;;;[;{;IC;" ;T; @X;.0;!F;[;[;I";T;0;'@;(I"%def assume_migrated_upto_version;T;)T;*I"def assume_migrated_upto_version schema_mode do ActiveRecord::Schema.assume_migrated_upto_version schema, migration_paths end end;T;+To; ; F; ; ;;;I"Card::Migration.data_path;F;[[I" filename;TI"nil;T;[[@i>;F;:data_path;;;[;{;IC;" ;T; @e;.0;!F;[;[;I";T;0;'@;(I"def data_path filename=nil;T;)T;*I"def data_path filename=nil path = migration_paths.first File.join( [ migration_paths.first, 'data', filename ].compact ) end;T;+To; ; F; ;,;;;I" Card::Migration#contentedly;F;[[I" &block;T0;[[@iE;F;:contentedly;;;[;{;IC;" ;T; @u;.0;!F;[;[;I";T;0;'@;(I"def contentedly &block;T;)T;*I"def contentedly &block Card::Cache.reset_global Cardio.schema_mode '' do Card::Auth.as_bot do ActiveRecord::Base.transaction do begin yield ensure Card::Cache.reset_global end end end end end;T;+To; ; F; ;,;;;I" Card::Migration#import_json;F;[[I" filename;T0[I"merge_opts;TI"{};T;[[@iT;F;:import_json;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I",def import_json filename, merge_opts={};T;)T;*I"def import_json filename, merge_opts={} Card.config.action_mailer.perform_deliveries = false merge_opts.reverse_merge! :output_file=>File.join(data_path,"unmerged_#{ filename }") Card.merge_list read_json(filename), merge_opts end;T;+To; ; F; ;,;;;I"Card::Migration#read_json;F;[[I" filename;T0;[[@iZ;F;:read_json;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def read_json filename;T;)T;*I"|def read_json filename raw_json = File.read( data_path filename ) json = JSON.parse raw_json json["card"]["value"] end;T;+To; ; F; ;,;;;I"Card::Migration#data_path;F;[[I" filename;TI"nil;T;[[@i`;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def data_path filename=nil;T;)T;*I"Cdef data_path filename=nil self.class.data_path filename end;T;+To; ; F; ;,;;;I" Card::Migration#schema_mode;F;[;[[@id;F;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def schema_mode;T;)T;*I"=def schema_mode Cardio.schema_mode self.class.type end;T;+To; ; F; ;,;;;I"$Card::Migration#migration_paths;F;[;[[@ih;F;; ;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'@;(I"def migration_paths;T;)T;*I";def migration_paths Cardio.paths self.class.type end;T;+To; ; F; ;,;;;I"#Card::Migration#exec_migration;F;[[I" conn;T0[I"direction;T0;[[@in;T;:exec_migration;;;[;{;IC;"jExecute this migration in the named direction copied from ActiveRecord to wrap "up" in "contentendly" ;T;[;[;I"jExecute this migration in the named direction copied from ActiveRecord to wrap "up" in "contentendly";T;0; @;!F;"o;#;$F;%il;&im;'@;(I"(def exec_migration(conn, direction);T;)T;*I"def exec_migration(conn, direction) @connection = conn if respond_to?(:change) if direction == :down revert { change } else change end else contentedly { send(direction) } end ensure @connection = nil end;T;+To; ; F; ;,;;;I"Card::Migration#down;F;[;[[@i~;F;: down;;;[;{;IC;" ;T; @;.0;!F;[;[o;0 ;1I" raise;F;2I";T;0;3[I"(ActiveRecord::IrreversibleMigration;T; @;I";T;0;'@;(I" def down;T;)T;*I"=def down raise ActiveRecord::IrreversibleMigration end;T;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;>T;>T;?{;@[;[[@i;F;:Migration;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'o;C ;D0;E0;F0;;;'@;H@;O0;I"Card::Migration;F;Bo;C ;D0;EI"ActiveRecord::Migration;T;F@;;;'o;C ;D0;E0;F0;:ActiveRecord;'@;Ho;;IC;[o;;IC;[ o; ;IC;[o; ; F; ;,;;;I"T;,IC;={;>T;>T;?{;@[;[[@ i ;F;:AbstractAdapter;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"6ActiveRecord::ConnectionAdapters::AbstractAdapter;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0;+To; ;IC;[o; ; F; ;,;;;I">ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#match;F;[[I" string;T0;[[@ i;F;;[;;;[;{;IC;" ;T; @J ;.0;!F;[;[;I";T;0;'@H ;(I"def match(string);T;)T;*I"+def match(string) "~* #{string}" end;T;+T;9@H ;:IC;[;9@H ;;IC;[;9@H ;T;,IC;={;>T;>T;?{;@[;[[@ i;F;:PostgreSQLAdapter;;;;;[;{;IC;" ;T; @H ;.0;!F;[;[;I";T;0;'@ ;I"8ActiveRecord::ConnectionAdapters::PostgreSQLAdapter;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0;+To;;IC;[o; ; F; ;,;;;I"8ActiveRecord::ConnectionAdapters::MysqlCommon#match;F;[[I" string;T0;[[@ i;F;;[;;;[;{;IC;" ;T; @l ;.0;!F;[;[;I";T;0;'@j ;(I"def match(string);T;)T;*I"/def match(string) "REGEXP #{string}" end;T;+To; ; F; ;,;;;I"DActiveRecord::ConnectionAdapters::MysqlCommon#custom_cast_types;F;[;[[@ i#;F;;;;;[;{;IC;" ;T; @{ ;.0;!F;[;[;I";T;0;'@j ;(I"def custom_cast_types;T;)T;*I"def custom_cast_types { :string => { :name=>'char' }, :integer => { :name=>'signed' }, :text => { :name=>'char' }, :float => { :name=>'decimal' }, :binary => { :name=>'binary' } } end;T;+T;9@j ;:IC;[;9@j ;;IC;[;9@j ;T;,IC;={;>T;>T;?{;@[;[[@ i;F;:MysqlCommon;;;;;[;{;IC;" ;T; @j ;.0;!F;[;[;I";T;0;'@ ;I"2ActiveRecord::ConnectionAdapters::MysqlCommon;F;+To; ;IC;[;9@ ;:IC;[;9@ ;;IC;[o;C ;D0;E0;F0;;;'@ ;H@j ;O;;9@ ;T;,IC;={;>T;>T;?{;@[;[[@ i,;F;:MysqlAdapter;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"3ActiveRecord::ConnectionAdapters::MysqlAdapter;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0;+To; ;IC;[;9@ ;:IC;[;9@ ;;IC;[o;C ;D0;E0;F0;;;'@ ;H@j ;O;;9@ ;T;,IC;={;>T;>T;?{;@[;[[@ i0;F;:Mysql2Adapter;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"4ActiveRecord::ConnectionAdapters::Mysql2Adapter;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0;+To; ;IC;[o; ; F; ;,;;;I":ActiveRecord::ConnectionAdapters::SQLiteAdapter#match;F;[[I" string;T0;[[@ i5;F;;[;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;(I"def match(string);T;)T;*I"/def match(string) "REGEXP #{string}" end;T;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;>T;>T;?{;@[;[[@ i4;F;:SQLiteAdapter;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"4ActiveRecord::ConnectionAdapters::SQLiteAdapter;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;>T;>T;?{;@[;[[@ i ;F;:ConnectionAdapters;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"%ActiveRecord::ConnectionAdapters;F;+To;;IC;[o; ; F; ;,;;;I"AActiveRecord::Transactions#with_transaction_returning_status;F;[;[[@ iA;T;:&with_transaction_returning_status;;;[;{;IC;" FIXME!! the following code is already in Rails 4 (see https://github.com/rails/rails/commit/c8792c7b2ea4f5fe7a5610225433ea8dd8d0f83e) it allows manual rollbacks in after_save (eg store events) to reset the object correctly hopefully we can soon get rid of this code! ;T;[;[;I" FIXME!! the following code is already in Rails 4 (see https://github.com/rails/rails/commit/c8792c7b2ea4f5fe7a5610225433ea8dd8d0f83e) it allows manual rollbacks in after_save (eg store events) to reset the object correctly hopefully we can soon get rid of this code!;T;0; @ ;!F;"o;#;$F;%i<;&i?;'@ ;(I"*def with_transaction_returning_status;T;)T;*I"]def with_transaction_returning_status status = nil self.class.transaction do add_to_transaction begin status = yield rescue ActiveRecord::Rollback @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 status = nil end raise ActiveRecord::Rollback unless status end status end;T;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;>T;>T;?{;@[;[[@ i;;F;:Transactions;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@ ;I"ActiveRecord::Transactions;F;+T;9@ ;:IC;[;9@ ;;IC;[;9@ ;T;,IC;={;>T;>T;?{;@[;[[@ i;F;;;;;;;[;{;IC;" ;T; @ ;.0;!F;[;[;I";T;0;'@;I"ActiveRecord;F;O0;H0;O; o; ;IC;[o; ; F; ;,;;;I"Card::Reference#referencer;F;[;[[I"lib/card/reference.rb;Ti ;F;:referencer;;;[;{;IC;" ;T; @$!;.0;!F;[;[;I";T;0;'@"!;(I"def referencer;T;)T;*I"*def referencer Card[referer_id] end;T;+To; ; F; ;,;;;I"Card::Reference#referencee;F;[;[[@)!i ;F;:referencee;;;[;{;IC;" ;T; @2!;.0;!F;[;[;I";T;0;'@"!;(I"def referencee;T;)T;*I"*def referencee Card[referee_id] end;T;+To; ; F; ; ;;;I"$Card::Reference.delete_all_from;F;[[I" card;T0;[[@)!i;F;:delete_all_from;;;[;{;IC;" ;T; @?!;.0;!F;[;[;I";T;0;'@"!;(I"def delete_all_from card;T;)T;*I"Edef delete_all_from card delete_all :referer_id => card.id end;T;+To; ; F; ; ;;;I""Card::Reference.delete_all_to;F;[[I" card;T0;[[@)!i;F;:delete_all_to;;;[;{;IC;" ;T; @N!;.0;!F;[;[;I";T;0;'@"!;(I"def delete_all_to card;T;)T;*I"ldef delete_all_to card where( :referee_id => card.id ).update_all :present=>0, :referee_id => nil end;T;+To; ; F; ; ;;;I"(Card::Reference.update_existing_key;F;[[I" card;T0[I" name;TI"nil;T;[[@)!i;F;:update_existing_key;;;[;{;IC;" ;T; @]!;.0;!F;[;[;I";T;0;'@"!;(I"+def update_existing_key card, name=nil;T;)T;*I"def update_existing_key card, name=nil key = (name || card.name).to_name.key where( :referee_key => key ).update_all :present => 1, :referee_id => card.id end;T;+To; ; F; ; ;;;I"%Card::Reference.update_on_rename;F;[[I" card;T0[I" newname;T0[I"update_referers;TI" false;T;[[@)!i ;F;:update_on_rename;;;[;{;IC;" ;T; @o!;.0;!F;[;[;I";T;0;'@"!;(I">def update_on_rename card, newname, update_referers=false;T;)T;*I"def update_on_rename card, newname, update_referers=false if update_referers # not currentlt needed because references are deleted and re-created in the process of adding new revision #where( :referee_id=>card.id ).update_all :referee_key => newname.to_name.key else delete_all_to card end #Rails.logger.warn "update on rename #{card.inspect}, #{newname}, #{update_referers}" update_existing_key card, newname end;T;+To; ; F; ; ;;;I"%Card::Reference.update_on_delete;F;[[I" card;T0;[[@)!i+;F;:update_on_delete;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@"!;(I"def update_on_delete card;T;)T;*I"Ndef update_on_delete card delete_all_from card delete_all_to card end;T;+To; ; F; ; ;;;I",Card::Reference.repair_missing_referees;F;[;[[@)!i0;F;:repair_missing_referees;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@"!;(I" def repair_missing_referees;T;)T;*I"def repair_missing_referees joins('LEFT JOIN cards ON card_references.referee_id = cards.id').where('(cards.id IS NULL OR cards.trash IS TRUE) AND referee_id IS NOT NULL').update_all :referee_id=>nil end;T;+To; ; F; ; ;;;I",Card::Reference.delete_missing_referers;F;[;[[@)!i4;F;:delete_missing_referers;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@"!;(I" def delete_missing_referers;T;)T;*I"def delete_missing_referers joins('LEFT JOIN cards ON card_references.referer_id = cards.id').where('cards.id IS NULL OR cards.trash IS TRUE').delete_all end;T;+To; ; F; ; ;;;I"Card::Reference.repair_all;F;[;[[@)!i8;F;:repair_all;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@"!;(I"def repair_all;T;)T;*I"def repair_all delete_missing_referers Card.where(:trash=>false).find_each do |card| Rails.logger.info "\nRepairing references for '#{card.name}' (id: #{card.id}) ... " card.update_references end end;T;+T;9@"!;:IC;[;9@"!;;IC;[;9@"!;T;,IC;={;>T;>T;?{;@[;[[@)!i;F;:Reference;;;;;[;{;IC;" ;T; @"!;.0;!F;[;[;I";T;0;'o;C ;D0;E0;F0;;;'@;H@;O0;I"Card::Reference;F;Bo;C ;D0;EI"ActiveRecord::Base;T;F@!;;;'o;C ;D0;E0;F0;;;'@;H@ ;O0;H0;O; o;;IC;[o;4;[[I"lib/card/view_cache.rb;Ti ;F;: SIZE;;;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@!;I"Card::ViewCache::SIZE;F;(I"SIZE = 500;T;*I"SIZE = 500;T;6I"500;T;+To;4;[[@!i ;T;: LIMIT;;;;;[;{;IC;"2reduce cache size to SIZE if LIMIT is reached ;T;[;[;I"2reduce cache size to SIZE if LIMIT is reached;T;0; @!;!F;"o;#;$F;%i ;&i ;'@!;I"Card::ViewCache::LIMIT;F;(I"ALIMIT = 1000 # reduce cache size to SIZE if LIMIT is reached;T;*I"LIMIT = 1000;T;6I" 1000;T;+To;4;[[@!i ;F;: CNT_KEY;;;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@!;I"Card::ViewCache::CNT_KEY;F;(I"CNT_KEY = 'view_cache_cnt';T;*I"CNT_KEY = 'view_cache_cnt';T;6I"'view_cache_cnt';T;+To;4;[[@!i ;F;:FREQUENCY_KEY;;;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@!;I"#Card::ViewCache::FREQUENCY_KEY;F;(I"+FREQUENCY_KEY = 'view_cache_frequency';T;*I"+FREQUENCY_KEY = 'view_cache_frequency';T;6I"'view_cache_frequency';T;+To; ; F; ; ;;;I"Card::ViewCache.cache;F;[;[[@!i;F;;;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@!;(I"def cache;T;)T;*I"1def cache Card::Cache[Card::ViewCache] end;T;+To; ; F; ; ;;;I""Card::ViewCache.increment_cnt;F;[;[[@!i;F;:increment_cnt;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@!;(I"def increment_cnt;T;)T;*I":def increment_cnt cache.write(CNT_KEY, count+1) end;T;+To; ; F; ; ;;;I"Card::ViewCache.count;F;[;[[@!i;F;: count;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@!;(I"def count;T;)T;*I"-def count cache.read(CNT_KEY) || 0 end;T;+To; ; F; ; ;;;I"!Card::ViewCache.reduce_cache;F;[;[[@!i;F;:reduce_cache;;;[;{;IC;" ;T; @,";.0;!F;[;[;I";T;0;'@!;(I"def reduce_cache;T;)T;*I"Mdef reduce_cache update_frequency do |freq| cnts_with_key = freq.keys.map { |key| [freq[key], key] } index = 1 SortedSet.new(cnts_with_key).each do |cnt, key| if index < (LIMIT - SIZE) cache.delete(key) freq.delete(key) else freq[key] = 0 end index += 1 end end end;T;+To; ; F; ; ;;;I"%Card::ViewCache.update_frequency;F;[;[[@!i*;F;:update_frequency;;;[;{;IC;" ;T; @9";.0;!F;[;[o;0 ;1I" yield;F;2I";T;0;3[I" freq;T; @9";I";T;0;'@!;(I"def update_frequency;T;)T;*I"wdef update_frequency freq = cache.read(FREQUENCY_KEY) || {} yield(freq) cache.write(FREQUENCY_KEY, freq) end;T;+To; ; F; ; ;;;I"Card::ViewCache.fetch;F;[ [I" format;T0[I" view;T0[I" args;T0[I" &block;T0;[[@!i0;F;;;;;[;{;IC;" ;T; @K";.0;!F;[;[;I";T;0;'@!;(I"*def fetch(format, view, args, &block);T;)T;*I"def fetch(format, view, args, &block) if !Card.config.view_cache || !format.view_caching? || !format.main? || (view != :open && view != :content) || format.class != HtmlFormat return block.call end roles = Card::Auth.current.all_roles.sort.join '_' key = "view_#{view}_#{format.card.key}_args_#{Card::Cache.obj_to_key(args)}_roles_#{roles}" if !cache.exist?(key) increment_cnt reduce_cache if count > LIMIT end update_frequency do |freq| freq[key] ||= 0 freq[key] += 1 end if Card.config.view_cache == 'debug' if cache.exist? key "fetched from view cache: #{cache.read key}" else "written to view cache: #{cache.fetch(key, &block)}" end else cache.fetch(key, &block) end end;T;+To; ; F; ; ;;;I"Card::ViewCache.reset;F;[[I" hard;TI" false;T;[[@!iM;F;;;;;[;{;IC;" ;T; @`";.0;!F;[;[;I";T;0;'@!;(I"def reset hard=false;T;)T;*I"0def reset hard=false cache.reset hard end;T;+T;9@!;:IC;[;9@!;;IC;[;9@!;T;,IC;={;>T;>T;?{;@[;[[@!i;F;:ViewCache;;;;;[;{;IC;" ;T; @!;.0;!F;[;[;I";T;0;'@;I"Card::ViewCache;F;+To; ;IC;[;9@";:IC;[;9@";;IC;[;9@";T;,IC;={;>T;>T;?{;@[;[[I"lib/card/exceptions.rb;Ti ;T;: Error;;;;;[;{;IC;"code problem ;T;[;[;I"code problem;T;0; @";!F;"o;#;$F;%i ;&i ;'@;I"Card::Error;F;Bo;C ;D0;E0;F0;:StandardError;'@;H0;O; ;+To; ;IC;[;9@";:IC;[;9@";;IC;[;9@";T;,IC;={;>T;>T;?{;@[;[[@"i ;T;: Oops;;;;;[;{;IC;"wagneer problem (rename!) ;T;[;[;I"wagneer problem (rename!);T;0; @";!F;"o;#;$F;%i ;&i ;'@;I"Card::Oops;F;Bo;C ;D0;E0;F0;;7;'@;H@";O0;+To; ;IC;[;9@";:IC;[;9@";;IC;[;9@";T;,IC;={;>T;>T;?{;@[;[[@"i;F;: BadQuery;;;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@;I"Card::BadQuery;F;Bo;C ;D0;E0;F0;;7;'@;H@";O0;+To; ;IC;[;9@";:IC;[;9@";;IC;[;9@";T;,IC;={;>T;>T;?{;@[;[[@"i;F;: NotFound;;;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@;I"Card::NotFound;F;Bo;C ;D0;E0;F0;;8;'@;H0;O; ;+To; ;IC;[o; ; F; ;,;;;I" Card::PermissionDenied#card;F;[;[[@"i;F;;;;;[;{;IC;"(Returns the value of attribute card ;T; @";.0;!F;[;[;I"(Returns the value of attribute card;T;0;'@";(I" def card;T;*I"def card @card end;T;+To; ; F; ;,;;;I"&Card::PermissionDenied#initialize;F;[[I" card;T0;[[@"i;F;;|;;;[;{;IC;" ;T; @";.0;!F;[;[o;0 ;1I" return;F;2I"'a new instance of PermissionDenied;T;0;3[I"PermissionDenied;F; @";I";T;0;'@";(I"def initialize card;T;)T;*I"Adef initialize card @card = card super build_message end;T;+To; ; F; ;,;;;I")Card::PermissionDenied#build_message;F;[;[[@"i;F;:build_message;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@";(I"def build_message;T;)T;*I"}def build_message if msg = @card.errors[:permission_denied] "for card #{@card.name}: #{msg}" else super end end;T;+T;9@";:IC;[;9@";;IC;[;9@";T;,IC;={;IC;={;@";0;>T;>T;>T;?{;@[;[[@"i;F;:PermissionDenied;;;;;[;{;IC;" ;T; @";.0;!F;[;[;I";T;0;'@;I"Card::PermissionDenied;F;Bo;C ;D0;E0;F0;;7;'@;H@";O0;+To; ;IC;[o; ; F; ;,;;;I"Card::Abort#status;F;[;[[@"i(;F;: status;;;[;{;IC;"*Returns the value of attribute status ;T; @#;.0;!F;[;[;I"*Returns the value of attribute status;T;0;'@#;(I"def status;T;*I"def status @status end;T;+To; ; F; ;,;;;I"Card::Abort#initialize;F;[[I" status;T0[I"msg;TI"'';T;[[@"i*;F;;|;;;[;{;IC;" ;T; @ #;.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of Abort;T;0;3[I" Abort;F; @ #;I";T;0;'@#;(I""def initialize status, msg='';T;)T;*I"Edef initialize status, msg='' @status = status super msg end;T;+T;9@#;:IC;[;9@#;;IC;[;9@#;T;,IC;={;>IC;={;@#;0;>T;>T;>T;?{;@[;[[@"i';F;: Abort;;;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@;I"Card::Abort;F;Bo;C ;D0;E0;F0;;8;'@;H0;O; ;+To;;IC;[ o;;IC;[o; ; F; ;,;;;I"/Card::Generators::ClassMethods#source_root;F;[[I" path;TI"nil;T;[[I"lib/generators/card.rb;Ti;F;:source_root;;;[;{;IC;" ;T; @M#;.0;!F;[;[;I";T;0;'@K#;(I" def source_root(path = nil);T;)T;*I"def source_root(path = nil) if path @_card_source_root = path else @_card_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'card', generator_name, 'templates')) end end;T;+To; ; F; ;,;;;I"*Card::Generators::ClassMethods#banner;F;[;[[@U#i;T;: banner;;;[;{;IC;">Override Rails default banner (wagn is the command name). ;T;[;[;I">Override Rails default banner (wagn is the command name).;T;0; @^#;!F;"o;#;$F;%i;&i;'@K#;(I"def banner;T;)T;*I"pdef banner "wagn generate #{namespace} #{self.arguments.map(&:usage)*' '} [options]".gsub(/\s+/, ' ') end;T;+T;9@K#;:IC;[;9@K#;;IC;[;9@K#;T;,IC;={;>T;>T;?{;@[;[[@U#i ;F;:ClassMethods;;;;;[;{;IC;" ;T; @K#;.0;!F;[;[;I";T;0;'@I#;I"#Card::Generators::ClassMethods;F;+To; ;IC;[;9@|#;:IC;[o;C ;D0;E0;F0;;B;'@I#;H@K#;O;;9@|#;;IC;[;9@|#;T;,IC;={;>T;>T;?{;@[;[[@U#i;F;:NamedBase;;;;;[;{;IC;" ;T; @|#;.0;!F;[;[;I";T;0;'@I#;I" Card::Generators::NamedBase;F;Bo;C ;D0;EI"!Rails::Generators::NamedBase;T;F@;;C;'o;C ;D0;EI"Rails::Generators;T;F@;:Generators;'o;C ;D0;E0;F0;: Rails;'@;H0;O0;H0;O0;H0;O; ;+To; ;IC;[;9@#;:IC;[o;C ;D0;E0;F0;;B;'@I#;H@K#;O;;9@#;;IC;[;9@#;T;,IC;={;>T;>T;?{;@[;[[@U#i ;F;:MigrationBase;;;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@I#;I"$Card::Generators::MigrationBase;F;Bo;C ;D0;EI"#ActiveRecord::Generators::Base;T;F@;;;'o;C ;D0;EI"ActiveRecord::Generators;T;F@;;D;'o;C ;D0;E0;F0;;;'@;H@ ;O0;H0;O0;H0;O; ;+To; ;IC;[o; ; F; ;,;;;I"0Card::Generators::SetGenerator#create_files;F;[;[[I"-lib/generators/card/set/set_generator.rb;Ti;F;:create_files;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@#;(I"def create_files;T;)T;*I"def create_files mod_path = if options.core? File.join Cardio.gem_root, 'mod', file_name else File.join 'mod', file_name end set_path = File.join(mod_path, 'set', set_pattern, anchors[0..-2], "#{anchors.last}.rb") spec_path = File.join(mod_path, 'spec', 'set', set_pattern, anchors[0..-2], "#{anchors.last}_spec.rb" ) template 'set_template.erb', set_path template 'set_spec_template.erb', spec_path end;T;+T;9@#;:IC;[;9@#;;IC;[;9@#;T;,IC;={;>T;>T;?{;@[;[[@#i ;F;:SetGenerator;;;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@I#;I"#Card::Generators::SetGenerator;F;Bo;C ;D0;E0;F0;;C;'@I#;H@|#;O0;+To; ;IC;[o; ; F; ;,;;;I"3Card::Generators::FormatGenerator#create_files;F;[;[[I"3lib/generators/card/format/format_generator.rb;Ti;F;;G;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@#;(I"def create_files;T;)T;*I"def create_files mod_path = if options.core? File.join Cardio.gem_root, 'mod', file_name else File.join 'mod', file_name end format_path = File.join(mod_path, 'format', "#{module_name}_format.rb") spec_path = File.join(mod_path, 'spec', 'format', "#{module_name}_format_spec.rb") template 'format_template.erb', format_path template 'format_spec_template.erb', spec_path end;T;+T;9@#;:IC;[;9@#;;IC;[;9@#;T;,IC;={;>T;>T;?{;@[;[[@#i ;F;:FormatGenerator;;;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@I#;I"&Card::Generators::FormatGenerator;F;Bo;C ;D0;E0;F0;;C;'@I#;H@|#;O0;+To; ;IC;[o; ; F; ;,;;;I"?Card::Generators::MigrationGenerator#create_migration_file;F;[;[[I"9lib/generators/card/migration/migration_generator.rb;Ti;F;:create_migration_file;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@#;(I"def create_migration_file;T;)T;*I"Jdef create_migration_file migration_type = options['core'] ? :core_cards : :deck_cards mig_paths = Cardio.migration_paths(migration_type) raise "No migration directory for #{migration_type}" if mig_paths.blank? set_local_assigns! migration_template @migration_template, File.join( mig_paths.first, "#{file_name}.rb") end;T;+To; ; F; ;,;:protected;I"T;,IC;={;>T;>T;?{;@[;[[@#i ;F;:MigrationGenerator;;;;;[;{;IC;" ;T; @#;.0;!F;[;[;I";T;0;'@I#;I")Card::Generators::MigrationGenerator;F;Bo;C ;D0;E0;F0;;F;'@I#;H@#;O0;+T;9@I#;:IC;[;9@I#;;IC;[;9@I#;T;,IC;={;>T;>T;?{;@[;[ [@U#i [@#i [@#i [@#i ;F;;D;;;;;[;{;IC;" ;T; @I#;.0;!F;[;[;I";T;0;'@;I"Card::Generators;F;+To;;IC;[o; ; F; ;,;;;I"Card::SpecHelper#login_as;F;[[I" user;T0;[[I"lib/card/spec_helper.rb;Ti ;T;: login_as;;;[;{;IC;"/~~~~~~~~~ HELPER METHODS ~~~~~~~~~~~~~~~# ;T;[;[;I"/~~~~~~~~~ HELPER METHODS ~~~~~~~~~~~~~~~#;T;0; @2$;!F;"o;#;$F;%i ;&i ;'@0$;(I"def login_as user;T;)T;*I"def login_as user Card::Auth.current_id = (uc=Card[user.to_s] and uc.id) if @request @request.session[:user] = Card::Auth.current_id end #warn "(ath)login_as #{user.inspect}, #{Card::Auth.current_id}, #{@request.session[:user]}" end;T;+To; ; F; ;,;;;I"Card::SpecHelper#newcard;F;[[I" name;T0[I" content;TI""";T;[[@9$i;F;: newcard;;;[;{;IC;" ;T; @C$;.0;!F;[;[;I";T;0;'@0$;(I"!def newcard name, content="";T;)T;*I"def newcard name, content="" #FIXME - misleading name; sounds like it doesn't save. Card.create! :name=>name, :content=>content end;T;+To; ; F; ;,;;;I"(Card::SpecHelper#assert_view_select;F;[[I"view_html;T0[I" *args;T0[I" &block;T0;[[@9$i;F;:assert_view_select;;;[;{;IC;" ;T; @U$;.0;!F;[;[;I";T;0;'@0$;(I"5def assert_view_select(view_html, *args, &block);T;)T;*I"def assert_view_select(view_html, *args, &block) node = Nokogiri::HTML::Document.parse(view_html).root #node = HTML::Document.new(view_html).root if block_given? assert_select node, *args, &block else assert_select node, *args end end;T;+To; ; F; ;,;;;I".Card::SpecHelper#debug_assert_view_select;F;[[I"view_html;T0[I" *args;T0[I" &block;T0;[[@9$i$;F;:debug_assert_view_select;;;[;{;IC;" ;T; @h$;.0;!F;[;[;I";T;0;'@0$;(I";def debug_assert_view_select(view_html, *args, &block);T;)T;*I"def debug_assert_view_select(view_html, *args, &block) Rails.logger.rspec %( #{CodeRay.scan(Nokogiri::XML(view_html,&:noblanks).to_s, :html).div} ) assert_view_select view_html, *args, &block end;T;+To; ; F; ;,;;;I"#Card::SpecHelper#render_editor;F;[[I" type;T0;[[@9$i3;F;:render_editor;;;[;{;IC;" ;T; @{$;.0;!F;[;[;I";T;0;'@0$;(I"def render_editor(type);T;)T;*I"def render_editor(type) card = Card.create(:name=>"my favority #{type} + #{rand(4)}", :type=>type) card.format.render(:edit) end;T;+To; ; F; ;,;;;I"$Card::SpecHelper#render_content;F;[[I" content;T0[I"format_args;TI"{};T;[[@9$i8;F;:render_content;;;[;{;IC;" ;T; @$;.0;!F;[;[;I";T;0;'@0$;(I"/def render_content content, format_args={};T;)T;*I"fdef render_content content, format_args={} render_content_with_args( content, format_args ) end;T;+To; ; F; ;,;;;I".Card::SpecHelper#render_content_with_args;F;[[I" content;T0[I"format_args;TI"{};T[I"view_args;TI"{};T;[[@9$i<;F;:render_content_with_args;;;[;{;IC;" ;T; @$;.0;!F;[;[;I";T;0;'@0$;(I"Gdef render_content_with_args content, format_args={}, view_args={};T;)T;*I"def render_content_with_args content, format_args={}, view_args={} @card ||= Card.new :name=>"Tempo Rary 2" @card.content = content @card.format(format_args)._render :core, view_args end;T;+To; ; F; ;,;;;I"!Card::SpecHelper#render_card;F;[[I" view;T0[I"card_args;TI"{};T[I"format_args;TI"{};T;[[@9$iB;F;:render_card;;;[;{;IC;" ;T; @$;.0;!F;[;[;I";T;0;'@0$;(I"7def render_card view, card_args={}, format_args={};T;)T;*I"pdef render_card view, card_args={}, format_args={} render_card_with_args view, card_args, format_args end;T;+To; ; F; ;,;;;I"+Card::SpecHelper#render_card_with_args;F;[ [I" view;T0[I"card_args;TI"{};T[I"format_args;TI"{};T[I"view_args;TI"{};T;[[@9$iF;F;:render_card_with_args;;;[;{;IC;" ;T; @$;.0;!F;[;[;I";T;0;'@0$;(I"Odef render_card_with_args view, card_args={}, format_args={}, view_args={};T;)T;*I"*def render_card_with_args view, card_args={}, format_args={}, view_args={} card = begin if card_args[:name] Card.fetch card_args[:name], :new=>card_args else Card.new card_args.merge( :name=> 'Tempo Rary' ) end end card.format(format_args)._render(view, view_args) end;T;+To; ; F; ;,;;;I"Card::SpecHelper#users;F;[;[[@9$iQ;F;: users;;;[;{;IC;" ;T; @$;.0;!F;[;[;I";T;0;'@0$;(I"def users;T;)T;*I"+def users SharedData::USERS.sort end;T;+T;9@0$;:IC;[;9@0$;;IC;[o;C ;D0;EI"8Rails::Dom::Testing::Assertions::SelectorAssertions;T;F@0$;:SelectorAssertions;'o;C ;D0;EI"$Rails::Dom::Testing::Assertions;T;F@0$;:Assertions;'o;C ;D0;EI"Rails::Dom::Testing;T;F@0$;: Testing;'o;C ;D0;EI"Rails::Dom;T;F@0$;:Dom;'o;C ;D0;E0;F0;;E;'@0$;H0;O0;H0;O0;H0;O0;H0;O0;H0;O;;9@0$;T;,IC;={;>T;>T;?{;@[;[[@9$i;F;:SpecHelper;;;;;[;{;IC;" ;T; @0$;.0;!F;[;[;I";T;0;'o;C ;D0;E0;F0;;;'@;H@;O0;I"Card::SpecHelper;Fo; ;IC;[$o; ; F; ; ;;;I""Card::SetPattern.pattern_code;F;[;[[I"lib/card/set_pattern.rb;Ti ;F;:pattern_code;;;[;{;IC;"0Returns the value of attribute pattern_code ;T; @%;.0;!F;[;[;I"0Returns the value of attribute pattern_code;T;0;'@%;(I"def pattern_code;T;*I")def pattern_code @pattern_code end;T;+To; ; F; ; ;;;I"#Card::SetPattern.pattern_code=;F;[[I" value;T0;[[@ %i ;F;:pattern_code=;;;[;{;IC;"$Sets the attribute pattern_code ;T; @%;.0;!F;[;[o;0 ;1I" param;F;2I"4the value to set the attribute pattern_code to.;T;I" value;T;30; @%;I"aSets the attribute pattern_code @param value the value to set the attribute pattern_code to.;T;0;'@%;(I"def pattern_code=(value);T;*I"9def pattern_code=(value) @pattern_code = value end;T;+To; ; F; ; ;;;I" Card::SetPattern.pattern_id;F;[;[[@ %i ;F;:pattern_id;;;[;{;IC;".Returns the value of attribute pattern_id ;T; @(%;.0;!F;[;[;I".Returns the value of attribute pattern_id;T;0;'@%;(I"def pattern_id;T;*I"%def pattern_id @pattern_id end;T;+To; ; F; ; ;;;I"!Card::SetPattern.pattern_id=;F;[[I" value;T0;[[@ %i ;F;:pattern_id=;;;[;{;IC;""Sets the attribute pattern_id ;T; @5%;.0;!F;[;[o;0 ;1I" param;F;2I"2the value to set the attribute pattern_id to.;T;I" value;T;30; @5%;I"]Sets the attribute pattern_id @param value the value to set the attribute pattern_id to.;T;0;'@%;(I"def pattern_id=(value);T;*I"5def pattern_id=(value) @pattern_id = value end;T;+To; ; F; ; ;;;I"#Card::SetPattern.junction_only;F;[;[[@ %i ;F;:junction_only;;;[;{;IC;"1Returns the value of attribute junction_only ;T; @H%;.0;!F;[;[;I"1Returns the value of attribute junction_only;T;0;'@%;(I"def junction_only;T;*I"+def junction_only @junction_only end;T;+To; ; F; ; ;;;I"$Card::SetPattern.junction_only=;F;[[I" value;T0;[[@ %i ;F;:junction_only=;;;[;{;IC;"%Sets the attribute junction_only ;T; @U%;.0;!F;[;[o;0 ;1I" param;F;2I"5the value to set the attribute junction_only to.;T;I" value;T;30; @U%;I"cSets the attribute junction_only @param value the value to set the attribute junction_only to.;T;0;'@%;(I"def junction_only=(value);T;*I";def junction_only=(value) @junction_only = value end;T;+To; ; F; ; ;;;I""Card::SetPattern.assigns_type;F;[;[[@ %i ;F;:assigns_type;;;[;{;IC;"0Returns the value of attribute assigns_type ;T; @h%;.0;!F;[;[;I"0Returns the value of attribute assigns_type;T;0;'@%;(I"def assigns_type;T;*I")def assigns_type @assigns_type end;T;+To; ; F; ; ;;;I"#Card::SetPattern.assigns_type=;F;[[I" value;T0;[[@ %i ;F;:assigns_type=;;;[;{;IC;"$Sets the attribute assigns_type ;T; @u%;.0;!F;[;[o;0 ;1I" param;F;2I"4the value to set the attribute assigns_type to.;T;I" value;T;30; @u%;I"aSets the attribute assigns_type @param value the value to set the attribute assigns_type to.;T;0;'@%;(I"def assigns_type=(value);T;*I"9def assigns_type=(value) @assigns_type = value end;T;+To; ; F; ; ;;;I" Card::SetPattern.anchorless;F;[;[[@ %i ;F;:anchorless;;;[;{;IC;".Returns the value of attribute anchorless ;T; @%;.0;!F;[;[;I".Returns the value of attribute anchorless;T;0;'@%;(I"def anchorless;T;*I"%def anchorless @anchorless end;T;+To; ; F; ; ;;;I"!Card::SetPattern.anchorless=;F;[[I" value;T0;[[@ %i ;F;:anchorless=;;;[;{;IC;""Sets the attribute anchorless ;T; @%;.0;!F;[;[o;0 ;1I" param;F;2I"2the value to set the attribute anchorless to.;T;I" value;T;30; @%;I"]Sets the attribute anchorless @param value the value to set the attribute anchorless to.;T;0;'@%;(I"def anchorless=(value);T;*I"5def anchorless=(value) @anchorless = value end;T;+To; ; F; ; ;;;I"(Card::SetPattern.anchor_parts_count;F;[;[[@ %i [@ %i0;F;:anchor_parts_count;;;[;{;IC;"6Returns the value of attribute anchor_parts_count ;T; @%;.0;!F;[;[;I"6Returns the value of attribute anchor_parts_count;T;0;'@%;(I"def anchor_parts_count;T;)T;*I"5def anchor_parts_count @anchor_parts_count end;T;+To; ; F; ; ;;;I")Card::SetPattern.anchor_parts_count=;F;[[I" value;T0;[[@ %i ;F;:anchor_parts_count=;;;[;{;IC;"*Sets the attribute anchor_parts_count ;T; @%;.0;!F;[;[o;0 ;1I" param;F;2I":the value to set the attribute anchor_parts_count to.;T;I" value;T;30; @%;I"mSets the attribute anchor_parts_count @param value the value to set the attribute anchor_parts_count to.;T;0;'@%;(I"#def anchor_parts_count=(value);T;*I"Edef anchor_parts_count=(value) @anchor_parts_count = value end;T;+To; ; F; ; ;;;I"Card::SetPattern.find;F;[[I"pattern_code;T0;[[@ %i ;F;: find;;;[;{;IC;" ;T; @%;.0;!F;[;[;I";T;0;'@%;(I"def find pattern_code;T;)T;*I"jdef find pattern_code Card.set_patterns.find { |sub| sub.pattern_code == pattern_code } end;T;+To; ; F; ; ;;;I"$Card::SetPattern.junction_only?;F;[;[[@ %i;F;:junction_only?;;;[;{;IC;" ;T; @%;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @%;I";T;0;'@%;(I"def junction_only?;T;)T;*I"-def junction_only? !!junction_only end;T;+To; ; F; ; ;;;I"!Card::SetPattern.anchorless?;F;[;[[@ %i;F;:anchorless?;;;[;{;IC;" ;T; @%;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @%;I";T;0;'@%;(I"def anchorless?;T;)T;*I"'def anchorless? !!anchorless end;T;+To; ; F; ; ;;;I"Card::SetPattern.new;F;[[I" card;T0;[[@ %i;F;;;;;[;{;IC;" ;T; @%;.0;!F;[;[;I";T;0;'@%;(I"def new card;T;)T;*I"6def new card super if pattern_applies? card end;T;+To; ; F; ; ;;;I"Card::SetPattern.pattern;F;[;[[@ %i;F;: pattern;;;[;{;IC;" ;T; @ &;.0;!F;[;[;I";T;0;'@%;(I"def pattern;T;)T;*I"Pdef pattern Card.fetch(self.pattern_id, :skip_modules=>true).cardname end;T;+To; ; F; ; ;;;I"Card::SetPattern.register;F;[[I"pattern_code;T0[I" opts;TI"{};T;[[@ %i!;F;;;;;[;{;IC;" ;T; @&;.0;!F;[;[;I";T;0;'@%;(I"'def register pattern_code, opts={};T;)T;*I"ddef register pattern_code, opts={} if self.pattern_id = Card::Codename[pattern_code] self.pattern_code = pattern_code Card.set_patterns.insert opts.delete(:index).to_i, self self.anchorless = !respond_to?( :anchor_name ) opts.each { |key, val| send "#{key}=", val } else warn "no codename for pattern_code #{pattern_code}" end end;T;+To; ; F; ; ;;;I"&Card::SetPattern.pattern_applies?;F;[[I" card;T0;[[@ %i,;F;:pattern_applies?;;;[;{;IC;" ;T; @*&;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @*&;I";T;0;'@%;(I"def pattern_applies? card;T;)T;*I"Tdef pattern_applies? card junction_only? ? card.cardname.junction? : true end;T;+To; ; F; ; ;;;I"$Card::SetPattern.write_tmp_file;F;[[I"pattern_code;T0[I"from_file;T0[I"seq;T0;[[@ %i4;F;;;;;[;{;IC;" ;T; @>&;.0;!F;[;[;I";T;0;'@%;(I"4def write_tmp_file pattern_code, from_file, seq;T;)T;*I"Odef write_tmp_file pattern_code, from_file, seq to_file = "#{Card.paths['tmp/set_pattern'].first}/#{seq}-#{pattern_code}.rb" klass = "Card::#{pattern_code.camelize}Set" file_content = <" end;T;+To; ; F; ;,;;;I"Card::SetPattern#safe_key;F;[;[[@ %i~;F;: safe_key;;;[;{;IC;" ;T; @&;.0;!F;[;[;I";T;0;'@%;(I"def safe_key;T;)T;*I"def safe_key caps_part = self.class.pattern_code.gsub(' ','_').upcase self.class.anchorless? ? caps_part : "#{caps_part}-#{@anchor_name.safe_key}" end;T;+To; ; F; ;,;;;I""Card::SetPattern#rule_set_key;F;[;[[@ %i;F;:rule_set_key;;;[;{;IC;" ;T; @&;.0;!F;[;[;I";T;0;'@%;(I"def rule_set_key;T;)T;*I"def rule_set_key if self.class.anchorless? self.class.pattern_code elsif @anchor_id [ @anchor_id, self.class.pattern_code ].map( &:to_s ) * '+' end end;T;+T;9@%;:IC;[;9@%;;IC;[;9@%;T;_IC;={;@(%;@5%;>T;aIC;={;@H%;@U%;>T;cIC;={;@h%;@u%;>T;eIC;={;@%;@%;>T;gIC;={;@%;@%;>T;>T;,IC;={;>T;>T;?{;@[;[[@ %i;F;:SetPattern;;;;;[;{;IC;" ;T; @%;.0;!F;[;[;I";T;0;'@;I"Card::SetPattern;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0;+To; ;IC;[ o; ; F; ;,;;;I"Card::TypeSet#initialize;F;[[I" card;T0;[[@ %i;F;;|;;;[;{;IC;" ;T; @';.0;!F;[;[o;0 ;1I" return;F;2I"a new instance of TypeSet;T;0;3[I" TypeSet;F; @';I";T;0;'@';(I"def initialize card;T;)T;*I"Mdef initialize card super @inherit_card = card unless module_key end;T;+To; ; F; ;,;;;I"'Card::TypeSet#lookup_inherited_key;F;[;[[@ %i;F;:lookup_inherited_key;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@';(I"def lookup_inherited_key;T;)T;*I"def lookup_inherited_key return unless @inherit_card card, @inherit_card = @inherit_card, nil default_rule = card.rule_card(:default) and type_code = default_rule.type_code and #default_rule.cardname.size > 2 and #default_rule.left.right.codename == self.class.pattern_code mod_key = "Type::#{type_code.to_s.camelize}" and ( Card::Set.modules[:nonbase_format].values + [Card::Set.modules[:nonbase]] ).any?{|hash| hash[mod_key]} and mod_key end;T;+To; ; F; ;,;;;I" Card::TypeSet#inherited_key;F;[;[[@ %i;F;:inherited_key;;;[;{;IC;" ;T; @&';.0;!F;[;[;I";T;0;'@';(I"def inherited_key;T;)T;*I"odef inherited_key (defined? @inherited_key) ? @inherited_key : @inherited_key = lookup_inherited_key end;T;+To; ; F; ;,;;;I"%Card::TypeSet#lookup_module_list;F;[[I"modules_hash;T0;[[@ %i;F;;o;;;[;{;IC;" ;T; @3';.0;!F;[;[;I";T;0;'@';(I"(def lookup_module_list modules_hash;T;)T;*I"def lookup_module_list modules_hash module_key ? modules_hash[ module_key ] : inherited_key && modules_hash[ inherited_key ] end;T;+T;9@';:IC;[;9@';;IC;[;9@';T;,IC;={;>T;>T;?{;@[;[[@ %i;F;: TypeSet;;;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@;I"Card::TypeSet;F;Bo;C ;D0;E0;F0;;u;'@;H@%;O0;+To; ;IC;[;9@S';:IC;[;9@S';;IC;[;9@S';T;,IC;={;>T;>T;?{;@[;[[I"lib/card/core_migration.rb;Ti ;F;:CoreMigration;;;;;[;{;IC;" ;T; @S';.0;!F;[;[;I";T;0;'o;C ;D0;E0;F0;;;'@;H@;O0;I"Card::CoreMigration;F;Bo;C ;D0;EI"Card::Migration;T;F@e';;;'@ ;H@;O0o; ;IC;[o; ; F; ;,;;;I"Card::Act#set_actor;F;[;[[I"#mod/01_history/lib/card/act.rb;Ti;F;:set_actor;;;[;{;IC;" ;T; @k';.0;!F;[;[;I";T;0;'@i';(I"def set_actor;T;)T;*I":def set_actor self.actor_id ||= Auth.current_id end;T;+To; ; F; ; ;;;I" Card::Act.delete_actionless;F;[;[[@p'i;F;:delete_actionless;;;[;{;IC;" ;T; @y';.0;!F;[;[;I";T;0;'@i';(I"def self.delete_actionless;T;)T;*I"|def self.delete_actionless Card::Act.where( "id NOT IN (?)", Card::Action.pluck("card_act_id"), ).delete_all end;T;+To; ; F; ; ;;;I"'Card::Act.find_all_with_actions_on;F;[[I" card_ids;T0[I" args;TI"{};T;[[@p'i;F;:find_all_with_actions_on;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@i';(I"8def self.find_all_with_actions_on card_ids, args={};T;)T;*I"bdef self.find_all_with_actions_on card_ids, args={} sql = 'card_actions.card_id IN (:card_ids) AND ( (draft is not true) ' sql << ( args[:with_drafts] ? 'OR actor_id = :current_user_id)' : ')' ) vars = {:card_ids => card_ids, :current_user_id=>Card::Auth.current_id } Card::Act.joins(:actions).where( sql, vars ).uniq.order(:id).reverse_order end;T;+To; ; F; ;,;;;I"Card::Act#action_on;F;[[I" card_id;T0;[[@p'i);T;:action_on;;;[;{;IC;"Card[ card_id ] end ;T;[;[;I" Card[ card_id ] end;T;0; @';!F;"o;#;$F;%i&;&i';'@i';(I"def action_on card_id;T;)T;*I"ddef action_on card_id actions.where( "card_id = #{card_id} and draft is not true" ).first end;T;+To; ; F; ;,;;;I"Card::Act#main_action;F;[;[[@p'i-;F;:main_action;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@i';(I"def main_action;T;)T;*I">def main_action action_on(card_id) || actions.first end;T;+To; ; F; ;,;;;I"Card::Act#elapsed_time;F;[;[[@p'i1;F;:elapsed_time;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@i';(I"def elapsed_time;T;)T;*I"Sdef elapsed_time DateTime.new(acted_at).distance_of_time_in_words_to_now end;T;+To; ; F; ;,;;;I""Card::Act#relevant_drafts_for;F;[[I" card;T0;[[@p'i5;F;:relevant_drafts_for;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@i';(I"!def relevant_drafts_for card;T;)T;*I"def relevant_drafts_for card drafts.select do |action| card.included_card_ids.include?(action.card_id) || (card == action.card) end end;T;+To; ; F; ;,;;;I"#Card::Act#relevant_actions_for;F;[[I" card;T0[I"with_drafts;TI" false;T;[[@p'i;;F;:relevant_actions_for;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@i';(I"5def relevant_actions_for card, with_drafts=false;T;)T;*I"def relevant_actions_for card, with_drafts=false actions.select do |action| card.included_card_ids.include?(action.card_id) || (card == action.card) end end;T;+To; ; F; ;,;;b;I".Card::Act#timestamp_attributes_for_create;F;[;[[@p'iB;F;:$timestamp_attributes_for_create;;;[;{;IC;" ;T; @';.0;!F;[;[;I";T;0;'@i';(I"(def timestamp_attributes_for_create;T;)T;*I"Adef timestamp_attributes_for_create super << :acted_at end;T;+T;9@i';:IC;[;9@i';;IC;[;9@i';T;,IC;={;>T;>T;?{;@[;[[@p'i;F;:Act;;;;;[;{;IC;" ;T; @i';.0;!F;[;[;I";T;0;'@;I"Card::Act;F;Bo;C ;D0;EI"ActiveRecord::Base;T;F@;;;'o;C ;D0;E0;F0;;;'@;H@ ;O0;H0;O; ;+To; ;IC;[o;4;[[I"&mod/01_history/lib/card/action.rb;Ti;T;: TYPE;;;;;[;{;IC;"0replace with enum if we start using rails 4 ;T;[;[;I"0replace with enum if we start using rails 4;T;0; @(;!F;"o;#;$F;%i;&i;'@(;I"Card::Action::TYPE;F;(I"'TYPE = [:create, :update, :delete];T;*I"'TYPE = [:create, :update, :delete];T;6I" [:create, :update, :delete];T;+To; ; F; ; ;;;I"Card::Action.cache;F;[;[[@(i;F;;;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@(;(I"def cache;T;)T;*I"(def cache Card::Cache[Action] end;T;+To; ; F; ; ;;;I"Card::Action.fetch;F;[[I"id;T0;[[@(i;F;;;;;[;{;IC;" ;T; @!(;.0;!F;[;[;I";T;0;'@(;(I"def fetch id;T;)T;*I"hdef fetch id cache.read(id.to_s) or begin cache.write id.to_s, Action.find(id.to_i) end end;T;+To; ; F; ; ;;;I"!Card::Action.delete_cardless;F;[;[[@(i$;F;:delete_cardless;;;[;{;IC;" ;T; @0(;.0;!F;[;[;I";T;0;'@(;(I"def delete_cardless;T;)T;*I"def delete_cardless Card::Action.joins('LEFT JOIN cards ON card_actions.card_id = cards.id').where('cards.id IS NULL').delete_all end;T;+To; ; F; ; ;;;I"Card::Action.delete_old;F;[;[[@(i(;F;:delete_old;;;[;{;IC;" ;T; @=(;.0;!F;[;[;I";T;0;'@(;(I"def delete_old;T;)T;*I"rdef delete_old Card.find_each do |card| card.delete_old_actions end Card::Act.delete_actionless end;T;+To; ; F; ;,;;;I" Card::Action#changed_fields;F;[[I"obj;T0[I"changed_fields;T0;[[@(i?;T;:changed_fields;;;[;{;IC;"This is the main API from Cards to history See also create_act_and_action, which needs to happen before this or we don't have the action to call this method on. When changes are stored for versioned attributes, this is the signal method By overriding this method in a module, the module takes over handling of changes. Although the standard version stores the Changes in active record models (Act, Action and Change records), these could be /dev/nulled for a history-less implementation, or handled by an external service. If change streams are generated from database triggers, and we aren't writing here (disabled history), we still have to generate change stream events in another way. ;T;[;[;I" This is the main API from Cards to history See also create_act_and_action, which needs to happen before this or we don't have the action to call this method on. When changes are stored for versioned attributes, this is the signal method By overriding this method in a module, the module takes over handling of changes. Although the standard version stores the Changes in active record models (Act, Action and Change records), these could be /dev/nulled for a history-less implementation, or handled by an external service. If change streams are generated from database triggers, and we aren't writing here (disabled history), we still have to generate change stream events in another way. ;T;0; @J(;!F;"o;#;$F;%i0;&i>;'@(;(I"+def changed_fields obj, changed_fields;T;)T;*I"def changed_fields obj, changed_fields #changed_fields.each{ |f| changes.build :field => f, :value => self[f] } changed_fields.each{ |f| Card::Change.create :field => f, :value => obj[f], :card_action_id=>id } end;T;+To; ; F; ;,;;;I"Card::Action#edit_info;F;[;[[@(iD;F;:edit_info;;;[;{;IC;" ;T; @\(;.0;!F;[;[;I";T;0;'@(;(I"def edit_info;T;)T;*I"Mdef edit_info @edit_info ||= { :action_type => "#{action_type}d", :new_content => new_values[:content], :new_name => new_values[:name], :new_cardtype => new_values[:cardtype], :old_content => old_values[:content], :old_name => old_values[:name], :old_cardtype => old_values[:cardtype] } end;T;+To; ; F; ;,;;;I"Card::Action#new_values;F;[;[[@(iP;F;:new_values;;;[;{;IC;" ;T; @i(;.0;!F;[;[;I";T;0;'@(;(I"def new_values;T;)T;*I"def new_values @new_values ||= { :content => new_value_for(:db_content), :name => new_value_for(:name), :cardtype => ( typecard = Card[new_value_for(:type_id).to_i] and typecard.name.capitalize ) } end;T;+To; ; F; ;,;;;I"Card::Action#old_values;F;[;[[@(iY;F;:old_values;;;[;{;IC;" ;T; @v(;.0;!F;[;[;I";T;0;'@(;(I"def old_values;T;)T;*I"def old_values @old_values ||= { :content => last_value_for(:db_content), :name => last_value_for(:name), :cardtype => ( value = last_value_for(:type_id) and typecard = Card.find(value) and typecard.name.capitalize ) } end;T;+To; ; F; ;,;;;I" Card::Action#last_value_for;F;[[I" field;T0;[[@(ib;F;:last_value_for;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@(;(I"def last_value_for field;T;)T;*I"ddef last_value_for field ch = self.card.last_change_on(field, :before=>self) and ch.value end;T;+To; ; F; ;,;;;I"Card::Action#field_index;F;[[I" field;T0;[[@(if;F;:field_index;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@(;(I"def field_index field;T;)T;*I"ydef field_index field if field.is_a? Integer field else Card::TRACKED_FIELDS.index(field.to_s) end end;T;+To; ; F; ;,;;;I"Card::Action#new_value_for;F;[[I" field;T0;[[@(in;F;:new_value_for;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@(;(I"def new_value_for field;T;)T;*I"ddef new_value_for field ch = card_changes.find_by(field: field_index(field)) and ch.value end;T;+To; ; F; ;,;;;I"Card::Action#change_for;F;[[I" field;T0;[[@(ir;F;:change_for;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@(;(I"def change_for field;T;)T;*I"_def change_for field card_changes.where 'card_changes.field = ?', field_index(field) end;T;+To; ; F; ;,;;;I"Card::Action#new_type?;F;[;[[@(iv;F;:new_type?;;;[;{;IC;" ;T; @(;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @(;I";T;0;'@(;(I"def new_type?;T;)T;*I"0def new_type? new_value_for(:type_id) end;T;+To; ; F; ;,;;;I"Card::Action#new_content?;F;[;[[@(iz;F;:new_content?;;;[;{;IC;" ;T; @(;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @(;I";T;0;'@(;(I"def new_content?;T;)T;*I"6def new_content? new_value_for(:db_content) end;T;+To; ; F; ;,;;;I"Card::Action#new_name?;F;[;[[@(i~;F;:new_name?;;;[;{;IC;" ;T; @(;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @(;I";T;0;'@(;(I"def new_name?;T;)T;*I"-def new_name? new_value_for(:name) end;T;+To; ; F; ;,;;;I"Card::Action#action_type=;F;[[I" value;T0;[[@(i};F;:action_type=;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@(;(I"def action_type=(value);T;)T;*I"Sdef action_type=(value) write_attribute(:action_type, TYPE.index(value)) end;T;+To; ; F; ;,;;;I"Card::Action#action_type;F;[;[[@(i;F;:action_type;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@(;(I"def action_type;T;)T;*I"=def action_type TYPE[read_attribute(:action_type)] end;T;+To; ; F; ;,;;;I"Card::Action#set_act;F;[;[[@(i;F;: set_act;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@(;(I"def set_act;T;)T;*I"6def set_act self.set_act ||= self.acts.last end;T;+To; ; F; ;,;;;I"Card::Action#revision_nr;F;[;[[@(i;F;:revision_nr;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@(;(I"def revision_nr;T;)T;*I";def revision_nr self.card.actions.index_of(self) end;T;+To; ; F; ;,;;;I"Card::Action#red?;F;[;[[@(i;F;;;;;[;{;IC;" ;T; @+);.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @+);I";T;0;'@(;(I" def red?;T;)T;*I"-def red? content_diff_builder.red? end;T;+To; ; F; ;,;;;I"Card::Action#green?;F;[;[[@(i;F;;;;;[;{;IC;" ;T; @=);.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @=);I";T;0;'@(;(I"def green?;T;)T;*I"1def green? content_diff_builder.green? end;T;+To; ; F; ;,;;;I"Card::Action#name_diff;F;[[I" opts;TI"{};T;[[@(i;T;:name_diff;;;[;{;IC;"_def diff @diff ||= { :cardtype=>type_diff, :content=>content_diff, :name=>name_diff} end ;T;[;[;I"_def diff @diff ||= { :cardtype=>type_diff, :content=>content_diff, :name=>name_diff} end;T;0; @O);!F;"o;#;$F;%i;&i;'@(;(I"def name_diff opts={};T;)T;*I"vdef name_diff opts={} if new_name? Card::Diff.complete old_values[:name], new_values[:name], opts end end;T;+To; ; F; ;,;;;I"Card::Action#cardtype_diff;F;[[I" opts;TI"{};T;[[@(i;F;:cardtype_diff;;;[;{;IC;" ;T; @`);.0;!F;[;[;I";T;0;'@(;(I"def cardtype_diff opts={};T;)T;*I"}def cardtype_diff opts={} if new_type? Card::Diff.complete old_values[:cardtype], new_values[:cardtype], opts end end;T;+To; ; F; ;,;;;I"Card::Action#content_diff;F;[[I"diff_type;TI":expanded;T[I" opts;TI"nil;T;[[@(i;F;:content_diff;;;[;{;IC;" ;T; @p);.0;!F;[;[;I";T;0;'@(;(I"3def content_diff diff_type=:expanded, opts=nil;T;)T;*I"def content_diff diff_type=:expanded, opts=nil if new_content? if diff_type == :summary content_diff_builder(opts).summary else content_diff_builder(opts).complete end end end;T;+To; ; F; ;,;;;I"&Card::Action#content_diff_builder;F;[[I" opts;TI"nil;T;[[@(i;F;:content_diff_builder;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@(;(I"&def content_diff_builder opts=nil;T;)T;*I"def content_diff_builder opts=nil @content_diff_builder ||= begin Card::Diff::DiffBuilder.new(old_values[:content], new_values[:content], opts || card.diff_args) end end;T;+T;9@(;:IC;[;9@(;;IC;[;9@(;T;,IC;={;>T;>T;?{;@[;[[@(i ;F;: Action;;;;;[;{;IC;" ;T; @(;.0;!F;[;[;I";T;0;'@;I"Card::Action;F;Bo;C ;D0;EI"ActiveRecord::Base;T;F@;;;'o;C ;D0;E0;F0;;;'@;H@ ;O0;H0;O; ;+To; ;IC;[ o; ; F; ;,;;;I"Card::Change#field=;F;[[I" value;T0;[[I"&mod/01_history/lib/card/change.rb;Ti ;F;: field=;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@);(I"def field=(value);T;)T;*I"\def field=(value) write_attribute(:field, Card::TRACKED_FIELDS.index(value.to_s)) end;T;+To; ; F; ;,;;;I"Card::Change#field;F;[;[[@)i;F;;_;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@);(I"def field;T;)T;*I"Adef field Card::TRACKED_FIELDS[read_attribute(:field)] end;T;+To; ; F; ; ;;;I"#Card::Change.delete_actionless;F;[;[[@)i;F;;{;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@);(I"def self.delete_actionless;T;)T;*I"def self.delete_actionless Card::Change.where( "card_action_id NOT IN (?)", Card::Action.pluck("id"), ).delete_all end;T;+To; ; F; ;,;;;I"$Card::Change#find_by_field_name;F;[[I" value;T0;[[@)i;F;:find_by_field_name;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@);(I""def find_by_field_name(value);T;)T;*I"def find_by_field_name(value) index = value.is_a?(Integer) ? value : Card::TRACKED_FIELDS.index(value.to_s) find_by_field(index) end;T;+To; ; F; ; ;;;I"$Card::Change.find_by_field_name;F;[[I" value;T0;[[@)i;F;;;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@);(I"'def self.find_by_field_name(value);T;)T;*I"def self.find_by_field_name(value) index = value.is_a?(Integer) ? value : Card::TRACKED_FIELDS.index(value.to_s) find_by_field(index) end;T;+T;9@);:IC;[;9@);;IC;[;9@);T;,IC;={;>T;>T;?{;@[;[[@)i;F;: Change;;;;;[;{;IC;" ;T; @);.0;!F;[;[;I";T;0;'@;I"Card::Change;F;Bo;C ;D0;EI"ActiveRecord::Base;T;F@;;;'o;C ;D0;E0;F0;;;'@;H@ ;O0;H0;O; ;+To;;IC;[o; ; F; ;,;;;I"Card::Setting#codename;F;[;[[I"(mod/04_settings/lib/card/setting.rb;Ti[I"(mod/04_settings/lib/card/setting.rb;Ti[I"(mod/04_settings/lib/card/setting.rb;Ti;T;: codename;;;[;{;IC;"Let M = Card::Setting (module) E = Card::Set::Self::Create (module extended with M) O = Card["*create"] (object) ;T;[;[;I"Let M = Card::Setting (module) E = Card::Set::Self::Create (module extended with M) O = Card["*create"] (object);T;0; @*;!F;"o;#;$F;%i ;&i;'@*;(I"def codename;T;*I"!def codename @codename end;T;+To; ; F; ;,;;;I"Card::Setting#codename=;F;[[I" value;T0;[[@ *i[@ *i[@*i;T;:codename=;;;[;{;IC;"Let M = Card::Setting (module) E = Card::Set::Self::Create (module extended with M) O = Card["*create"] (object) ;T;[;[;@*;0; @*;!F;"@*;'@*;(I"def codename=(value);T;*I"1def codename=(value) @codename = value end;T;+To; ; F; ; ;;;I"Card::Setting.extended;F;[[I"host_class;T0;[[@ *i[@ *i[@*i;F;;;;;[;{;IC;" ;T; @(*;.0;!F;[;[ o;0 ;1I" private;F;20;0;30; @(*o;0 ;1I" private;F;20;0;30; @(*o;0 ;1I" private;F;20;0;30; @(*o;0 ;1I" private;F;20;0;30; @(*o;0 ;1I" private;F;20;0;30; @(*;I";T;0;'@*;(I"def extended(host_class);T;)T;*I"def self.extended(host_class) host_class.mattr_accessor :restricted_to_type, :rule_type_editable # accessible in E and O end;T;+To;V;[[@ *i[@ *i[@*i;F;:@@group_names;;;;;[;{;IC;" ;T; @C*;.0;!F;[;[;I";T;0;'@*;I"!Card::Setting::@@group_names;F;(I"@@group_names = {;T;*I"@@group_names = { :templating => "Templating", :permission => "Permissions", :webpage => "Webpage", :pointer => "Pointer", :editing_cue => "Editing cues", :event => "Events", :other => "Other" };T;6I"{ :templating => "Templating", :permission => "Permissions", :webpage => "Webpage", :pointer => "Pointer", :editing_cue => "Editing cues", :event => "Events", :other => "Other" };T;+To;V;[[@ *i[@ *i[@*i ;F;: @@groups;;;;;[;{;IC;" ;T; @R*;.0;!F;[;[;I";T;0;'@*;I"Card::Setting::@@groups;F;(I"Z@@groups = @@group_names.keys.each_with_object({}) { |key, groups| groups[key] = [] };T;*I"Z@@groups = @@group_names.keys.each_with_object({}) { |key, groups| groups[key] = [] };T;6I"O@@group_names.keys.each_with_object({}) { |key, groups| groups[key] = [] };T;+To;V;[[@ *i[@ *i [@*i!;F;:@@user_specific;;;;;[;{;IC;" ;T; @a*;.0;!F;[;[;I";T;0;'@*;I"#Card::Setting::@@user_specific;F;(I" @@user_specific = ::Set.new;T;*I" @@user_specific = ::Set.new;T;6I"::Set.new;T;+To; ; F; ; ;;;I"!Card::Setting.user_specific?;F;[[I" codename;T0;[[@ *i![@ *i"[@*i#;F;:user_specific?;;;[;{;IC;" ;T; @p*;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @p*;I";T;0;'@*;(I"!def user_specific?(codename);T;)T;*I"Mdef self.user_specific? codename @@user_specific.include? codename end;T;+To; ; F; ;,;;;I"Card::Setting#to_type_id;F;[[I" type;T0;[[@ *i%[@ *i&[@*i';F;:to_type_id;;;[;{;IC;" ;T; @*;.0;!F;[;[;I";T;0;'@*;(I"def to_type_id(type);T;)T;*I"Odef to_type_id type type.is_a?(Fixnum) ? type : Card::Codename[type] end;T;+To; ; F; ;,;;;I"Card::Setting#setting_opts;F;[[I" opts;T0;[[@ *i.[@ *i/[@*i0;T;:setting_opts;;;[;{;IC;"usage: setting_opts :group => :permission | :event | ... :position => (starting at 1, default: add to end) :rule_type_editable => true | false (default: false) :restricted_to_type => | [ , ...] ;T;[;[;I"usage: setting_opts :group => :permission | :event | ... :position => (starting at 1, default: add to end) :rule_type_editable => true | false (default: false) :restricted_to_type => | [ , ...];T;0; @*;!F;"o;#;$F;%i*;&i.;'@*;(I"def setting_opts(opts);T;)T;*I"def setting_opts opts group = opts[:group] || :other @@groups[group] ||= [] if opts[:position] if @@groups[group][opts[:position]-1] @@groups[group].insert(opts[:position]-1, self) else @@groups[group][opts[:position]-1] = self end else @@groups[group] << self end @codename = opts[:codename] || self.name.match(/::(\w+)$/)[1].underscore.to_sym self.rule_type_editable = opts[:rule_type_editable] self.restricted_to_type = opts[:restricted_to_type] ? ::Set.new([opts[:restricted_to_type]].flatten.map{ |cardtype| to_type_id(cardtype) }) : false if opts[:user_specific] @@user_specific << @codename end end;T;+To; ; F; ;,;;;I"&Card::Setting#applies_to_cardtype;F;[[I" type_id;T0;[[@ *iC[@ *iD[@*iE;F;:applies_to_cardtype;;;[;{;IC;" ;T; @*;.0;!F;[;[;I";T;0;'@*;(I"%def applies_to_cardtype(type_id);T;)T;*I"odef applies_to_cardtype type_id !self.restricted_to_type or self.restricted_to_type.include? type_id end;T;+T;9@*;:IC;[;9@*;;IC;[;9@*;T;,IC;={;IC;={;@*;@*;>T;>T;>T;?{;@[;[[@ *i [@ *i [@*i ;T;: Setting;;;;;[;{;IC;"TUsed to extend setting modules like Card::Set::Self::Create in the settings mod ;T;[;[;I"TUsed to extend setting modules like Card::Set::Self::Create in the settings mod;T;0; @*;!F;"o;#;$F;%i ;&i ;'@;I"Card::Setting;F;+To;;IC;[o;;IC;[ o; ; F; ;,;;;I".Card::Machine::ClassMethods#output_config;F;[;[[I"(mod/03_machines/lib/card/machine.rb;Ti!;F;:output_config;;;[;{;IC;"1Returns the value of attribute output_config ;T; @*;.0;!F;[;[;I"1Returns the value of attribute output_config;T;0;'@*;(I"def output_config;T;*I"+def output_config @output_config end;T;+To; ; F; ;,;;;I"/Card::Machine::ClassMethods#output_config=;F;[[I" value;T0;[[@*i!;F;:output_config=;;;[;{;IC;"%Sets the attribute output_config ;T; @*;.0;!F;[;[o;0 ;1I" param;F;2I"5the value to set the attribute output_config to.;T;I" value;T;30; @*;I"cSets the attribute output_config @param value the value to set the attribute output_config to.;T;0;'@*;(I"def output_config=(value);T;*I";def output_config=(value) @output_config = value end;T;+To; ; F; ;,;;;I"4Card::Machine::ClassMethods#collect_input_cards;F;[[I" &block;T0;[[@*i#;F;:collect_input_cards;;;[;{;IC;" ;T; @*;.0;!F;[;[;I";T;0;'@*;(I"#def collect_input_cards &block;T;)T;*I"Mdef collect_input_cards &block define_method :engine_input, &block end;T;+To; ; F; ;,;;;I"6Card::Machine::ClassMethods#prepare_machine_input;F;[[I" &block;T0;[[@*i';F;:prepare_machine_input;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"%def prepare_machine_input &block;T;)T;*I"Pdef prepare_machine_input &block define_method :before_engine, &block end;T;+To; ; F; ;,;;;I"/Card::Machine::ClassMethods#machine_engine;F;[[I" &block;T0;[[@*i+;F;:machine_engine;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def machine_engine &block;T;)T;*I"Bdef machine_engine &block define_method :engine, &block end;T;+To; ; F; ;,;;;I"5Card::Machine::ClassMethods#store_machine_output;F;[[I" args;TI"{};T[I" &block;T0;[[@*i/;F;:store_machine_output;;;[;{;IC;" ;T; @ +;.0;!F;[;[;I";T;0;'@*;(I"-def store_machine_output args={}, &block;T;)T;*I"def store_machine_output args={}, &block output_config.merge!(args) if block_given? define_method :after_engine, &block end end;T;+T;9@*;:IC;[;9@*;;IC;[;9@*;T;,IC;={;IC;={;@*;@*;>T;>T;>T;?{;@[;[[@*i ;F;;B;;;;;[;{;IC;" ;T; @*;.0;!F;[;[;I";T;0;'@*;I" Card::Machine::ClassMethods;F;+To; ; F; ; ;;;I"Card::Machine.included;F;[[I"host_class;T0;[[@*i7;F;: included;;;[;{;IC;" ;T; @C+;.0;!F;[;[o;0 ;1I" private;F;20;0;30; @C+;I";T;0;'@*;(I""def self.included(host_class);T;)T;*I"def self.included(host_class) host_class.extend( ClassMethods ) host_class.output_config = { :filetype => "txt" } if Codename[:machine_output] # for compatibility with old migrations host_class.card_accessor :machine_output, :type=>:file host_class.card_accessor :machine_input, :type => :pointer # define default machine behaviour host_class.collect_input_cards do # traverse through all levels of pointers and # collect all item cards as input items = [self] new_input = [] already_extended = {} # avoid loops loop_limit = 5 while items.size > 0 item = items.shift if item.trash or ( already_extended[item.id] and already_extended[item.id] > loop_limit) next elsif item.item_cards == [item] # no pointer card new_input << item else items.insert(0, item.item_cards) items.flatten! new_input << item if item != self already_extended[item] = already_extended[item] ? already_extended[item] + 1 : 1 end end new_input end host_class.prepare_machine_input {} host_class.machine_engine { |input| input } host_class.store_machine_output do |output| file = Tempfile.new [ id, ".#{host_class.output_config[:filetype]}" ] file.write output file.rewind Card::Auth.as_bot do p = machine_output_card p.attach = file p.save! end file.close file.unlink end host_class.format do view :machine_output_url do |args| machine_output_url end end host_class.event "reset_machine_output_#{host_class.name.gsub(':','_')}".to_sym, :after => :store_subcards, :on => :save do reset_machine_output! end end end;T;+To; ; F; ;,;;;I"Card::Machine#run_machine;F;[[I" joint;TI" "\n";T;[[@*it;F;:run_machine;;;[;{;IC;" ;T; @T+;.0;!F;[;[;I";T;0;'@*;(I"def run_machine joint="\n";T;)T;*I"adef run_machine joint="\n" before_engine output = input_item_cards.map do |input| unless input.kind_of? Card::Set::Type::Pointer if input.respond_to? :machine_input engine( input.machine_input ) else engine( input.format._render_raw ) end end end.select(&:present?).join( joint ) after_engine output end;T;+To; ; F; ;,;;;I"(Card::Machine#reset_machine_output!;F;[;[[@*i};F;:reset_machine_output!;;;[;{;IC;" ;T; @d+;.0;!F;[;[;I";T;0;'@*;(I"def reset_machine_output!;T;)T;*I"def reset_machine_output! Auth.as_bot do moc = machine_output_card and moc.real? and moc.delete! #mic = machine_input_card and mic.real? and mic.delete! update_input_card end end;T;+To; ; F; ;,;;;I"(Card::Machine#update_machine_output;F;[;[[@*i;F;:update_machine_output;;;[;{;IC;" ;T; @q+;.0;!F;[;[;I";T;0;'@*;(I"def update_machine_output;T;)T;*I"def update_machine_output if ok? :read and not was_already_locked = locked? Auth.as_bot do lock! update_input_card run_machine end end ensure unlock! unless was_already_locked end;T;+To; ; F; ;,;;;I"!Card::Machine#lock_cache_key;F;[;[[@*i;F;:lock_cache_key;;;[;{;IC;" ;T; @~+;.0;!F;[;[;I";T;0;'@*;(I"def lock_cache_key;T;)T;*I"2def lock_cache_key "UPDATE-LOCK:#{key}" end;T;+To; ; F; ;,;;;I"Card::Machine#locked?;F;[;[[@*i;F;: locked?;;;[;{;IC;" ;T; @+;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @+;I";T;0;'@*;(I"def locked?;T;)T;*I"5def locked? Card.cache.read lock_cache_key end;T;+To; ; F; ;,;;;I"Card::Machine#lock!;F;[;[[@*i;F;: lock!;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def lock!;T;)T;*I":def lock! Card.cache.write lock_cache_key, true end;T;+To; ; F; ;,;;;I"Card::Machine#unlock!;F;[;[[@*i;F;: unlock!;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def unlock!;T;)T;*I"=def unlock! Card.cache.write lock_cache_key, false end;T;+To; ; F; ;,;;;I"$Card::Machine#update_input_card;F;[;[[@*i;F;:update_input_card;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def update_input_card;T;)T;*I"Hdef update_input_card machine_input_card.items = engine_input end;T;+To; ; F; ;,;;;I"#Card::Machine#input_item_cards;F;[;[[@*i;F;:input_item_cards;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def input_item_cards;T;)T;*I"=def input_item_cards machine_input_card.item_cards end;T;+To; ; F; ;,;;;I"%Card::Machine#machine_output_url;F;[;[[@*i;F;:machine_output_url;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def machine_output_url;T;)T;*I"def machine_output_url ensure_machine_output machine_output_card.attach.url #(:default, :timestamp => false) # to get rid of additional number in url end;T;+To; ; F; ;,;;;I"&Card::Machine#machine_output_path;F;[;[[@*i;F;:machine_output_path;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def machine_output_path;T;)T;*I"Zdef machine_output_path ensure_machine_output machine_output_card.attach.path end;T;+To; ; F; ;,;;;I"(Card::Machine#ensure_machine_output;F;[;[[@*i;F;:ensure_machine_output;;;[;{;IC;" ;T; @+;.0;!F;[;[;I";T;0;'@*;(I"def ensure_machine_output;T;)T;*I"def ensure_machine_output if !output = fetch(:trait => :machine_output) or !output.selected_content_action_id update_machine_output end end;T;+T;9@*;:IC;[;9@*;;IC;[;9@*;T;,IC;={;>T;>T;?{;@[;[[@*i;F;: Machine;;;;;[;{;IC;" ;T; @*;.0;!F;[;[;I";T;0;'@;I"Card::Machine;F;+To;;IC;[o;V;[[I"+mod/05_email/lib/card/follow_option.rb;Ti;F;:@@options;;;;;[;{;IC;" ;T; @ ,;.0;!F;[;[;I";T;0;'@,;I""Card::FollowOption::@@options;F;(I":@@options = { :all=>[], :main=>[], :restrictive=>[] };T;*I":@@options = { :all=>[], :main=>[], :restrictive=>[] };T;6I".{ :all=>[], :main=>[], :restrictive=>[] };T;+To; ; F; ; ;;;I" Card::FollowOption.included;F;[[I"host_class;T0;[[@ ,i;F;;;;;[;{;IC;" ;T; @,;.0;!F;[;[o;0 ;1I" private;F;20;0;30; @,;I";T;0;'@,;(I""def self.included(host_class);T;)T;*I"Mdef self.included(host_class) host_class.extend ClassMethods end;T;+To; ; F; ; ;;;I"!Card::FollowOption.codenames;F;[[I" type;TI" :all;T;[[@ ,i;F;:codenames;;;[;{;IC;" ;T; @),;.0;!F;[;[;I";T;0;'@,;(I"!def self.codenames type=:all;T;)T;*I"7def self.codenames type=:all @@options[type] end;T;+To; ; F; ; ;;;I"Card::FollowOption.cards;F;[;[[@ ,i;F;: cards;;;[;{;IC;" ;T; @9,;.0;!F;[;[;I";T;0;'@,;(I"def self.cards;T;)T;*I"Fdef self.cards codenames.map { |codename| Card[codename] } end;T;+To; ; F; ; ;;;I"+Card::FollowOption.restrictive_options;F;[;[[@ ,i;F;:restrictive_options;;;[;{;IC;" ;T; @F,;.0;!F;[;[;I";T;0;'@,;(I"!def self.restrictive_options;T;)T;*I"Cdef self.restrictive_options self.codenames :restrictive end;T;+To; ; F; ; ;;;I"$Card::FollowOption.main_options;F;[;[[@ ,i ;F;:main_options;;;[;{;IC;" ;T; @S,;.0;!F;[;[;I";T;0;'@,;(I"def self.main_options;T;)T;*I"5def self.main_options self.codenames :main end;T;+To; ; F; ;,;;;I"+Card::FollowOption#restrictive_option?;F;[;[[@ ,i$;F;:restrictive_option?;;;[;{;IC;" ;T; @`,;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @`,;I";T;0;'@,;(I"def restrictive_option?;T;)T;*I"[def restrictive_option? Card::FollowOption.restrictive_options.include? codename end;T;+To; ; F; ;,;;;I"#Card::FollowOption#description;F;[[I" set_card;T0;[[@ ,i(;F;:description;;;[;{;IC;" ;T; @r,;.0;!F;[;[;I";T;0;'@,;(I"def description set_card;T;)T;*I"9def description set_card set_card.follow_label end;T;+To;;IC;[ o; ; F; ;,;;;I"=Card::FollowOption::ClassMethods#restrictive_follow_opts;F;[[I" args;T0;[[@ ,i0;T;:restrictive_follow_opts;;;[;{;IC;"Eargs: :position => (starting at 1, default: add to end) ;T;[;[;I"Eargs: :position => (starting at 1, default: add to end);T;0; @,;!F;"o;#;$F;%i.;&i/;'@,;(I"%def restrictive_follow_opts args;T;)T;*I"Idef restrictive_follow_opts args add_option args, :restrictive end;T;+To; ; F; ;,;;;I"1Card::FollowOption::ClassMethods#follow_opts;F;[[I" args;T0;[[@ ,i6;T;:follow_opts;;;[;{;IC;"Eargs: :position => (starting at 1, default: add to end) ;T;[;[;I"Eargs: :position => (starting at 1, default: add to end);T;0; @,;!F;"o;#;$F;%i4;&i5;'@,;(I"def follow_opts args;T;)T;*I"6def follow_opts args add_option args, :main end;T;+To; ; F; ;,;;;I"1Card::FollowOption::ClassMethods#follow_test;F;[[I" opts;TI"{};T[I" &block;T0;[[@ ,i:;F;:follow_test;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@,;(I"$def follow_test opts={}, &block;T;)T;*I"`def follow_test opts={}, &block Card::FollowOption.test[ get_codename(opts) ] = block end;T;+To; ; F; ;,;;;I";F;:follower_candidate_ids;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@,;(I"/def follower_candidate_ids opts={}, &block;T;)T;*I"}def follower_candidate_ids opts={}, &block Card::FollowOption.follower_candidate_ids[ get_codename(opts) ] = block end;T;+To; ; F; ;,;;b;I"3Card::FollowOption::ClassMethods#insert_option;F;[[I"pos;T0[I" item;T0[I" type;T0;[[@ ,iD;F;:insert_option;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@,;(I"&def insert_option pos, item, type;T;)T;*I"def insert_option pos, item, type if Card::FollowOption.codenames(type)[pos] Card::FollowOption.codenames(type).insert(pos, item) else # If pos > codenames.size in a previous insert then we have a bunch of preceding nils in the array. # Hence, we have to overwrite a nil value if we encounter one and can't use insert. Card::FollowOption.codenames(type)[pos] = item end end;T;+To; ; F; ;,;;b;I"0Card::FollowOption::ClassMethods#add_option;F;[[I" opts;T0[I" type;T0[I" &block;T0;[[@ ,iN;F;:add_option;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@,;(I"&def add_option opts, type, &block;T;)T;*I"def add_option opts, type, &block codename = get_codename opts if opts[:position] insert_option opts[:position]-1, codename, type else Card::FollowOption.codenames(type) << codename end Card::FollowOption.codenames(:all) << codename end;T;+To; ; F; ;,;;b;I"2Card::FollowOption::ClassMethods#get_codename;F;[[I" opts;T0;[[@ ,iX;F;:get_codename;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@,;(I"def get_codename opts;T;)T;*I"ddef get_codename opts opts[:codename] || self.name.match(/::(\w+)$/)[1].underscore.to_sym end;T;+T;9@,;:IC;[;9@,;;IC;[;9@,;T;,IC;={;>T;>T;?{;@[;[[@ ,i,;F;;B;;;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@,;I"%Card::FollowOption::ClassMethods;F;+T;9@,;:IC;[;9@,;;IC;[;9@,;T;,IC;={;>T;>T;?{;@[;[[@ ,i ;F;:FollowOption;;;;;[;{;IC;" ;T; @,;.0;!F;[;[;I";T;0;'@;I"Card::FollowOption;F;+To;;IC;[o;;IC;[ o; ; F; ;,;;;I"2Card::MachineInput::ClassMethods#machines_wql;F;[;[[I".mod/03_machines/lib/card/machine_input.rb;Ti ;F;:machines_wql;;;[;{;IC;"0Returns the value of attribute machines_wql ;T; @ -;.0;!F;[;[;I"0Returns the value of attribute machines_wql;T;0;'@-;(I"def machines_wql;T;*I")def machines_wql @machines_wql end;T;+To; ; F; ;,;;;I"3Card::MachineInput::ClassMethods#machines_wql=;F;[[I" value;T0;[[@%-i ;F;:machines_wql=;;;[;{;IC;"$Sets the attribute machines_wql ;T; @.-;.0;!F;[;[o;0 ;1I" param;F;2I"4the value to set the attribute machines_wql to.;T;I" value;T;30; @.-;I"aSets the attribute machines_wql @param value the value to set the attribute machines_wql to.;T;0;'@-;(I"def machines_wql=(value);T;*I"9def machines_wql=(value) @machines_wql = value end;T;+To; ; F; ;,;;;I"7Card::MachineInput::ClassMethods#machine_input_for;F;[[I" args;T0;[[@%-i ;F;:machine_input_for;;;[;{;IC;" ;T; @A-;.0;!F;[;[;I";T;0;'@-;(I"def machine_input_for args;T;)T;*I":def machine_input_for args @machines_wql = args end;T;+To; ; F; ;,;;;I"3Card::MachineInput::ClassMethods#machine_input;F;[[I" &block;T0;[[@%-i;F;:machine_input;;;[;{;IC;" ;T; @P-;.0;!F;[;[;I";T;0;'@-;(I"def machine_input &block;T;)T;*I"Gdef machine_input &block define_method :machine_input, block end;T;+T;9@-;:IC;[;9@-;;IC;[;9@-;T;,IC;={;IC;={;@ -;@.-;>T;>T;>T;?{;@[;[[@%-i;F;;B;;;;;[;{;IC;" ;T; @-;.0;!F;[;[;I";T;0;'@-;I"%Card::MachineInput::ClassMethods;F;+To; ; F; ; ;;;I" Card::MachineInput.included;F;[[I"host_class;T0;[[@%-i;F;;;;;[;{;IC;" ;T; @p-;.0;!F;[;[o;0 ;1I" private;F;20;0;30; @p-;I";T;0;'@-;(I"!def self.included host_class;T;)T;*I" def self.included host_class host_class.extend( ClassMethods ) host_class.machines_wql = {} host_class.machine_input do format._render_raw end host_class.event "after_machine_input_updated_#{host_class.name.gsub(':','_')}".to_sym, :after=>:extend, :on => :save do machines = Card.search( {:right_plus => [{:codename => "machine_input"}, {:link_to => name}]}.merge(host_class.machines_wql) ) machines.each do |item| item.reset_machine_output! if item.kind_of? Machine end end host_class.event "before_machine_input_deleted_#{host_class.name.gsub(':','_')}".to_sym, :after=>:approve, :on => :delete do @involved_machines = Card.search( {:right_plus => [{:codename => "machine_input"}, {:link_to => name}]}.merge(host_class.machines_wql) ) end host_class.event "after_machine_input_deleted_#{host_class.name.gsub(':','_')}".to_sym, :after=>:store_subcards, :on => :delete do @involved_machines.each do |item| item.reset_machine_output! if item.kind_of? Machine end end end;T;+T;9@-;:IC;[;9@-;;IC;[;9@-;T;,IC;={;>T;>T;?{;@[;[[@%-i;F;:MachineInput;;;;;[;{;IC;" ;T; @-;.0;!F;[;[;I";T;0;'@;I"Card::MachineInput;F;+T;9@;:IC;[;9@;;IC;[;9@;T;,IC;={;-IC;={;@;@.;>T;>T;>T;?{;@[;[%[@i[@[i[@i[@}i[@i[@c i [@i[@!i [@Bi[@i [@i [@i [@i [@i [@!i[@"i[@U#i [@ %i[@i[@p'i[@(i[@)i[@ *i [@*i[@ ,i [@#i [@%-i[@#i [@#i [I"(mod/04_settings/lib/card/setting.rb;Ti [@i[@i;T;;;;;;;[;{;IC;"This documentation is intended for developers who want to understand: a. how ruby Card objects work, and b. how to extend them. It assumes that you've already read the introductory text in {file:README_Developers.rdoc}. ;T;[;[;I"This documentation is intended for developers who want to understand: a. how ruby Card objects work, and b. how to extend them. It assumes that you've already read the introductory text in {file:README_Developers.rdoc}. ;T;0; @;!F;"o;#;$F;%i ;&i;'@;I" Card;F;Bo;C ;D0;EI"ActiveRecord::Base;T;F@;;;'o;C ;D0;E0;F0;;;'@;H@ ;O0;H0;O; o;;IC;[o;4;[[I"lib/cardio.rb;Ti ;F;:CARD_GEM_ROOT;;;;;[;{;IC;" ;T; @-;.0;!F;[;[;I";T;0;'@-;I"Cardio::CARD_GEM_ROOT;F;(I"8CARD_GEM_ROOT = File.expand_path('../..', __FILE__);T;*I"8CARD_GEM_ROOT = File.expand_path('../..', __FILE__);T;6I"(File.expand_path('../..', __FILE__);T;+To; ; F; ; ;;;I"Cardio.cache;F;[;[[@-i;F;;;;;[;{;IC;" ;T; @-;.0;!F;[;[;I";T;0;'@-;(I"def cache;T;)T;*I".def cache @@cache ||= ::Rails.cache end;T;+To; ; F; ; ;;;I"Cardio.set_config;F;[[I" config;T0;[[@-i;F;:set_config;;;[;{;IC;" ;T; @-;.0;!F;[;[;I";T;0;'@-;(I"def set_config config;T;)T;*I",def set_config config @@config, @@root = config, config.root config.autoload_paths += Dir["#{gem_root}/mod/*/lib/**/"] config.autoload_paths += Dir["#{gem_root}/lib/**/"] config.autoload_paths += Dir["#{root}/mod/*/lib/**/"] set_default_value config, :read_only, !!ENV['WAGN_READ_ONLY'] set_default_value config, :allow_inline_styles, false set_default_value config, :recaptcha_public_key, nil set_default_value config, :recaptcha_private_key, nil set_default_value config, :recaptcha_proxy, nil set_default_value config, :cache_store, :file_store, 'tmp/cache' set_default_value config, :override_host, nil set_default_value config, :override_protocol, nil set_default_value config, :no_authentication, false set_default_value config, :files_web_path, 'files' set_default_value config, :max_char_count, 200 set_default_value config, :max_depth, 20 set_default_value config, :email_defaults, nil set_default_value config, :token_expiry, 2.days set_default_value config, :revisions_per_page, 10 set_default_value config, :space_last_in_multispace, true set_default_value config, :closed_search_limit, 50 set_default_value config, :view_cache, false end;T;+To; ; F; ; ;;;I"Cardio.set_default_value;F;[[I" config;T0[I" setting;T0[I" *value;T0;[[@-iB;T;:set_default_value;;;[;{;IC;"In production mode set_config gets called twice. The second call overrides all deck config settings so don't change settings here if they already exist ;T;[;[;I"In production mode set_config gets called twice. The second call overrides all deck config settings so don't change settings here if they already exist;T;0; @-;!F;"o;#;$F;%i?;&iA;'@-;(I"2def set_default_value config, setting, *value;T;)T;*I"}def set_default_value config, setting, *value config.send("#{setting}=", *value) unless config.respond_to? setting end;T;+To; ; F; ; ;;;I"Cardio.set_paths;F;[[I" paths;T0;[[@-iG;F;:set_paths;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@-;(I"def set_paths paths;T;)T;*I"def set_paths paths @@paths = paths add_path 'tmp/set', :root => root add_path 'tmp/set_pattern', :root => root add_path 'mod' add_path "db" add_path 'db/migrate' add_path "db/migrate_core_cards" add_path "db/migrate_deck_cards", :root => root, :with => 'db/migrate_cards' add_path "db/seeds", :with => "db/seeds.rb" add_path 'config/initializers', :glob => '**/*.rb' paths['config/initializers'] << "#{gem_root}/mod/**{,/*/**}/initializers" paths['config/initializers'] << "#{root}/mod/**{,/*/**}/initializers" end;T;+To; ; F; ; ;;;I"Cardio.root;F;[;[[@-iX;F;;;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@-;(I" def root;T;)T;*I"!def root @@config.root end;T;+To; ; F; ; ;;;I"Cardio.gem_root;F;[;[[@-i\;F;: gem_root;;;[;{;IC;" ;T; @".;.0;!F;[;[;I";T;0;'@-;(I"def gem_root;T;)T;*I"%def gem_root CARD_GEM_ROOT end;T;+To; ; F; ; ;;;I"Cardio.add_path;F;[[I" path;T0[I" options;TI"{};T;[[@-i`;F;: add_path;;;[;{;IC;" ;T; @/.;.0;!F;[;[;I";T;0;'@-;(I""def add_path path, options={};T;)T;*I"def add_path path, options={} root = options.delete(:root) || gem_root options[:with] = File.join(root, (options[:with] || path) ) paths.add path, options end;T;+To; ; F; ; ;;;I"Cardio.future_stamp;F;[;[[@-if;F;:future_stamp;;;[;{;IC;" ;T; @A.;.0;!F;[;[;I";T;0;'@-;(I"def future_stamp;T;)T;*I"_def future_stamp ## used in test data @@future_stamp ||= Time.local 2020,1,1,0,0,0 end;T;+To; ; F; ; ;;;I"Cardio.migration_paths;F;[[I" type;T0;[[@-ik;F;; ;;;[;{;IC;" ;T; @N.;.0;!F;[;[;I";T;0;'@-;(I"def migration_paths type;T;)T;*I"def migration_paths type list = paths["db/migrate#{schema_suffix type}"].to_a if type == :deck_cards list += Card::Loader.mod_dirs.map do |p| Dir.glob "#{p}/db/migrate_cards" end.flatten end list end;T;+To; ; F; ; ;;;I"(Cardio.assume_migrated_upto_version;F;[[I" type;T0;[[@-iu;F;;;;;[;{;IC;" ;T; @].;.0;!F;[;[;I";T;0;'@-;(I"*def assume_migrated_upto_version type;T;)T;*I"def assume_migrated_upto_version type Cardio.schema_mode(type) do ActiveRecord::Schema.assume_migrated_upto_version Cardio.schema(type), Cardio.migration_paths(type) end end;T;+To; ; F; ; ;;;I"Cardio.schema_suffix;F;[[I" type;T0;[[@-i{;F;; ;;;[;{;IC;" ;T; @l.;.0;!F;[;[;I";T;0;'@-;(I"def schema_suffix type;T;)T;*I"def schema_suffix type case type when :core_cards then '_core_cards' when :deck_cards then '_deck_cards' else '' end end;T;+To; ; F; ; ;;;I"Cardio.delete_tmp_files;F;[[I"id;TI"nil;T;[[@-i~;F;:delete_tmp_files;;;[;{;IC;" ;T; @{.;.0;!F;[;[;I";T;0;'@-;(I" def delete_tmp_files id=nil;T;)T;*I"def delete_tmp_files id=nil dir = Cardio.paths['files'].existent.first + '/tmp' dir += "/#{id}" if id FileUtils.rm_rf dir, :secure=>true rescue Rails.logger.info "failed to remove tmp files" end;T;+To; ; F; ; ;;;I"Cardio.schema_mode;F;[[I" type;T0;[[@-i;F;;;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@-;(I"def schema_mode type;T;)T;*I"Qdef schema_mode type new_suffix = Cardio.schema_suffix type original_suffix = ActiveRecord::Base.table_name_suffix ActiveRecord::Base.table_name_suffix = new_suffix ActiveRecord::SchemaMigration.reset_table_name yield ActiveRecord::Base.table_name_suffix = original_suffix ActiveRecord::SchemaMigration.reset_table_name end;T;+To; ; F; ; ;;;I"Cardio.schema;F;[[I" type;TI"nil;T;[[@-i;F;; ;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@-;(I"def schema type=nil;T;)T;*I"Hdef schema type=nil File.read( schema_stamp_path type ).strip end;T;+To; ; F; ; ;;;I"Cardio.schema_stamp_path;F;[[I" type;T0;[[@-i;F;:schema_stamp_path;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@-;(I"def schema_stamp_path type;T;)T;*I"def schema_stamp_path type root_dir = ( type == :deck_cards ? root : gem_root ) stamp_dir = ENV['SCHEMA_STAMP_PATH'] || File.join( root_dir, 'db' ) File.join stamp_dir, "version#{ schema_suffix(type) }.txt" end;T;+T;9@-;:IC;[;9@-;;IC;[;9@-;T;,IC;={;>T;>T;?{;@[;[[@-i ;F;: Cardio;;;;;[;{;IC;" ;T; @-;.0;!F;[;[;I";T;0;'@;I" Cardio;F@o; ;IC;[o;4;[[@i1;F;:RUBY_VERSION_18;;;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@.;I"Module::RUBY_VERSION_18;F;(I"2RUBY_VERSION_18 = !!(RUBY_VERSION =~ /^1\.8/);T;*I"2RUBY_VERSION_18 = !!(RUBY_VERSION =~ /^1\.8/);T;6I" !!(RUBY_VERSION =~ /^1\.8/);T;+To; ; F; ;,;;;I" Module#const_get_if_defined;F;[[I" const;T0;[[@i3;F;:const_get_if_defined;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@.;(I"#def const_get_if_defined const;T;)T;*I"def const_get_if_defined const args = RUBY_VERSION_18 ? [ const ] : [ const, false ] if const_defined? *args const_get *args end end;T;+To; ; F; ;,;;;I"Module#const_get_or_set;F;[[I" const;T0;[[@i:;F;:const_get_or_set;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@.;(I"def const_get_or_set const;T;)T;*I"Zdef const_get_or_set const const_get_if_defined const or const_set const, yield end;T;+T;9@.;:IC;[;9@.;;IC;[;9@.;T;,IC;={;>T;>T;?{;@[;[[@i0;F;: Module;;;;;[;{;IC;" ;T; @.;.0;!F;[;[;I";T;0;'@;I" Module;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0o; ;IC;[o; ; F; ; ;;;I"&Hash.new_from_semicolon_attr_list;F;[[I"attr_string;T0;[[@iD;F;:!new_from_semicolon_attr_list;;;[;{;IC;" ;T; @ /;.0;!F;[;[;I";T;0;'@/;(I"2def new_from_semicolon_attr_list(attr_string);T;)T;*I"def new_from_semicolon_attr_list(attr_string) return {} if attr_string.blank? attr_string.strip.split(';').inject({}) do |result, pair| value, key = pair.split(':').reverse key ||= 'view' key.strip!; value.strip! result[key.to_sym] = value result end end;T;+T;9@/;:IC;[;9@/;;IC;[;9@/;T;,IC;={;>T;>T;?{;@[;[[@iA;F;: Hash;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;I" Hash;F;Bo;C ;D0;E0;F0;;G;'@;H@;O0o;;IC;[;9@)/;:IC;[;9@)/;;IC;[;9@)/;T;,IC;={;>T;>T;?{;@[;[[@9$i;F;;\;;;;;[;{;IC;" ;T; @)/;.0;!F;[;[;I";T;0;'@;I"SpecHelper;Fo;4;[[I" spec/lib/card/query_spec.rb;Ti;F;:A_JOINEES;;;;;[;{;IC;" ;T; @;/;.0;!F;[;[;I";T;0;'@;I"A_JOINEES;F;(I"*A_JOINEES = ["B", "C", "D", "E", "F"];T;*I"*A_JOINEES = ["B", "C", "D", "E", "F"];T;6I"["B", "C", "D", "E", "F"];To;4;[[@>/i ;F;:CARDS_MATCHING_TWO;;;;;[;{;IC;" ;T; @I/;.0;!F;[;[;I";T;0;'@;I"CARDS_MATCHING_TWO;F;(I"KCARDS_MATCHING_TWO = ["Two","One+Two","One+Two+Three","Joe User"].sort;T;*I"KCARDS_MATCHING_TWO = ["Two","One+Two","One+Two+Three","Joe User"].sort;T;6I"6["Two","One+Two","One+Two+Three","Joe User"].sort;To; ; F; ;,;;;I"#is_in_mod?;T;[[I" file;T0[I" mod_path;T0;[[I"!lib/card/simplecov_helper.rb;Ti;F;:is_in_mod?;;;[;{;IC;" ;T; @V/;.0;!F;[;[o;0 ;1I" return;F;2I";T;0;3[I" Boolean;T; @V/;I";T;0;'@;(I"!def is_in_mod? file,mod_path;T;)T;*I"def is_in_mod? file,mod_path mod_msg = "below pulled from #{Rails.root}/mod/#{mod_path}/" file.src.join("") =~ /#{mod_msg}/ end;To; ; F; ;,;;;I"#card_simplecov_filters;T;[;[[@_/i ;F;:card_simplecov_filters;;;[;{;IC;" ;T; @m/;.0;!F;[;[;I";T;0;'@;(I"def card_simplecov_filters;T;)T;*I"def card_simplecov_filters add_filter 'spec/' add_filter '/config/' add_filter '/tasks/' # filter all card mods add_filter do |src_file| src_file.filename =~ /tmp\// and not /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1].gsub("-","/")}"].present? } end # add group for each deck mod Dir['mod/*'].map{ |path| path.sub('mod/','') }.each do |mod| add_group mod.capitalize do |src_file| src_file.filename =~ /mod\/#{mod}\// or ( src_file.filename =~ /tmp\// and /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/#{mod}/**/#{m[1].gsub("-","/")}"].present? } and is_in_mod? src_file,mod ) end end add_group 'Sets' do |src_file| src_file.filename =~ /tmp\/set\// and /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1]}"].present? } end add_group 'Set patterns' do |src_file| src_file.filename =~ /tmp\/set_pattern\// and /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1]}"].present? } end add_group 'Formats' do |src_file| src_file.filename =~ /mod\/[^\/]+\/formats/ end add_group 'Chunks' do |src_file| src_file.filename =~ /mod\/[^\/]+\/chunks/ end end;To; ; F; ;,;;;I"%#card_core_dev_simplecov_filters;T;[;[[@_/i1;F;:$card_core_dev_simplecov_filters;;;[;{;IC;" ;T; @z/;.0;!F;[;[;I";T;0;'@;(I"(def card_core_dev_simplecov_filters;T;)T;*I"def card_core_dev_simplecov_filters filters.clear # This will remove the :root_filter that comes via simplecov's defaults add_filter do |src| !(src.filename =~ /^#{SimpleCov.root}/) unless src.filename =~ /card/ end add_filter '/spec/' add_filter '/features/' add_filter '/config/' add_filter '/tasks/' add_filter '/generators/' add_filter 'lib/card' add_group 'Card', 'lib/card' add_group 'Set Patterns', 'tmp/set_pattern/' add_group 'Sets', 'tmp/set/' add_group 'Formats' do |src_file| src_file.filename =~ /mod\/[^\/]+\/format/ end add_group 'Chunks' do |src_file| src_file.filename =~ /mod\/[^\/]+\/chunk/ end end;To;4;[[I""spec/lib/card/content_spec.rb;Ti ;F;: CONTENT;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;I" CONTENT;F;(I"CONTENT = {;T;*I"uCONTENT = { :one => %(Some Literals: \\[{I'm not| a link]}, and \\{{This Card|Is not Included}}, but {{this is}}, and some tail), #:two => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}} # more formats for links and includes: [the card][the text], # and [[http://external.wagn.org/path|link text]][This Card][Is linked]{{Included|open}}), :two => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}} and [[http://external.wagn.org/path|link text]]{{Included|open}}), :three =>%(Some URIs and Links: http://a.url.com/ More urls: wagn.com/a/path/to.html http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]] [ http://gerry.wagn.com/a/path ] { https://brain.org/more?args }), :three_b => %(Some URIs and Links: http://a.url.com More urls: wagn.com/a/path/to.html [ http://gerry.wagn.com/a/path ] { https://brain.org/more?args } http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]]), :four => "No chunks", :five => "{{one inclusion|size;large}}", :six => %~ /* body text */ body { color: #444444; } /* page - background image and color */ body#wagn { background: #ffffff; } /* top bar background color; text colors */ #menu { background: #3260a0; } #menu a { color: #EEEEEE; } /* header text */ h1, h2 { color: #664444; } h1.page-header, h2.page-header { color: #222299; } ~ };T;6I"k{ :one => %(Some Literals: \\[{I'm not| a link]}, and \\{{This Card|Is not Included}}, but {{this is}}, and some tail), #:two => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}} # more formats for links and includes: [the card][the text], # and [[http://external.wagn.org/path|link text]][This Card][Is linked]{{Included|open}}), :two => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}} and [[http://external.wagn.org/path|link text]]{{Included|open}}), :three =>%(Some URIs and Links: http://a.url.com/ More urls: wagn.com/a/path/to.html http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]] [ http://gerry.wagn.com/a/path ] { https://brain.org/more?args }), :three_b => %(Some URIs and Links: http://a.url.com More urls: wagn.com/a/path/to.html [ http://gerry.wagn.com/a/path ] { https://brain.org/more?args } http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]]), :four => "No chunks", :five => "{{one inclusion|size;large}}", :six => %~ /* body text */ body { color: #444444; } /* page - background image and color */ body#wagn { background: #ffffff; } /* top bar background color; text colors */ #menu { background: #3260a0; } #menu a { color: #EEEEEE; } /* header text */ h1, h2 { color: #664444; } h1.page-header, h2.page-header { color: #222299; } ~ };To;4;[[@/i;;F;: CLASSES;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;I" CLASSES;F;(I"CLASSES = {;T;*I"&CLASSES = { :one => [String, :EscapedLiteral, String, :Include, String ], # :two => [String, Chunk::Link, String, Chunk::Include, Chunk::Include, String, Chunk::Link, String, Chunk::Link, Chunk::Link, Chunk::Include ], :two => [String, :Link, String, :Include, :Include, String, :Link, :Include ], :three => [String, :URI, String, :HostURI, String, :URI, String, :Link, String, :URI, String, :URI, String ], :three_b => [String, :URI, String, :HostURI, String, :URI, String, :URI, String, :URI, String, :Link ], :five => [:Include] };T;6I"{ :one => [String, :EscapedLiteral, String, :Include, String ], # :two => [String, Chunk::Link, String, Chunk::Include, Chunk::Include, String, Chunk::Link, String, Chunk::Link, Chunk::Link, Chunk::Include ], :two => [String, :Link, String, :Include, :Include, String, :Link, :Include ], :three => [String, :URI, String, :HostURI, String, :URI, String, :Link, String, :URI, String, :URI, String ], :three_b => [String, :URI, String, :HostURI, String, :URI, String, :URI, String, :URI, String, :Link ], :five => [:Include] };To;4;[[@/iJ;F;: RENDERED;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;I" RENDERED;F;(I"RENDERED = {;T;*I"RENDERED = { :one => [ "Some Literals: \\[{I'm not| a link]}, and ", "{{This Card|Is not Included}}", ", but ", {:options => {:inc_name=>"this is",:inc_syntax=>"this is"}}, ", and some tail" ], :two => [ "Some Links and includes: ", "the text", ", and ", { :options => { :view => "Is Included", :inc_name=>"This Card", :inc_syntax => "This Card|Is Included"}}, { :options => { :inc_name=>"this too", :inc_syntax=>"this too"}}, "\n and ", "link text", { :options => { :view=>"open", :inc_name=>"Included", :inc_syntax=>"Included|open" }} ], :three => [ "Some URIs and Links: ", 'http://a.url.com/', "\n More urls: ", "wagn.com/a/path/to.html", "\n ", "http://localhost:2020/path?cgi=foo&bar=baz", " ", "extra", "\n [ ", "http://gerry.wagn.com/a/path", " ]\n { ", "https://brain.org/more?args", " }" ], :three_b => [ "Some URIs and Links: ","http://a.url.com", "\n More urls: ", "wagn.com/a/path/to.html", "\n [ ", "http://gerry.wagn.com/a/path", " ]\n { ", "https://brain.org/more?args", " }\n ", "http://localhost:2020/path?cgi=foo&bar=baz", " ", "extra" ], :four => "No chunks" };T;6I"{ :one => [ "Some Literals: \\[{I'm not| a link]}, and ", "{{This Card|Is not Included}}", ", but ", {:options => {:inc_name=>"this is",:inc_syntax=>"this is"}}, ", and some tail" ], :two => [ "Some Links and includes: ", "the text", ", and ", { :options => { :view => "Is Included", :inc_name=>"This Card", :inc_syntax => "This Card|Is Included"}}, { :options => { :inc_name=>"this too", :inc_syntax=>"this too"}}, "\n and ", "link text", { :options => { :view=>"open", :inc_name=>"Included", :inc_syntax=>"Included|open" }} ], :three => [ "Some URIs and Links: ", 'http://a.url.com/', "\n More urls: ", "wagn.com/a/path/to.html", "\n ", "http://localhost:2020/path?cgi=foo&bar=baz", " ", "extra", "\n [ ", "http://gerry.wagn.com/a/path", " ]\n { ", "https://brain.org/more?args", " }" ], :three_b => [ "Some URIs and Links: ","http://a.url.com", "\n More urls: ", "wagn.com/a/path/to.html", "\n [ ", "http://gerry.wagn.com/a/path", " ]\n { ", "https://brain.org/more?args", " }\n ", "http://localhost:2020/path?cgi=foo&bar=baz", " ", "extra" ], :four => "No chunks" };To;4;[[@/iy;F;:TEXT_RENDERED;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;I"TEXT_RENDERED;F;(I"TEXT_RENDERED = {;T;*I"TEXT_RENDERED = { :three => [ "Some URIs and Links: ", 'http://a.url.com/', "\n More urls: ", "wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]", "\n ", "http://localhost:2020/path?cgi=foo&bar=baz", " ", "extra[http://brain.org/Home]", "\n [ ", "http://gerry.wagn.com/a/path", " ]\n { ", "https://brain.org/more?args", " }" ], };T;6I"{ :three => [ "Some URIs and Links: ", 'http://a.url.com/', "\n More urls: ", "wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]", "\n ", "http://localhost:2020/path?cgi=foo&bar=baz", " ", "extra[http://brain.org/Home]", "\n [ ", "http://gerry.wagn.com/a/path", " ]\n { ", "https://brain.org/more?args", " }" ], };T@ o;;IC;[o; ; F; ;,;;;I"&SetPatternSpecHelper#it_generates;F;[[I" opts;T0;[[I"&spec/lib/card/set_pattern_spec.rb;Ti ;F;:it_generates;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@/;(I"def it_generates( opts );T;)T;*I"def it_generates( opts ) name = opts[:name] card = opts[:from] it "generates name '#{name}' for card '#{card.name}'" do expect(described_class.new(card).to_s).to eq(name) end end;T;+T;9@/;:IC;[;9@/;;IC;[;9@/;T;,IC;={;>T;>T;?{;@[;[[@/i;F;:SetPatternSpecHelper;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;I"SetPatternSpecHelper;Fo; ; F; ;,;;;I"#that_produces;T;[[I" type;T0;[[I"8mod/03_machines/spec/lib/shared_machine_examples.rb;Ti;F;:that_produces;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;(I"def that_produces type;T;)T;*I"&def that_produces type type end;To; ; F; ;,;;;I"#method_missing;T;[[I"m;T0[I" *args;T0[I" &block;T0;[[@/i ;F;;;;;[;{;IC;" ;T; @/;.0;!F;[;[;I";T;0;'@;(I"(def method_missing m, *args, &block;T;)T;*I"vdef method_missing m, *args, &block case m when /that_produces_(.+)/ return $1 else super end end;T;9@;:IC;[;9@;;IC;[o;C ;D0;E0;F0;;;'@;H@/;O;;9@;T;,IC;={;>T;>T;?{;@[;[;F;;;;;;;[;{;IC;" ;T; @;.0;!F;[;[;I";T;0;'0;I";T;@:$Card.serializable_attr_accessor@ :Card#follower_stash@:Card#follower_stash=@.:Card::TRACKED_FIELDS@C;@-:Cardio::CARD_GEM_ROOT@-:Cardio.cache@-:Cardio.set_config@-:Cardio.set_default_value@-:Cardio.set_paths@.:Cardio.root@.:Cardio.gem_root@".:Cardio.add_path@/.:Cardio.future_stamp@A.:Cardio.migration_paths@N.:(Cardio.assume_migrated_upto_version@].:Cardio.schema_suffix@l.:Cardio.delete_tmp_files@{.:Cardio.schema_mode@.:Cardio.schema@.:Cardio.schema_stamp_path@.:Card::Log@R:Card::Log::Request@T:Card::Log::Request.path@V:'Card::Log::Request.write_log_entry@d:Card::Log::Performance@:*Card::Log::Performance::DEFAULT_CLASS@:0Card::Log::Performance::DEFAULT_METHOD_TYPE@:.Card::Log::Performance::DEFAULT_LOG_LEVEL@:3Card::Log::Performance::DEFAULT_METHOD_OPTIONS@ :,Card::Log::Performance::SPECIAL_METHODS@:%Card::Log::Performance::TAB_SIZE@%:"Card::Log::Performance::@@log@2:.Card::Log::Performance::@@context_entries@?:-Card::Log::Performance::@@active_entries@L:,Card::Log::Performance::@@current_level@Y:,Card::Log::Performance.params_to_config@f:'Card::Log::Performance.load_config@u:!Card::Log::Performance.start@: Card::Log::Performance.stop@:&Card::Log::Performance.with_timer@:)Card::Log::Performance.enable_method@:+Card::Log::Performance.enabled_method?@:%Card::Log::Performance.print_log@:$Card::Log::Performance.text_log@:$Card::Log::Performance.html_log@:-Card::Log::Performance.list_to_accordion@:(Card::Log::Performance.simple_entry@ :+Card::Log::Performance.accordion_entry@:%Card::Log::Performance.new_entry@+:(Card::Log::Performance.finish_entry@::7Card::Log::Performance.prepare_methods_for_logging@I:3Card::Log::Performance.hashify_and_verify_keys@X:"Card::Log::Performance::Entry@j:(Card::Log::Performance::Entry#level@l:)Card::Log::Performance::Entry#level=@y:(Card::Log::Performance::Entry#valid@:)Card::Log::Performance::Entry#valid=@:*Card::Log::Performance::Entry#context@:+Card::Log::Performance::Entry#context=@:)Card::Log::Performance::Entry#parent@:*Card::Log::Performance::Entry#parent=@:/Card::Log::Performance::Entry#children_cnt@:0Card::Log::Performance::Entry#children_cnt=@:+Card::Log::Performance::Entry#duration@ :,Card::Log::Performance::Entry#duration=@:+Card::Log::Performance::Entry#children@,:,Card::Log::Performance::Entry#children=@9:*Card::Log::Performance::Entry#message@L:-Card::Log::Performance::Entry#initialize@Y:/Card::Log::Performance::Entry#add_children@q:2Card::Log::Performance::Entry#delete_children@:8Card::Log::Performance::Entry#has_younger_siblings?@:0Card::Log::Performance::Entry#save_duration@:)Card::Log::Performance::Entry#delete@:(Card::Log::Performance::Entry#to_s!@:*Card::Log::Performance::Entry#to_html@:)Card::Log::Performance::Entry#indent@:3Card::Log::Performance::Entry#younger_siblings@:'Card::Log::Performance::BigBrother@:4Card::Log::Performance::BigBrother#watch_method@:=Card::Log::Performance::BigBrother#watch_instance_method@%:>Card::Log::Performance::BigBrother#watch_singleton_method@4:BCard::Log::Performance::BigBrother#watch_all_instance_methods@C:CCard::Log::Performance::BigBrother#watch_all_singleton_methods@P:9Card::Log::Performance::BigBrother#watch_all_methods@]:=Card::Log::Performance::BigBrother#add_singleton_logging@j:Card::Diff::DiffBuilder::LCS::ExcludeeIterator#initialize@ :=Card::Diff::DiffBuilder::LCS::ExcludeeIterator#word_step@ :8Card::Diff::DiffBuilder::LCS::ExcludeeIterator#next@ :Card::Name@\ :Card::Name#star?@^ :Card::Name#rstar?@q :Card::Name#trait_name?@ :Card::Name#trait_name@ :Card::Name#trait@ :Card::Name#code@ :Card::Name#is_a_field_of?@ :Card::Query@ :Card::Query::MODIFIERS@ :Card::Query::OPERATORS@ :Card::Query#initialize@ :Card::Query#query@ :Card::Query#sql@% :Card::Query#run@2 :Card::Query#simple_run@? :Card::Query#run_sql@N :Card::Query::SqlCond@[ : Card::Query::SqlCond#to_sql@] :Card::Query::SqlStatement@} :%Card::Query::SqlStatement#fields@ :&Card::Query::SqlStatement#fields=@ :%Card::Query::SqlStatement#tables@ :&Card::Query::SqlStatement#tables=@ :$Card::Query::SqlStatement#joins@ :%Card::Query::SqlStatement#joins=@ :)Card::Query::SqlStatement#conditions@ :*Card::Query::SqlStatement#conditions=@ :$Card::Query::SqlStatement#group@ :%Card::Query::SqlStatement#group=@ :$Card::Query::SqlStatement#order@:%Card::Query::SqlStatement#order=@,:$Card::Query::SqlStatement#limit@?:%Card::Query::SqlStatement#limit=@L:%Card::Query::SqlStatement#offset@_:&Card::Query::SqlStatement#offset=@l:'Card::Query::SqlStatement#distinct@:(Card::Query::SqlStatement#distinct=@:)Card::Query::SqlStatement#initialize@:#Card::Query::SqlStatement#to_s@:Card::Cache@:Card::Cache::TEST_ENVS@:!Card::Cache::@@prepopulating@$:%Card::Cache::@@using_rails_cache@1:"Card::Cache::@@cache_by_class@>:Card::Cache.[]@K:Card::Cache.renew@Z:Card::Cache.prefix_root@g:Card::Cache.system_prefix@t:Card::Cache.restore@:"Card::Cache.generate_cache_id@:Card::Cache.reset_global@:Card::Cache.reset_local@:Card::Cache.obj_to_key@:Card::Cache.prepopulate@:Card::Cache#prefix@:Card::Cache#store@:Card::Cache#klass@:Card::Cache#local@:Card::Cache#local=@ :Card::Cache#initialize@:Card::Cache#system_prefix=@2:Card::Cache#read@A:Card::Cache#read_local@P:Card::Cache#write_variable@_:Card::Cache#write@r:Card::Cache#write_local@:Card::Cache#fetch@:Card::Cache#fetch_local@:Card::Cache#delete@:Card::Cache#dump@:Card::Cache#reset@:Card::Cache#reset_local@:Card::Cache#exist?@:Card::Chunk@:Card::Chunk.register_class@:Card::Chunk.register_list@*:%Card::Chunk.find_class_by_prefix@;:"Card::Chunk.get_prefix_regexp@J:Card::Chunk::Abstract@Y:Card::Chunk::Abstract#text@[:(Card::Chunk::Abstract#process_chunk@h:%Card::Chunk::Abstract.full_match@u:"Card::Chunk::Abstract.full_re@:&Card::Chunk::Abstract.context_ok?@:%Card::Chunk::Abstract#initialize@:$Card::Chunk::Abstract#interpret@:!Card::Chunk::Abstract#format@:Card::Chunk::Abstract#card@:Card::Chunk::Abstract#to_s@:"Card::Chunk::Abstract#inspect@:"Card::Chunk::Abstract#as_json@ :Card::Format@=:#Card::Format::DEPRECATED_VIEWS@?:"Card::Format::INCLUSION_MODES@M:Card::Format#card@Z:Card::Format#root@g:Card::Format#parent@t:Card::Format#main_opts@:Card::Format#form@:Card::Format#form=@:Card::Format#error_status@:Card::Format#error_status=@: Card::Format#inclusion_opts@:!Card::Format#inclusion_opts=@:Card::Format::@@registered@:Card::Format.register@:#Card::Format.format_class_name@ :$Card::Format.extract_class_vars@:Card::Format.new@*:Card::Format.tagged@<:!Card::Format.format_ancestry@M:Card::Format.max_depth@Z:Card::Format#initialize@g:#Card::Format#get_context_names@:,Card::Format#include_set_format_modules@:$Card::Format#inclusion_defaults@:(Card::Format#get_inclusion_defaults@:Card::Format#params@:Card::Format#controller@:Card::Format#session@:Card::Format#showname@:#Card::Format#with_name_context@:Card::Format#main?@:Card::Format#focal?@:Card::Format#template@": Card::Format#method_missing@/:Card::Format#render@B:Card::Format#show_view?@T:Card::Format#show_views@j:Card::Format#hide_views@y:'Card::Format#parse_view_visibility@:%Card::Format#default_render_args@:Card::Format#rescue_view@: Card::Format#error_cardname@:"Card::Format#unsupported_view@:!Card::Format#rendering_error@:Card::Format#subformat@:!Card::Format#process_content@:(Card::Format#process_content_object@ :Card::Format#ok_view@:Card::Format#tagged@/: Card::Format#permitted_view@@:Card::Format#ok?@Q:"Card::Format#view_for_unknown@e:#Card::Format#canonicalize_view@v:%Card::Format#with_inclusion_mode@:Card::Format#prepare_nest@:Card::Format#expand_main@:*Card::Format#legacy_main_opts_tweaks!@:Card::Format#wrap_main@:Card::Format#nest@:'Card::Format#get_inclusion_content@:#Card::Format#fetch_nested_card@:#Card::Format#default_item_view@:Card::Format#add_class@ :Card::Format::Location@:%Card::Format::Location#page_path@!:%Card::Format::Location#card_path@4:$Card::Format::Location#card_url@C:Card::Format#unique_id@b:Card::Format#format_date@o:"Card::Format#add_name_context@:Card.config@:Card.paths@:Card::Loader@:Card::Loader.load_mods@:Card::Loader.load_chunks@:Card::Loader.load_layouts@:Card::Loader.mod_dirs@:#Card::Loader.load_set_patterns@:/Card::Loader.load_set_patterns_from_source@:Card::Loader.load_formats@:Card::Loader.load_sets@":&Card::Loader.load_sets_by_pattern@/:0Card::Loader.load_implicit_sets_from_source@<:!Card::Loader.prepare_tmp_dir@K:$Card::Loader.rewrite_tmp_files?@Z:Card::Loader.load_dir@l:Card::Mailer@:Card::Mailer::@@defaults@:Card::Mailer.new_mail@:Card::Mailer.layout@:Card::Content@:Card::Content#revision@:Card::Content#format@:Card::Content#chunks@:Card::Content#opts@:Card::Content#initialize@:Card::Content#card@:Card::Content#chunk_list@+:Card::Content#to_s@8:Card::Content#inspect@E:Card::Content#each_chunk@R:Card::Content#find_chunks@_:)Card::Content#process_content_object@n: Card::Content#parse_content@}: Card::Content::ALLOWED_TAGS@:!Card::Content::ATTR_VALUE_RE@:Card::Content.clean!@:)Card::Content#clean_with_space_last!@:2Card::Content.truncatewords_with_closing_tags@:Card::Version@:Card::Version.release@;G@:Object#deep_clone@:Object#send_unless@:Object#send_if@:Object#to_name@:Object#to_viewname@;@.:Module::RUBY_VERSION_18@.: Module#const_get_if_defined@.:Module#const_get_or_set@.;@/:&Hash.new_from_semicolon_attr_list@ /:Kaminari::Helpers::Tago; ;IC;[o; ; F; ;,;;;I"(Kaminari::Helpers::Tag#page_url_for;T;[[I" page;T0;[[@iT;F;:page_url_for;;;[;{;IC;" ;T; @0;.0;!F;[;[;I";T;0;'@0;(I"def page_url_for page;T;)T;*I"def page_url_for page p = params_for(page) p.delete :controller p.delete :action card = Card[p.delete('id')] card.format.path p end;T;+To; ; F; ;,;;b;I"&Kaminari::Helpers::Tag#params_for;T;[[I" page;T0;[[@i^;F;:params_for;;;[;{;IC;" ;T; @"0;.0;!F;[;[;I";T;0;'@0;(I"def params_for(page);T;)T;*I"def params_for(page) page_params = Rack::Utils.parse_nested_query("#{@param_name}=#{page}") page_params = @params.with_indifferent_access.deep_merge(page_params) if Kaminari.config.respond_to?(:params_on_first_page) && !Kaminari.config.params_on_first_page && page <= 1 # This converts a hash: # from: {other: "params", page: 1} # to: {other: "params", page: nil} # (when @param_name == "page") # # from: {other: "params", user: {name: "yuki", page: 1}} # to: {other: "params", user: {name: "yuki", page: nil}} # (when @param_name == "user[page]") @param_name.to_s.scan(/\w+/)[0..-2].inject(page_params){|h, k| h[k] }[$&] = nil end page_params end;T;+T;9@0;:IC;[;9@0;;IC;[;9@0;T;,IC;={;>T;>T;?{;@[;[[@iS;F;:Tag;;;;;[;{;IC;" ;T; @0;.0;!F;[;[;I";T;0;'o;C ;D0;EI"Kaminari::Helpers;T;F@;: Helpers;'o;C ;D0;E0;F0;: Kaminari;'@;H0;O0;H0;O0;I"Kaminari::Helpers::Tag;T;Bo;C ;D0;E0;F0;;G;'@;H@;O0:Card::Codename@:Card::Codename::@@codehash@:Card::Codename.[]@&:Card::Codename.codehash@6:Card::Codename.reset_cache@C:Card::Codename.bootdata@P:Card::Codename.cache@`:Card::Codename.load_hash@m:Card.const_missing@:Card::ViewName@:*Card::ViewName::@@name2viewnameobject@:Card::ViewName.new@:Card::ViewName#initialize@:Card::ViewName#simple_key@:Card::ViewName#to_viewname@:Card::Migration@:Card::Migration.type@:%Card::Migration.find_unused_name@ :$Card::Migration.migration_paths@:Card::Migration.schema@(:"Card::Migration.schema_suffix@8: Card::Migration.schema_mode@H:1Card::Migration.assume_migrated_upto_version@X:Card::Migration.data_path@e: Card::Migration#contentedly@u: Card::Migration#import_json@:Card::Migration#read_json@:Card::Migration#data_path@: Card::Migration#schema_mode@:$Card::Migration#migration_paths@:#Card::Migration#exec_migration@:Card::Migration#down@:Card::Reference@"!:Card::Reference#referencer@$!:Card::Reference#referencee@2!:$Card::Reference.delete_all_from@?!:"Card::Reference.delete_all_to@N!:(Card::Reference.update_existing_key@]!:%Card::Reference.update_on_rename@o!:%Card::Reference.update_on_delete@!:,Card::Reference.repair_missing_referees@!:,Card::Reference.delete_missing_referers@!:Card::Reference.repair_all@!:Card::ViewCache@!:Card::ViewCache::SIZE@!:Card::ViewCache::LIMIT@!:Card::ViewCache::CNT_KEY@!:#Card::ViewCache::FREQUENCY_KEY@!:Card::ViewCache.cache@":"Card::ViewCache.increment_cnt@":Card::ViewCache.count@":!Card::ViewCache.reduce_cache@,":%Card::ViewCache.update_frequency@9":Card::ViewCache.fetch@K":Card::ViewCache.reset@`":Card::Error@":Card::Oops@":Card::BadQuery@":Card::NotFound@":Card::PermissionDenied@": Card::PermissionDenied#card@":&Card::PermissionDenied#initialize@":)Card::PermissionDenied#build_message@":Card::Abort@#:Card::Abort#status@#:Card::Abort#initialize@ #:Card::Generators@I#:#Card::Generators::ClassMethods@K#:/Card::Generators::ClassMethods#source_root@M#:*Card::Generators::ClassMethods#banner@^#: Card::Generators::NamedBase@|#:$Card::Generators::MigrationBase@#;\@)/:Card::SpecHelper@0$:Card::SpecHelper#login_as@2$:Card::SpecHelper#newcard@C$:(Card::SpecHelper#assert_view_select@U$:.Card::SpecHelper#debug_assert_view_select@h$:#Card::SpecHelper#render_editor@{$:$Card::SpecHelper#render_content@$:.Card::SpecHelper#render_content_with_args@$:!Card::SpecHelper#render_card@$:+Card::SpecHelper#render_card_with_args@$:Card::SpecHelper#users@$:Card::SetPattern@%:"Card::SetPattern.pattern_code@%:#Card::SetPattern.pattern_code=@%: Card::SetPattern.pattern_id@(%:!Card::SetPattern.pattern_id=@5%:#Card::SetPattern.junction_only@H%:$Card::SetPattern.junction_only=@U%:"Card::SetPattern.assigns_type@h%:#Card::SetPattern.assigns_type=@u%: Card::SetPattern.anchorless@%:!Card::SetPattern.anchorless=@%:(Card::SetPattern.anchor_parts_count@%:)Card::SetPattern.anchor_parts_count=@%:Card::SetPattern.find@%:$Card::SetPattern.junction_only?@%:!Card::SetPattern.anchorless?@%:Card::SetPattern.new@%:Card::SetPattern.pattern@ &:Card::SetPattern.register@&:&Card::SetPattern.pattern_applies?@*&:$Card::SetPattern.write_tmp_file@>&: Card::SetPattern#initialize@Q&: Card::SetPattern#module_key@f&:(Card::SetPattern#lookup_module_list@s&:!Card::SetPattern#module_list@&:(Card::SetPattern#format_module_list@&:&Card::SetPattern#anchor_codenames@&:Card::SetPattern#pattern@&:Card::SetPattern#to_s@&:Card::SetPattern#inspect@&:Card::SetPattern#safe_key@&:"Card::SetPattern#rule_set_key@&:Card::TypeSet@':Card::TypeSet#initialize@':'Card::TypeSet#lookup_inherited_key@': Card::TypeSet#inherited_key@&':%Card::TypeSet#lookup_module_list@3':Card::Query::Clause@:Card::Query::Clause#clause@: Card::Query::Clause#clause=@:!Card::Query::Clause#safe_sql@:Card::Query::Clause#quote@ :#Card::Query::Clause#match_prep@:"Card::Query::Clause#cast_type@(:Card::CoreMigration@S';@;/;@I/:#is_in_mod?@V/:#card_simplecov_filters@m/:%#card_core_dev_simplecov_filters@z/:Card::Query::RefClause@L:2Card::Query::RefClause::REFERENCE_DEFINITIONS@N:-Card::Query::RefClause::REFERENCE_FIELDS@\:&Card::Query::RefClause#initialize@i:"Card::Query::RefClause#to_sql@;@/;@/;@/;@/:Card::Query::CardClause@:(Card::Query::CardClause::ATTRIBUTES@:0Card::Query::CardClause::DEFAULT_ORDER_DIRS@:*Card::Query::CardClause::CONJUNCTIONS@: Card::Query::CardClause#sql@:"Card::Query::CardClause#query@:&Card::Query::CardClause#rawclause@:%Card::Query::CardClause#selfname@:"Card::Query::CardClause#joins@:#Card::Query::CardClause#joins=@ :'Card::Query::CardClause#join_count@:(Card::Query::CardClause#join_count=@,:"Card::Query::CardClause.build@?:'Card::Query::CardClause#initialize@N:"Card::Query::CardClause#clean@b:&Card::Query::CardClause#clean_val@q:!Card::Query::CardClause#root@:*Card::Query::CardClause#absolute_name@:"Card::Query::CardClause#merge@:$Card::Query::CardClause#hashify@:4Card::Query::CardClause#translate_to_attributes@:,Card::Query::CardClause#ready_to_sqlize@:#Card::Query::CardClause#relate@:&Card::Query::CardClause#refclause@:(Card::Query::CardClause#conjunction@:!Card::Query::CardClause#type@ :!Card::Query::CardClause#part@:!Card::Query::CardClause#left@,:"Card::Query::CardClause#right@;:&Card::Query::CardClause#editor_of@J:&Card::Query::CardClause#edited_by@Y:+Card::Query::CardClause#last_editor_of@h:+Card::Query::CardClause#last_edited_by@w:'Card::Query::CardClause#creator_of@:'Card::Query::CardClause#created_by@:&Card::Query::CardClause#member_of@:#Card::Query::CardClause#member@:&Card::Query::CardClause#left_plus@:'Card::Query::CardClause#right_plus@:!Card::Query::CardClause#plus@:%Card::Query::CardClause#junction@: Card::Query::CardClause#and@: Card::Query::CardClause#all@:Card::Query::CardClause#or@: Card::Query::CardClause#any@,:%Card::Query::CardClause#found_by@8: Card::Query::CardClause#not@G:!Card::Query::CardClause#sort@V:"Card::Query::CardClause#match@e:%Card::Query::CardClause#complete@t:+Card::Query::CardClause#extension_type@:(Card::Query::CardClause#table_alias@:%Card::Query::CardClause#add_join@:"Card::Query::CardClause#field@:'Card::Query::CardClause#field_root@:)Card::Query::CardClause#subcondition@:*Card::Query::CardClause#action_clause@:+Card::Query::CardClause#id_from_clause@:%Card::Query::CardClause#restrict@ :-Card::Query::CardClause#restrict_by_join@:#Card::Query::CardClause#to_sql@1:-Card::Query::CardClause#basic_conditions@@:0Card::Query::CardClause#current_conjunction@M:2Card::Query::CardClause#permission_conditions@Z:*Card::Query::CardClause#fields_to_sql@g:(Card::Query::CardClause#sort_to_sql@t:'Card::Query::CardClause#sort_field@;@ :%ActiveRecord::ConnectionAdapters@ :6ActiveRecord::ConnectionAdapters::AbstractAdapter@ :ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#match@J :2ActiveRecord::ConnectionAdapters::MysqlCommon@j :8ActiveRecord::ConnectionAdapters::MysqlCommon#match@l :DActiveRecord::ConnectionAdapters::MysqlCommon#custom_cast_types@{ :3ActiveRecord::ConnectionAdapters::MysqlAdapter@ :4ActiveRecord::ConnectionAdapters::Mysql2Adapter@ :4ActiveRecord::ConnectionAdapters::SQLiteAdapter@ ::ActiveRecord::ConnectionAdapters::SQLiteAdapter#match@ :ActiveRecord::Transactions@ :AActiveRecord::Transactions#with_transaction_returning_status@ :Card::Act@i':Card::Act#set_actor@k': Card::Act.delete_actionless@y':'Card::Act.find_all_with_actions_on@':Card::Act#action_on@':Card::Act#main_action@':Card::Act#elapsed_time@':"Card::Act#relevant_drafts_for@':#Card::Act#relevant_actions_for@':.Card::Act#timestamp_attributes_for_create@':Card::Query::ValueClause@:(Card::Query::ValueClause#initialize@: Card::Query::ValueClause#op@:$Card::Query::ValueClause#sqlize@:$Card::Query::ValueClause#to_sql@;@/:&SetPatternSpecHelper#it_generates@/:Card::Action@(:Card::Action::TYPE@(:Card::Action.cache@(:Card::Action.fetch@!(:!Card::Action.delete_cardless@0(:Card::Action.delete_old@=(: Card::Action#changed_fields@J(:Card::Action#edit_info@\(:Card::Action#new_values@i(:Card::Action#old_values@v(: Card::Action#last_value_for@(:Card::Action#field_index@(:Card::Action#new_value_for@(:Card::Action#change_for@(:Card::Action#new_type?@(:Card::Action#new_content?@(:Card::Action#new_name?@(:Card::Action#action_type=@(:Card::Action#action_type@):Card::Action#set_act@):Card::Action#revision_nr@):Card::Action#red?@+):Card::Action#green?@=):Card::Action#name_diff@O):Card::Action#cardtype_diff@`):Card::Action#content_diff@p):&Card::Action#content_diff_builder@):Card::Change@):Card::Change#field=@):Card::Change#field@):#Card::Change.delete_actionless@):$Card::Change#find_by_field_name@):$Card::Change.find_by_field_name@):Card::Setting@*:Card::Setting#codename@*:Card::Setting#codename=@*:Card::Setting.extended@(*:!Card::Setting::@@group_names@C*:Card::Setting::@@groups@R*:#Card::Setting::@@user_specific@a*:!Card::Setting.user_specific?@p*:Card::Setting#to_type_id@*:Card::Setting#setting_opts@*:&Card::Setting#applies_to_cardtype@*:Card::Machine@*: Card::Machine::ClassMethods@*:.Card::Machine::ClassMethods#output_config@*:/Card::Machine::ClassMethods#output_config=@*:4Card::Machine::ClassMethods#collect_input_cards@*:6Card::Machine::ClassMethods#prepare_machine_input@+:/Card::Machine::ClassMethods#machine_engine@+:5Card::Machine::ClassMethods#store_machine_output@ +:Card::Machine.included@C+:Card::Machine#run_machine@T+:(Card::Machine#reset_machine_output!@d+:(Card::Machine#update_machine_output@q+:!Card::Machine#lock_cache_key@~+:Card::Machine#locked?@+:Card::Machine#lock!@+:Card::Machine#unlock!@+:$Card::Machine#update_input_card@+:#Card::Machine#input_item_cards@+:%Card::Machine#machine_output_url@+:&Card::Machine#machine_output_path@+:(Card::Machine#ensure_machine_output@+:Card::FollowOption@,:"Card::FollowOption::@@options@ ,: Card::FollowOption.included@,:!Card::FollowOption.codenames@),:Card::FollowOption.cards@9,:+Card::FollowOption.restrictive_options@F,:$Card::FollowOption.main_options@S,:+Card::FollowOption#restrictive_option?@`,:#Card::FollowOption#description@r,:%Card::FollowOption::ClassMethods@,:=Card::FollowOption::ClassMethods#restrictive_follow_opts@,:1Card::FollowOption::ClassMethods#follow_opts@,:1Card::FollowOption::ClassMethods#follow_test@,: