idx int64 0 24.9k | question stringlengths 68 4.14k | target stringlengths 9 749 |
|---|---|---|
20,300 | def has_xinclude? ( doc ) ret = false doc . root . namespaces . each do | ns | if ( ns . href . casecmp ( XINCLUDE_NS ) == 0 ) ret = true break end end ret end | Check whether the document has a XInclude namespace |
20,301 | def find_remarks ( filter = [ ] ) if ( @source . nil? ) rfiles = find_xincludes ( @doc ) else @doc = XML :: Document . file ( @source ) rfiles = [ @source_file ] + find_xincludes ( @doc ) end @remarks = rfiles . map { | rf | ind = XML :: Document . file ( File . expand_path ( rf , @source . nil? ? '.' : @source_dir ) )... | Finds the remarks by looking through all the Xincluded files |
20,302 | def sum_lower_sections ( secs , start , level ) i = start sum = 0 while ( i < secs . length && secs [ i ] [ :level ] > level ) sum += secs [ i ] [ :words ] i += 1 end [ sum , i ] end | Helper for sum_sections |
20,303 | def sum_sections ( secs , max_level ) 0 . upto ( max_level ) do | cur_level | i = 0 while i < secs . length if ( secs [ i ] [ :level ] == cur_level ) ( ctr , ni ) = sum_lower_sections ( secs , i + 1 , cur_level ) secs [ i ] [ :swords ] = ctr i = ni else i += 1 end end end secs end | Sum the word counts of lower sections |
20,304 | def analyze_file full_name = File . expand_path ( @source ) changed = File . mtime ( @source ) @doc = XML :: Document . file ( @source ) raise ArgumentError , "Error: #{@source} is apparently not DocBook 5." unless is_docbook? ( @doc ) @doc . xinclude if has_xinclude? ( @doc ) sections = analyze_document ( @doc ) { :fi... | Open the XML document check for the DocBook5 namespace and finally apply Xinclude tretement to it if it has a XInclude namespace . Returns a map with the file name the file s modification time and the section structure . |
20,305 | def upload_binary if options [ :ipa ] uploader = AppRepo :: Uploader . new ( options ) result = uploader . upload msg = 'Binary upload failed. Check out the error above.' UI . user_error! ( msg ) unless result end end | Upload the binary to AppRepo |
20,306 | def convert_type type return type if type . is_a? GraphQL :: BaseType unless type . is_a? Symbol type = type . to_s . downcase . to_sym end { boolean : GraphQL :: BOOLEAN_TYPE , date : GraphQL :: Types :: DATE , datetime : GraphQL :: Types :: ISO8601DateTime , decimal : GraphQL :: Types :: DECIMAL , float : GraphQL :: ... | convert Active Record type to GraphQL type |
20,307 | def scm return @scm if @scm raise NoSuchPathError unless File . exists? ( path ) raise InvalidRepositoryError unless File . exists? ( File . join ( path , '.git' ) ) @scm = Git . open ( path ) end | version control system wrapper |
20,308 | def next ( bump_type = nil ) bump_type ||= :patch bump_index = PARTS . index ( bump_type . to_sym ) bumped_parts = parts . take ( bump_index + 1 ) bumped_parts [ bump_index ] = bumped_parts [ bump_index ] . to_i + 1 bumped_parts += [ 0 ] * ( PARTS . length - ( bump_index + 1 ) ) self . class . new ( bumped_parts . join... | Builds a new version wiht a version number incremented from this object s version . Does not propogate any other attributes |
20,309 | def native ( cmd , opts = [ ] , chdir = true , redirect = '' , & block ) validate ENV [ 'GIT_DIR' ] = @git_dir ENV [ 'GIT_INDEX_FILE' ] = @git_index_file ENV [ 'GIT_WORK_TREE' ] = @git_work_dir path = @git_work_dir || @git_dir || @path opts = [ opts ] . flatten . map { | s | escape ( s ) } . join ( ' ' ) git_cmd = "git... | liberate the ruby - git s private command method with a few tweaks |
20,310 | def add_next_block ( prev_block , data ) if valid_block? ( prev_block ) blockchain << next_block ( data ) else raise InvalidBlockError end end | Initialize a new blockchain by creating a new array with the Genesis block |
20,311 | def data_to_method ( data ) raise "No safe methods defined!" unless @safe_methods . size > 0 @safe_methods . each do | method | if data [ 'mode' ] == method . to_s self . send ( data [ 'mode' ] , data ) end end end | Uses the mode from a packet to call the method of the same name |
20,312 | def every ( milliseconds , & block ) Thread . new do loop do block . call sleep ( milliseconds / 1000.0 ) end end end | Calls Proc immediately then every milliseconds async . |
20,313 | def log ( string , color = Gosu :: Color :: RED ) GameOverseer :: Console . log_with_color ( string , color ) end | String to be logged |
20,314 | def to_s repr = "" repr += "id: #{id}\n" if id repr += "event: #{event}\n" if event if data . empty? repr += "data: \n" else data . split ( "\n" ) . each { | l | repr += "data: #{l}\n" } end repr += "\n" end | Serialize event into form for transmission . |
20,315 | def push ( from , options = { } ) to = File . join @path , ( options [ :to ] || File . basename ( from ) ) FileUtils . cp_r from , to permissions = options [ :read_only ] ? 0770 : 0750 FileUtils . chmod_R permissions , to FileUtils . chown_R @admin_uid , @user_gid , to to end | Empty sandbox . |
20,316 | def pull ( from , to ) from = File . join @path , from return nil unless File . exist? from FileUtils . cp_r from , to FileUtils . chmod_R 0770 , to FileUtils . chown_R @admin_uid , @admin_gid , to to end | Copies a file or directory from the sandbox . |
20,317 | def run ( command , options = { } ) limits = options [ :limits ] || { } io = { } if options [ :in ] io [ :in ] = options [ :in ] in_rd = nil else in_rd , in_wr = IO . pipe in_wr . write options [ :in_data ] if options [ :in_data ] in_wr . close io [ :in ] = in_rd end if options [ :out ] io [ :out ] = options [ :out ] e... | Runs a command in the sandbox . |
20,318 | def ocurrences ( st , en = nil ) recurrence ? recurrence . events ( :starts => st , :until => en ) : ( start_at . to_date .. end_at . to_date ) . to_a end | Array including all the dates this Scheduler has ocurrences between st and en |
20,319 | def dump puts '******************' puts '* RakeOE::Config *' puts '******************' puts "Directories : #{@directories}" puts "Suffixes : #{@suffixes}" puts "Platform : #{@platform}" puts "Release mode : #{@release}" puts "Test framework ... | Dumps configuration to stdout |
20,320 | def authenticated? ( password ) if password_object == password update_hash! ( password ) if password_object . stale? return true end return false end | Return true if password matches the hashed_password . If successful checks for an outdated password_hash and updates if necessary . |
20,321 | def open put ( :state , :open ) if config [ :on_break ] require 'timeout' handlers = [ config [ :on_break ] ] . flatten . map { | handler | ( handler . is_a? ( Symbol ) ? STANDARD_HANDLERS [ handler ] : handler ) } . compact handlers . each do | handler | begin Timeout :: timeout ( @break_handler_timeout ) { handler . ... | Open the fuse |
20,322 | def parse ( value_spec ) case value_spec when WildcardPattern WildcardCronValue . new ( @lower_limit , @upper_limit ) when @single_value_pattern SingleValueCronValue . new ( @lower_limit , @upper_limit , convert_value ( $1 ) ) when @range_pattern RangeCronValue . new ( @lower_limit , @upper_limit , convert_value ( $1 )... | Constructs a new CronSpecificationFactory |
20,323 | def path_to ( * args ) case when args . length == 1 base_path = :repo_manager asset = args when args . length == 2 base_path , asset = * args when args . length > 2 raise ArgumentError , "Too many arguments" else raise ArgumentError , "Specify at least the file asset" end case base_path when :repo_manager root = File .... | path_to returns absolute installed path to various folders packaged with the RepoManager gem |
20,324 | def colorize_legacy_message ( message ) message . sub ( 'MONGODB' , color ( 'MONGODB' , odd? ? CYAN : MAGENTA ) ) . sub ( %r{ \[ } ) { | m | color ( m , BLUE ) } . sub ( %r{ \] \. \w } ) { | m | color ( m , YELLOW ) } end | Used for Mongoid < 3 . 0 |
20,325 | def colorize_message ( message ) message = message . sub ( 'MONGODB' , color ( 'MONGODB' , odd? ? CYAN : MAGENTA ) ) . sub ( %r{ \[ } ) { | m | color ( m , BLUE ) } . sub ( %r{ \] \. \w } ) { | m | color ( m , YELLOW ) } message . sub ( 'MOPED:' , color ( 'MOPED:' , odd? ? CYAN : MAGENTA ) ) . sub ( / \{ \} \s / ) { | ... | Used for Mongoid > = 3 . 0 |
20,326 | def get_queue ( name = :default_queue ) name = name . to_sym queue = @queues [ name ] unless queue @queues [ name ] = GBDispatch :: Queue . new ( name ) queue = @queues [ name ] end queue end | Returns queue of given name . |
20,327 | def run_async_on_queue ( queue ) raise ArgumentError . new 'Queue must be GBDispatch::Queue' unless queue . is_a? GBDispatch :: Queue queue . async . perform_now -> ( ) { yield } end | Run asynchronously given block of code on given queue . |
20,328 | def run_sync_on_queue ( queue ) raise ArgumentError . new 'Queue must be GBDispatch::Queue' unless queue . is_a? GBDispatch :: Queue future = queue . await . perform_now -> ( ) { yield } future . value end | Run given block of code on given queue and wait for result . |
20,329 | def run_after_on_queue ( time , queue ) raise ArgumentError . new 'Queue must be GBDispatch::Queue' unless queue . is_a? GBDispatch :: Queue queue . perform_after time , -> ( ) { yield } end | Run given block of code on given queue with delay . |
20,330 | def map_array_of_hashes ( arr_hashes ) return if arr_hashes . nil? [ ] . tap do | output_array | arr_hashes . each do | hash | output_array . push hash . values end end end | Given an array of hashes returns an array of hash values . |
20,331 | def extract_lock_token ( if_header ) token = if_header . scan ( Calligraphy :: LOCK_TOKEN_REGEX ) token . flatten . first if token . is_a? Array end | Extracts a lock token from an If headers . |
20,332 | def execute ( opts = { } ) @result = result_class . new ( session . execute ( statement , execution_options . merge ( opts ) ) , result_opts ) result . success? end | Executes the statment and populates result |
20,333 | def execution_options { } . tap do | opts | opts [ :consistency ] = consistency if consistency opts [ :paging_state ] = paging_state if respond_to? ( :paging_state ) && paging_state opts [ :page_size ] = stateless_page_size if respond_to? ( :stateless_page_size ) && stateless_page_size end end | The session exection options configured for statement execution |
20,334 | def save_writable_attributes ( asset , attributes ) valid_keys = [ :parent , :path ] accessable_attributes = { } attributes . each do | key , value | accessable_attributes [ key ] = value . dup if valid_keys . include? ( key ) end asset . configuration . save ( accessable_attributes ) end | write only the attributes that we have set |
20,335 | def method_missing ( method_sym , * arguments , & block ) et = @last_read_timestamp . nil? ? 0 : ( Time . now - @last_read_timestamp ) @logger . debug "Elapsed time since last read #{et}" if et > 250 @logger . info "More than 250 milliseconds have passed since last read. Triggering refresh." read ( ) end if @values . i... | Attribute handler that delegates attribute reads to the values hash |
20,336 | def calculate_measurement ( m1 , m2 , m3 ) if power_configuration == :single_phase_2wire m1 elsif power_configuration == :single_phase_3wire ( m1 + m2 ) elsif power_configuration == :three_phase_3wire ( m1 + m3 ) elsif power_configuration == :three_phase_4wire ( m1 + m2 + m3 ) end end | Returns the correct measurement for voltage current and power based on the corresponding power_configuration |
20,337 | def as_datetime ( s ) begin d = DateTime . new ( "20#{s[0,2]}" . to_i , s [ 2 , 2 ] . to_i , s [ 4 , 2 ] . to_i , s [ 8 , 2 ] . to_i , s [ 10 , 2 ] . to_i , s [ 12 , 2 ] . to_i , '-4' ) rescue logger . error "Could not create valid datetime from #{s}\nDateTime.new(20#{s[0,2]}, #{s[2,2]}, #{s[4,2]}, #{s[8,2]}, #{s[10,2]... | Returns a Ruby datatime derived from the string representing the time on the meter when the values were captured The raw string s format is YYMMDDWWHHMMSS where YY is year without century and WW is week day with Sunday as the first day of the week |
20,338 | def to_f_with_decimal_places ( s , p = 1 ) unless s . nil? v = ( s . to_f / ( 10 ** p ) ) logger . debug "Casting #{s.inspect} -> #{v.inspect}" v else logger . error "Could not cast #{s} to #{p} decimal places" end end | Generic way of casting strings to numbers with the decimal in the correct place |
20,339 | def add ( ts , word_count ) begin k = ts . to_date rescue NoMethodError k = Date . parse ( ts . to_s ) end if @history [ :archive ] [ k ] . nil? @history [ :archive ] [ k ] = { min : word_count , max : word_count , start : word_count , end : word_count , ctr : 1 } else @history [ :archive ] [ k ] [ :min ] = word_count ... | Add to the history |
20,340 | def command ( name , type = 'feature' , action = 'start' , path = Dir . pwd , optional_args = '' ) error "Invalid git-flow type '#{type}'" unless %w( feature release hotfix support ) . include? ( type ) error "Invalid action '#{action}'" unless %w( start finish ) . include? ( action ) error "You must provide a name" if... | generic function to run any of the gitflow commands |
20,341 | def guess_gitflow_config ( dir = Dir . pwd , options = { } ) path = normalized_path ( dir ) use_git = FalkorLib :: Git . init? ( path ) return { } if ( ! use_git or ! FalkorLib :: GitFlow . init? ( path ) ) rootdir = FalkorLib :: Git . rootdir ( path ) local_config = FalkorLib :: Config . get ( rootdir , :local ) retur... | master_branch guess_gitflow_config Guess the gitflow configuration |
20,342 | def call ( file , * args , format : nil ) img = :: MiniMagick :: Image . new ( file . path ) img . quiet img . format ( format . to_s . downcase , nil ) if format send ( @method , img , * args ) post_processing ( img ) :: File . open ( img . path , "rb" ) end | Overwrite refile call method to supress format warnings and do post - processing |
20,343 | def post_processing ( img ) img . combine_options do | cmd | cmd . strip cmd . colorspace 'sRGB' cmd . auto_orient cmd . quiet end end | Should be called for every jobmensa processor |
20,344 | def document if ! @document @document = Nokogiri :: HTML ( self . class . request_sncf ( number , date ) ) if ! itinerary_available? @document = Nokogiri :: HTML ( self . class . request_sncf_itinerary ( 0 ) ) end end if @document . at ( '#no_results' ) fail TrainNotFound , @document . at ( '#no_results b' ) . inner_ht... | Returns a new Nokogiri document for parsing . |
20,345 | def generate_history_url url = 'http://ichart.finance.yahoo.com/table.csv?s=%s&a=%s&b=%s&c=%s&d=%s&e=%s&f=%s&g=%s&ignore=.csv' % [ @symbol , @start_date . to_date . month - 1 , @start_date . to_date . day , @start_date . to_date . year , @end_date . to_date . month - 1 , @end_date . to_date . day , @end_date . to_date ... | History URL generator |
20,346 | def validate_input parameters unless parameters . is_a? ( Hash ) raise StockException , 'Given parameters have to be a hash.' end unless parameters . has_key? ( :symbol ) raise StockException , 'No stock symbol specified.' end unless parameters [ :symbol ] . is_a? ( String ) raise StockException , 'Stock symbol must be... | Input parameters validation |
20,347 | def render_collection ( collection , member_fields , view = nil , context : Attributor :: DEFAULT_ROOT_CONTEXT ) render ( collection , [ member_fields ] , view , context : context ) end | Renders an a collection using a given list of per - member fields . |
20,348 | def render ( object , fields , view = nil , context : Attributor :: DEFAULT_ROOT_CONTEXT ) if fields . is_a? Array sub_fields = fields [ 0 ] object . each_with_index . collect do | sub_object , i | sub_context = context + [ "at(#{i})" ] render ( sub_object , sub_fields , view , context : sub_context ) end elsif object ... | Renders an object using a given list of fields . |
20,349 | def log ( severity , message , tid ) now = Time . now ss = [ 'DEBUG' , 'INFO' , 'WARN' , 'ERROR' , 'FATAL' ] [ severity ] ss = '' if ss . nil? if @formatter . nil? msg = "#{ss[0]}, [#{now.strftime('%Y-%m-%dT%H:%M:%S.%6N')} ##{tid}] #{ss} -- : #{message}\n" else msg = @formatter . call ( ss , now , tid , message ) end ... | Writes a message if the severity is high enough . This method is executed asynchronously . |
20,350 | def stream = ( stream ) logger = Logger . new ( stream ) logger . level = @logger . level logger . formatter = @logger . formatter @logger = logger end | Sets the logger to use the stream specified . This method is executed asynchronously . |
20,351 | def set_filename ( filename , shift_age = 7 , shift_size = 1048576 ) logger = Logger . new ( filename , shift_age , shift_size ) logger . level = @logger . level logger . formatter = @logger . formatter @logger = logger end | Creates a new Logger to write log messages to using the parameters specified . This method is executed asynchronously . |
20,352 | def severity = ( level ) if level . is_a? ( String ) severity = { 'FATAL' => Logger :: Severity :: FATAL , 'ERROR' => Logger :: Severity :: ERROR , 'WARN' => Logger :: Severity :: WARN , 'INFO' => Logger :: Severity :: INFO , 'DEBUG' => Logger :: Severity :: DEBUG , '4' => Logger :: Severity :: FATAL , '3' => Logger ::... | Sets the severity level of the logger . This method is executed asynchronously . |
20,353 | def categories = ( categories ) raise TypeException unless categories . is_a? ( Array ) categories . each { | item | raise TypeException unless Category . all . include? ( item ) raise DuplicateElementException if @categories . include? ( item ) @categories . push ( item ) } end | Set array of categories |
20,354 | def print ( formatted = false ) result = "#{rule}, #{description}" if formatted if failure result = "#{FORMATTING_BALL} #{result}" . colorize ( :red ) else result = "#{FORMATTING_WARNING} #{result}" . colorize ( :yellow ) end end result += "\n#{location.print}" unless location . nil? result += "\nRECOMMENDATION: #{reco... | Get formatted information about findings |
20,355 | def critical_items ( percentage = 75 ) raise ArgumentError , "Percentage must be an Integer between 0 and 100" if ! percentage . between? ( 0 , 100 ) response = api_response ( "critical-items" , percentage ) return response [ "requested_information" ] end | Gets the user s current items under Critical Items . |
20,356 | def find_method_with_line ( cm , line ) unless cm . kind_of? ( Rubinius :: CompiledMethod ) return nil end lines = lines_of_method ( cm ) return cm if lines . member? ( line ) scope = cm . scope return nil unless scope and scope . current_script cm = scope . current_script . compiled_code lines = lines_of_method ( cm )... | Returns a CompiledMethod for the specified line . We search the current method + meth + and then up the parent scope . If we hit the top and we can t find + line + that way then we reverse the search from the top and search down . This will add all siblings of ancestors of + meth + . |
20,357 | def register_channel ( channel , service ) _channel = channel . downcase unless @channels [ _channel ] @channels [ _channel ] = service GameOverseer :: Console . log ( "ChannelManager> mapped '#{_channel}' to '#{service.class}'." ) else raise "Could not map channel '#{_channel}' because '#{@channels[data[_channel]].cla... | Enables a service to subscribe to a channel |
20,358 | def phone ( phone_number , options = { } ) options = { :account_sid => account_sid , :auth_token => auth_token , :format => 'text' , } . merge ( options ) options [ :format ] = options [ :format ] . to_s . strip . downcase unless %w( text json ) . include? options [ :format ] raise ArgumentError . new "Unsupported form... | Look up a phone number and return the caller s name . |
20,359 | def two_digit_number ( number , combined = false ) words = combined ? simple_number_to_words_combined ( number ) : simple_number_to_words ( number ) return words if ( words != 'not_found' ) rest = number % 10 format = "spell_number.formats.tens.#{rest == 0 ? 'no_rest' : 'rest'}" first_digit = simple_number_to_words ( n... | Transforms a two - digit number from 0 to 99 |
20,360 | def simple_number_to_words_combined ( number ) words = I18n . t ( "spell_number.numbers.number_#{number}_combined" , :locale => @options [ :locale ] , :default => 'not_found' ) words = simple_number_to_words ( number ) if ( words == 'not_found' ) words end | Returns the combined number if it exists in the file otherwise it will return the simple_number_to_words |
20,361 | def combine_pdfs ( combine_pdfs_data , opts = { } ) data , _status_code , _headers = combine_pdfs_with_http_info ( combine_pdfs_data , opts ) data end | Merge submission PDFs template PDFs or custom files |
20,362 | def combine_submissions ( combined_submission_data , opts = { } ) data , _status_code , _headers = combine_submissions_with_http_info ( combined_submission_data , opts ) data end | Merge generated PDFs together |
20,363 | def create_custom_file_from_upload ( create_custom_file_data , opts = { } ) data , _status_code , _headers = create_custom_file_from_upload_with_http_info ( create_custom_file_data , opts ) data end | Create a new custom file from a cached presign upload |
20,364 | def create_data_request_token ( data_request_id , opts = { } ) data , _status_code , _headers = create_data_request_token_with_http_info ( data_request_id , opts ) data end | Creates a new data request token for form authentication |
20,365 | def create_template_from_upload ( create_template_data , opts = { } ) data , _status_code , _headers = create_template_from_upload_with_http_info ( create_template_data , opts ) data end | Create a new PDF template from a cached presign upload |
20,366 | def expire_combined_submission ( combined_submission_id , opts = { } ) data , _status_code , _headers = expire_combined_submission_with_http_info ( combined_submission_id , opts ) data end | Expire a combined submission |
20,367 | def expire_submission ( submission_id , opts = { } ) data , _status_code , _headers = expire_submission_with_http_info ( submission_id , opts ) data end | Expire a PDF submission |
20,368 | def generate_pdf ( template_id , submission_data , opts = { } ) data , _status_code , _headers = generate_pdf_with_http_info ( template_id , submission_data , opts ) data end | Generates a new PDF |
20,369 | def get_data_request ( data_request_id , opts = { } ) data , _status_code , _headers = get_data_request_with_http_info ( data_request_id , opts ) data end | Look up a submission data request |
20,370 | def get_submission ( submission_id , opts = { } ) data , _status_code , _headers = get_submission_with_http_info ( submission_id , opts ) data end | Check the status of a PDF |
20,371 | def get_submission_batch ( submission_batch_id , opts = { } ) data , _status_code , _headers = get_submission_batch_with_http_info ( submission_batch_id , opts ) data end | Check the status of a submission batch job |
20,372 | def get_template ( template_id , opts = { } ) data , _status_code , _headers = get_template_with_http_info ( template_id , opts ) data end | Check the status of an uploaded template |
20,373 | def get_template_schema ( template_id , opts = { } ) data , _status_code , _headers = get_template_schema_with_http_info ( template_id , opts ) data end | Fetch the JSON schema for a template |
20,374 | def update_data_request ( data_request_id , update_submission_data_request_data , opts = { } ) data , _status_code , _headers = update_data_request_with_http_info ( data_request_id , update_submission_data_request_data , opts ) data end | Update a submission data request |
20,375 | def next_root_lft last_root = nested_interval_scope . roots . order ( rgtp : :desc , rgtq : :desc ) . first raise Exception . new ( "Only one root allowed" ) if last_root . present? && ! self . class . nested_interval . multiple_roots? last_root . try ( :right ) || 0 . to_r end | Returns left end of interval for next root . |
20,376 | def report ( opts = { } ) default_options = { :user => 'all' , :group_subaccount => true , :report_type => 'basic' } opts . reverse_merge! default_options post 'report' , opts , "report_#{opts[:report_type]}" . to_sym end | This request will provide information about one or more accounts under your platform in CSV format |
20,377 | def load_auth_from_yaml self . class . auth_yaml_paths . map { | path | File . expand_path ( path ) } . select { | path | File . exist? ( path ) } . each do | path | auth = YAML . load ( File . read ( path ) ) @username = auth [ 'username' ] @password = auth [ 'password' ] return if @username && @password end raise "Co... | Load the platform authentication informaiton from a YAML file |
20,378 | def download_manifest_only FastlaneCore :: UI . message ( 'download_manifest_only...' ) rsa_key = load_rsa_key ( rsa_keypath ) success = true if ! rsa_key . nil? FastlaneCore :: UI . message ( 'Logging in with RSA key for download...' ) Net :: SSH . start ( host , user , key_data : rsa_key , keys_only : true ) do | ssh... | Download metadata only |
20,379 | def check_ipa ( local_ipa_path ) if File . exist? ( local_ipa_path ) FastlaneCore :: UI . important ( 'IPA found at ' + local_ipa_path ) return true else FastlaneCore :: UI . verbose ( 'IPA at given path does not exist yet.' ) return false end end | Check IPA existence locally |
20,380 | def download_manifest ( sftp ) FastlaneCore :: UI . message ( 'Checking remote Manifest' ) json = nil remote_manifest_path = remote_manifest_path ( appcode ) begin sftp . stat! ( remote_manifest_path ) do | response | if response . ok? FastlaneCore :: UI . success ( 'Loading remote manifest:' ) manifest = sftp . downlo... | Downloads remote manifest self . appcode required by options . |
20,381 | def upload_ipa ( sftp , local_ipa_path , remote_ipa_path ) msg = "[Uploading IPA] #{local_ipa_path} to #{remote_ipa_path}" FastlaneCore :: UI . message ( msg ) result = sftp . upload! ( local_ipa_path , remote_ipa_path ) do | event , _uploader , * _args | case event when :open then putc '.' when :put then putc '.' $std... | Upload current IPA |
20,382 | def upload_manifest ( sftp , local_path , remote_path ) msg = '[Uploading Manifest] ' + local_path + ' to ' + remote_path FastlaneCore :: UI . message ( msg ) result = sftp . upload! ( local_path , remote_path ) do | event , _uploader , * _args | case event when :finish then FastlaneCore :: UI . success ( 'Manifest upl... | Upload current manifest . json |
20,383 | def load_rsa_key ( rsa_keypath ) File . open ( rsa_keypath , 'r' ) do | file | rsa_key = nil rsa_key = [ file . read ] if ! rsa_key . nil? FastlaneCore :: UI . success ( 'Successfully loaded RSA key...' ) else FastlaneCore :: UI . user_error! ( 'Failed to load RSA key...' ) end rsa_key end end | Private methods - Local Operations |
20,384 | def check_code_name ( code_name ) [ code_name . pluralize , code_name . singularize ] . each { | name | %w{ self_and_ancestors descendants } . each { | m | return false if template . send ( m ) . map ( & :code_name ) . include? ( name ) } } true end | Check if there is code_name in template branch |
20,385 | def print result = "in #{path}" if ! begin_line . nil? && ! end_line . nil? if begin_line != end_line if ! begin_column . nil? && ! end_column . nil? result += ", line #{begin_line}:#{begin_column} to line #{end_line}:#{end_column}" elsif ! begin_column . nil? && end_column . nil? result += ", line #{begin_line}:#{begi... | Get formatted information about location |
20,386 | def level_items_list ( type , levels ) levels = levels . join ( ',' ) if levels . is_a? ( Array ) response = api_response ( type , levels ) if response [ "requested_information" ] . is_a? ( Hash ) return response [ "requested_information" ] [ "general" ] else return response [ "requested_information" ] end end | Fetches the specified item type list from WaniKani s API |
20,387 | def check_expired_resources net_resources = :: NetResource . expired net_resources . each do | resource | http = EM :: HttpRequest . new ( resource . url ) . get http . callback { | response | resource . set_next_update if resource_changed? ( resource , response ) resource . body = response . response update_changed_re... | Adds a periodic timer to the Eventmachine reactor loop and immediately starts grabbing expired resources and checking them . |
20,388 | def notify_subscribers ( resource ) resource . subscriptions . each do | subscription | http = EM :: HttpRequest . new ( subscription . url ) . post ( :body => { :data => resource . body } ) http . callback { | response | puts "POSTed updated data for #{resource.url}, #{resource.body.length} characters" } http . errbac... | Notifies each of a NetResource s subscribers that the resource has changed by doing an HTTP POST request to the subscriber s callback url . |
20,389 | def resource_changed? ( resource , response ) changed = false puts "checking for changes on #{resource.url}" puts "response.response.hash: #{response.response.hash}" puts "resource.last_modified_hash: #{resource.last_modified_hash}" if response . response . hash != resource . last_modified_hash puts "changed!!!!\n\n\n\... | Determines whether a resource has changed by comparing its saved hash value with the hash value of the response content . |
20,390 | def update_changed_resource ( resource , response ) resource . last_modified_hash = response . response . hash resource . last_updated = Time . now resource . body = response . response resource . save end | Updates the resource s fields when the resource has changed . The last_modified_hash is set to the hash value of the response body the response body itself is saved so that it can be sent to consumers during notifications and the resource s last_updated time is set to the current time . |
20,391 | def default res = FalkorLib :: Config :: DEFAULTS . clone $LOADED_FEATURES . each do | path | res [ :git ] = FalkorLib :: Config :: Git :: DEFAULTS if path . include? ( 'lib/falkorlib/git.rb' ) res [ :gitflow ] = FalkorLib :: Config :: GitFlow :: DEFAULTS if path . include? ( 'lib/falkorlib/git.rb' ) res [ :versioning ... | Build the default configuration hash to be used to initiate the default . The hash is built depending on the loaded files . |
20,392 | def config_file ( dir = Dir . pwd , type = :local , options = { } ) path = normalized_path ( dir ) path = FalkorLib :: Git . rootdir ( path ) if FalkorLib :: Git . init? ( path ) raise FalkorLib :: Error , "Wrong FalkorLib configuration type" unless FalkorLib . config [ :config_files ] . keys . include? ( type . to_sym... | get get_or_save wrapper for get and save operations |
20,393 | def most_recent_project_path @preferences = PreferenceFile . load project = preference ( RecentProjectsPath ) . split ( ', ' ) . first File :: exists? ( project ) ? project : nil end | Returns most recently open project . If Project Navigator has a project open that project will be used . This function re - loads the preferences file upon each call to ensure we don t have stale data . |
20,394 | def ingest_prefs ( prefs ) fail 'Invaid Prefs class' unless prefs . kind_of? ( Prefs ) prefs . prompts . each do | p | section_sym = p . config_section . to_sym add_section ( section_sym ) unless @data . key? ( section_sym ) @data [ section_sym ] . merge! ( p . config_key . to_sym => p . answer ) end end | Ingests a Prefs class and adds its answers to the configuration data . |
20,395 | def method_missing ( name , * args , & block ) if name [ - 1 , 1 ] == '=' @data [ name [ 0 .. - 2 ] . to_sym ] = args [ 0 ] else @data [ name . to_sym ] ||= { } end end | Hook that fires when a non - existent method is called . Allows this module to return data from the config Hash when given a method name that matches a key . |
20,396 | def load return false unless filename require filename begin version . migration_class_name . constantize if version . migration . is_a? ( Cassie :: Schema :: Migration ) version else false end rescue NameError raise NameError . new ( "Expected #{version.migration_class_name} to be defined in #{filename}, but it was no... | Requires the ruby file thus loading the Migration class into the ObjectSpace . |
20,397 | def nullable_attributes ( * attrs ) @nullable_attributes ||= [ ] if attrs . any? @nullable_attributes . map! ( & :to_sym ) . concat ( attrs ) . uniq! if attrs . any? end @nullable_attributes end | Nullable attributes are sent as null in the request |
20,398 | def array_window ( array , window_size ) window_size < 1 and raise ArgumentError , "window_size = #{window_size} < 1" window_size = window_size . to_i window_size += 1 if window_size % 2 == 0 radius = window_size / 2 array . each_index do | i | ws = window_size from = i - radius negative_from = false if from < 0 negati... | Let a window of size + window_size + slide over the array + array + and yield to the window array . |
20,399 | def << ( times ) r = times . shift @repeat += 1 if @times [ :repeat ] . last != r @times [ :repeat ] << r TIMES . zip ( times ) { | t , time | @times [ t ] << time . to_f } self end | Add the array + times + to this clock s time measurements . + times + consists of the time measurements in float values in order of TIMES . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.