idx int64 0 24.9k | question stringlengths 68 4.14k | target stringlengths 9 749 |
|---|---|---|
16,200 | def render ( opts = { } ) options = { variant_encoding : true } . merge ( opts ) target = ( self . variant? && options [ :variant_encoding ] ) ? self . variant : @unified EmojiChar :: unified_to_char ( target ) end | Renders an EmojiChar to its string glyph representation suitable for printing to screen . |
16,201 | def chars results = [ self . render ( { variant_encoding : false } ) ] @variations . each do | variation | results << EmojiChar :: unified_to_char ( variation ) end @chars ||= results end | Returns a list of all possible UTF - 8 string renderings of an EmojiChar . |
16,202 | def render ( args ) ERB . new ( template , nil , '-' ) . result ( ERBContext . new ( args ) . get_binding ) end | Load a template with a given name . |
16,203 | def - x case x when Numeric return self . class . new! ( ajd - x , offset ) when Date return ajd - x . ajd end raise TypeError , 'expected numeric or date' end | If + x + is a Numeric value create a new Date object that is + x + days earlier than the current one . |
16,204 | def >> n y , m = ( year * 12 + ( mon - 1 ) + n ) . divmod ( 12 ) m , = ( m + 1 ) . divmod ( 1 ) d = mday until jd2 = _valid_civil? ( y , m , d ) d -= 1 raise ArgumentError , 'invalid date' unless d > 0 end self + ( jd2 - jd ) end | Return a new Date object that is + n + months later than the current one . |
16,205 | def new ( name = nil , value = nil ) config = CZTop :: Config . new ( name , value , parent : @config ) yield config if block_given? config end | Adds a new Config item and yields it so it can be configured in a block . |
16,206 | def CURVE_client! ( client_cert , server_cert ) if server_cert . secret_key raise SecurityError , "server's secret key not secret" end client_cert . apply ( self ) options . CURVE_serverkey = server_cert . public_key end | Enables CURVE security and makes this socket a CURVE client . |
16,207 | def connect ( endpoint ) rc = ffi_delegate . connect ( "%s" , :string , endpoint ) raise ArgumentError , "incorrect endpoint: %p" % endpoint if rc == - 1 end | Connects to an endpoint . |
16,208 | def disconnect ( endpoint ) rc = ffi_delegate . disconnect ( "%s" , :string , endpoint ) raise ArgumentError , "incorrect endpoint: %p" % endpoint if rc == - 1 end | Disconnects from an endpoint . |
16,209 | def bind ( endpoint ) rc = ffi_delegate . bind ( "%s" , :string , endpoint ) raise_zmq_err ( "unable to bind to %p" % endpoint ) if rc == - 1 @last_tcp_port = rc if rc > 0 end | Binds to an endpoint . |
16,210 | def unbind ( endpoint ) rc = ffi_delegate . unbind ( "%s" , :string , endpoint ) raise ArgumentError , "incorrect endpoint: %p" % endpoint if rc == - 1 end | Unbinds from an endpoint . |
16,211 | def resource ( id ) hash = http_get ( url ( '/resources/%s' , id ) ) Resource . new ( hash ) rescue :: Hawkular :: Exception => e return if e . cause . is_a? ( :: RestClient :: NotFound ) raise end | Get single resource by id |
16,212 | def children_resources ( parent_id ) http_get ( url ( '/resources/%s/children' , parent_id ) ) [ 'results' ] . map { | r | Resource . new ( r ) } end | Get childrens of a resource |
16,213 | def parent ( id ) hash = http_get ( url ( '/resources/%s/parent' , id ) ) Resource . new ( hash ) if hash end | Get parent of a resource |
16,214 | def configure ( port ) @actor . send_picture ( "si" , :string , "CONFIGURE" , :int , port ) ptr = Zstr . recv ( @actor ) HasFFIDelegate . raise_zmq_err if ptr . null? hostname = ptr . read_string return hostname unless hostname . empty? raise NotImplementedError , "system doesn't support UDP broadcasts" end | Run the beacon on the specified UDP port . |
16,215 | def publish ( data , interval ) raise ArgumentError , "data too long" if data . bytesize > MAX_BEACON_DATA @actor . send_picture ( "sbi" , :string , "PUBLISH" , :string , data , :int , data . bytesize , :int , interval ) end | Start broadcasting a beacon . |
16,216 | def get_tokens ( credentials = { } ) creds = credentials . empty? ? @credentials : credentials auth_header = { Authorization : base_64_credentials ( creds ) } http_get ( '/secret-store/v1/tokens' , auth_header ) end | Create a new Secret Store client |
16,217 | def encode ( input ) raise ArgumentError , "wrong input length" if input . bytesize % 4 > 0 input = input . dup . force_encoding ( Encoding :: BINARY ) ptr = ffi_delegate . encode ( input , input . bytesize ) raise_zmq_err if ptr . null? z85 = ptr . read_string z85 . encode! ( Encoding :: ASCII ) return z85 end | Encodes to Z85 . |
16,218 | def decode ( input ) raise ArgumentError , "wrong input length" if input . bytesize % 5 > 0 zchunk = ffi_delegate . decode ( input ) raise_zmq_err if zchunk . null? decoded_string = zchunk . data . read_string ( zchunk . size - 1 ) return decoded_string end | Decodes from Z85 . |
16,219 | def to_ruby ( result = '' ) if arity result << " def #{name}(" args = if arity >= 0 ( 1 .. arity ) . map { | i | "x#{i}" } else ( 1 .. ~ arity ) . map { | i | "x#{i}" } << '*rest' end if block_expected? args << '&block' end result << args * ', ' result << ") end\n" else result << " understand :#{name}\n" end end | Concatenates a method signature as ruby code to the + result + string and returns it . |
16,220 | def check_class ( klass ) unless klass . method_defined? ( name ) raise NotImplementedErrorCheckError . new ( self , "method '#{name}' not implemented in #{klass}" ) end check_method = klass . instance_method ( name ) if arity and ( check_arity = check_method . arity ) != arity raise ArgumentErrorCheckError . new ( sel... | Check class + klass + against this Message instance and raise a CheckError exception if necessary . |
16,221 | def check_object ( object ) if ! object . respond_to? ( name ) raise NotImplementedErrorCheckError . new ( self , "method '#{name}' not responding in #{object}" ) end check_method = object . method ( name ) if arity and ( check_arity = check_method . arity ) != arity raise ArgumentErrorCheckError . new ( self , "wrong ... | Check object + object + against this Message instance and raise a CheckError exception if necessary . |
16,222 | def files cli_arguments . each_with_index do | filename , index | if Dir . exist? ( filename ) cli_arguments [ index ] = Dir [ "#{filename}/**/*.md" ] end end cli_arguments . flatten! cli_arguments end | List of markdown files from argument list . |
16,223 | def lint config . javascript_files . each do | file | file_content = get_file_content_as_json ( file ) code = %( JSHINT(#{file_content}, #{jshint_options}, #{jshint_globals}); return JSHINT.errors; ) errors [ file ] = context . exec ( code ) end end | Sets up our Linting behaviour |
16,224 | def generate_query_params ( params = { } ) params = params . reject { | _k , v | v . nil? || ( ( v . instance_of? Array ) && v . empty? ) } return '' if params . empty? params . inject ( '?' ) do | ret , ( k , v ) | ret += '&' unless ret == '?' part = v . instance_of? ( Array ) ? "#{k}=#{v.join(',')}" : "#{k}=#{v}" ret... | Generate a query string from the passed hash starting with ? Values may be an array in which case the array values are joined together by . |
16,225 | def << ( frame ) case frame when String mem = FFI :: MemoryPointer . from_string ( frame ) rc = ffi_delegate . addmem ( mem , mem . size - 1 ) when Frame rc = ffi_delegate . append ( frame . ffi_delegate ) else raise ArgumentError , "invalid frame: %p" % frame end raise_zmq_err unless rc == 0 self end | Append a frame to this message . |
16,226 | def prepend ( frame ) case frame when String mem = FFI :: MemoryPointer . from_string ( frame ) rc = ffi_delegate . pushmem ( mem , mem . size - 1 ) when Frame rc = ffi_delegate . prepend ( frame . ffi_delegate ) else raise ArgumentError , "invalid frame: %p" % frame end raise_zmq_err unless rc == 0 end | Prepend a frame to this message . |
16,227 | def pop ptr = ffi_delegate . pop return nil if ptr . null? Frame . from_ffi_delegate ( ptr ) . to_s end | Removes first part from message and returns it as a string . |
16,228 | def to_a ffi_delegate = ffi_delegate ( ) frame = ffi_delegate . first return [ ] if frame . null? arr = [ frame . data . read_bytes ( frame . size ) ] while frame = ffi_delegate . next and not frame . null? arr << frame . data . read_bytes ( frame . size ) end return arr end | Returns all frames as strings in an array . This is useful if for quick inspection of the message . |
16,229 | def routing_id = ( new_routing_id ) raise ArgumentError unless new_routing_id . is_a? Integer raise RangeError if new_routing_id < 0 ffi_delegate . set_routing_id ( new_routing_id ) end | Sets a new routing ID . |
16,230 | def first_failing ( conflict_set_size , crs , continuous : false , max_iterations : nil ) min_idx = conflict_set_size max_idx = crs . nb_constraints - 1 loop do unless max_iterations . nil? return min_idx .. max_idx if max_iterations <= 0 max_iterations -= 1 end half_constraint_idx = ( max_idx + min_idx ) / 2 crs2 = cr... | finds the first constraint from constraints that makes the problem infeasible |
16,231 | def add_siblings ( * args ) options = args . extract_options! case options [ :half ] when :father check_incompatible_relationship ( :paternal_half_sibling , * args ) when :mother check_incompatible_relationship ( :maternal_half_sibling , * args ) when nil check_incompatible_relationship ( :sibling , * args ) end transa... | add siblings by assigning same parents to individuals passed as arguments |
16,232 | def remove_siblings ( * args ) options = args . extract_options! raise ArgumentError . new ( "Unknown option value: half: #{options[:half]}." ) if ( options [ :half ] and ! [ :father , :mother ] . include? ( options [ :half ] ) ) resulting_indivs = if args . blank? siblings ( options ) else args & siblings ( options ) ... | remove siblings by nullifying parents of passed individuals |
16,233 | def add_children ( * args ) options = args . extract_options! raise_if_sex_undefined check_incompatible_relationship ( :children , * args ) transaction do args . inject ( true ) do | res , child | res &= case sex_before_type_cast when gclass . sex_male_value child . add_mother ( options [ :spouse ] ) if options [ :spou... | add children by assigning self as parent |
16,234 | def remove_children ( * args ) options = args . extract_options! raise_if_sex_undefined resulting_indivs = if args . blank? children ( options ) else args & children ( options ) end transaction do resulting_indivs . each do | child | if options [ :remove_other_parent ] == true child . remove_parents else case sex_befor... | remove children by nullifying the parent corresponding to self |
16,235 | def add_current_spouse ( spouse ) raise_unless_current_spouse_enabled check_incompatible_relationship ( :current_spouse , spouse ) if gclass . perform_validation_enabled self . current_spouse = spouse spouse . current_spouse = self transaction do spouse . save! save! end else transaction do self . update_attribute ( :c... | add current spouse updating receiver and argument individuals foreign_key in a transaction |
16,236 | def remove_current_spouse raise_unless_current_spouse_enabled if gclass . perform_validation_enabled ex_current_spouse = current_spouse current_spouse . current_spouse = nil self . current_spouse = nil transaction do ex_current_spouse . save! save! end else transaction do current_spouse . update_attribute ( :current_sp... | remove current spouse resetting receiver and argument individuals foreign_key in a transaction |
16,237 | def add ( reader ) rc = ffi_delegate . add ( reader ) raise_zmq_err ( "unable to add socket %p" % reader ) if rc == - 1 remember_socket ( reader ) end | Initializes the Poller . At least one reader has to be given . |
16,238 | def remove ( reader ) rc = ffi_delegate . remove ( reader ) raise_zmq_err ( "unable to remove socket %p" % reader ) if rc == - 1 forget_socket ( reader ) end | Removes a reader socket from the poller . |
16,239 | def wait ( timeout = - 1 ) ptr = ffi_delegate . wait ( timeout ) if ptr . null? raise Interrupt if ffi_delegate . terminated return nil end return socket_by_ptr ( ptr ) end | Waits and returns the first socket that becomes readable . |
16,240 | def typos results = [ ] FFI :: Aspell :: Speller . open ( Configuration [ :language ] ) do | speller | TextLine . scan ( document ) . each do | line | line . words . each do | word | next if ignored? word unless speller . correct? word results << Typo . new ( line , word , speller . suggestions ( word ) ) end end end e... | Create a new instance from specified file . |
16,241 | def data_by_tags ( tags , buckets : nil , bucketDuration : nil , start : nil , ends : nil ) data = { tags : tags_param ( tags ) , buckets : buckets , bucketDuration : bucketDuration , start : start , end : ends } http_post ( 'metrics/stats/query' , data ) end | Retrieve all types of metrics datapoints by tags |
16,242 | def push_data ( gauges : [ ] , counters : [ ] , availabilities : [ ] , strings : [ ] ) gauges . each { | g | default_timestamp g [ :data ] } counters . each { | g | default_timestamp g [ :data ] } availabilities . each { | g | default_timestamp g [ :data ] } strings . each { | g | default_timestamp g [ :data ] } data =... | Push data for multiple metrics of all supported types |
16,243 | def query_stats ( gauge_ids : [ ] , counter_ids : [ ] , avail_ids : [ ] , rates : false , starts : nil , ends : nil , bucket_duration : '3600s' ) path = '/metrics/stats/query' metrics = { gauge : gauge_ids , counter : counter_ids , availability : avail_ids } data = { metrics : metrics , start : starts , end : ends , bu... | Fetch stats for multiple metrics of all supported types |
16,244 | def tags tags = [ ] http_get ( '/metrics/' ) . map do | g | next if g [ 'tags' ] . nil? g [ 'tags' ] . map do | k , v | tags << { k => v } end end tags . uniq! end | Fetch all tags for metrics definitions |
16,245 | def outset_bisectors ( length ) vertices . zip ( spokes ) . map { | v , b | b ? Edge . new ( v , v + ( b * length ) ) : nil } end | Vertex bisectors suitable for outsetting |
16,246 | def call ( name , given_options ) evaluated_options = @dynamic_options . ( name , given_options ) options = Variables . merge ( @static_options , handle_array_and_deprecate ( evaluated_options ) ) options = Variables . merge ( options , handle_array_and_deprecate ( given_options ) ) end | Evaluate defaults and merge given_options into them . |
16,247 | def []= ( key , value ) if value ffi_delegate . set_meta ( key , "%s" , :string , value ) else ffi_delegate . unset_meta ( key ) end end | Set metadata . |
16,248 | def meta_keys zlist = ffi_delegate . meta_keys first_key = zlist . first return [ ] if first_key . null? keys = [ first_key . read_string ] while key = zlist . next break if key . null? keys << key . read_string end keys end | Returns meta keys set . |
16,249 | def direction_intersect ( other_set ) self . class . new . tap do | memo | unless other_set . keys . empty? a ( memo , other_set ) b ( memo , other_set ) end c ( memo ) d ( memo , other_set ) end end | Returns a new array containing elements common to the two arrays excluding any duplicates . |
16,250 | def - ( other_set ) self . class . new . tap do | memo | each do | a | b = other_set . assoc ( a . first ) next if b memo << a end end end | Array Difference - Returns a new set that is a copy of the original set removing any items that also appear in + other_set + . The order is preserved from the original set . |
16,251 | def a ( memo , other ) if keys == other . keys . take ( keys . size ) keys . each do | order | if other . keys . include? ( order ) memo << [ order , flip_direction ( other . assoc ( order ) . last ) ] end end else keys . each do | order | if other . keys . include? ( order ) memo << other . assoc ( order ) end end end... | If the order of keys match upto the size of the set then flip them |
16,252 | def b ( memo , other ) other . keys . each do | sort | if keys . include? ( sort ) && ! memo . keys . include? ( sort ) memo << other . assoc ( sort ) end end end | Add items from other that are common and not already added |
16,253 | def c ( memo ) each do | order | unless memo . keys . include? ( order [ 0 ] ) memo << order end end end | Add items not in memo |
16,254 | def d ( memo , other ) other . each do | sort | unless memo . keys . include? ( sort [ 0 ] ) memo << sort end end end | Add items from other not in memo |
16,255 | def list_triggers ( ids = [ ] , tags = [ ] ) query = generate_query_params 'triggerIds' => ids , 'tags' => tags sub_url = '/triggers' + query ret = http_get ( sub_url ) val = [ ] ret . each { | t | val . push ( Trigger . new ( t ) ) } val end | Lists defined triggers in the system |
16,256 | def get_single_trigger ( trigger_id , full = false ) the_trigger = '/triggers/' + trigger_id ret = http_get ( the_trigger ) trigger = Trigger . new ( ret ) if full ret = http_get ( the_trigger + '/conditions' ) ret . each { | c | trigger . conditions . push ( Trigger :: Condition . new ( c ) ) } ret = http_get ( the_tr... | Obtains one Trigger definition from the server . |
16,257 | def create_trigger ( trigger , conditions = [ ] , dampenings = [ ] , _actions = [ ] ) full_trigger = { } full_trigger [ :trigger ] = trigger . to_h conds = [ ] conditions . each { | c | conds . push ( c . to_h ) } full_trigger [ :conditions ] = conds damps = [ ] dampenings . each { | d | damps . push ( d . to_h ) } unl... | Creates the trigger definition . |
16,258 | def set_group_conditions ( trigger_id , trigger_mode , group_conditions_info ) ret = http_put "triggers/groups/#{trigger_id}/conditions/#{trigger_mode}" , group_conditions_info . to_h conditions = [ ] ret . each { | c | conditions . push ( Trigger :: Condition . new ( c ) ) } conditions end | Creates the group conditions definitions . |
16,259 | def list_members ( trigger_id , orphans = false ) ret = http_get "triggers/groups/#{trigger_id}/members?includeOrphans=#{orphans}" ret . collect { | t | Trigger . new ( t ) } end | Lists members of a group trigger |
16,260 | def create_group_dampening ( dampening ) ret = http_post "triggers/groups/#{dampening.trigger_id}/dampenings" , dampening . to_h Trigger :: Dampening . new ( ret ) end | Creates a dampening for a group trigger |
16,261 | def update_group_dampening ( dampening ) ret = http_put "triggers/groups/#{dampening.trigger_id}/dampenings/#{dampening.dampening_id}" , dampening . to_h Trigger :: Dampening . new ( ret ) end | Updates a dampening for a group trigger |
16,262 | def create_action ( plugin , action_id , properties = { } ) the_plugin = hawk_escape plugin http_get ( "/plugins/#{the_plugin}" ) payload = { actionId : action_id , actionPlugin : plugin , properties : properties } ret = http_post ( '/actions' , payload ) Trigger :: Action . new ( ret ) end | Creates the action . |
16,263 | def get_action ( plugin , action_id ) the_plugin = hawk_escape plugin the_action_id = hawk_escape action_id ret = http_get "/actions/#{the_plugin}/#{the_action_id}" Trigger :: Action . new ( ret ) end | Obtains one action of given action plugin from the server . |
16,264 | def delete_action ( plugin , action_id ) the_plugin = hawk_escape plugin the_action_id = hawk_escape action_id http_delete "/actions/#{the_plugin}/#{the_action_id}" end | Deletes the action of given action plugin . |
16,265 | def get_alerts_for_trigger ( trigger_id ) return [ ] unless trigger_id url = '/?triggerIds=' + trigger_id ret = http_get ( url ) val = [ ] ret . each { | a | val . push ( Alert . new ( a ) ) } val end | Obtain the alerts for the Trigger with the passed id |
16,266 | def alerts ( criteria : { } , tenants : nil ) query = generate_query_params ( criteria ) uri = tenants ? '/admin/alerts/' : '/' ret = http_get ( uri + query , multi_tenants_header ( tenants ) ) val = [ ] ret . each { | a | val . push ( Alert . new ( a ) ) } val end | List fired alerts |
16,267 | def get_single_alert ( alert_id ) ret = http_get ( '/alert/' + alert_id ) val = Alert . new ( ret ) val end | Retrieve a single Alert by its id |
16,268 | def resolve_alert ( alert_id , by = nil , comment = nil ) sub_url = "/resolve/#{alert_id}" query = generate_query_params 'resolvedBy' => by , 'resolvedNotes' => comment sub_url += query http_put ( sub_url , { } ) true end | Mark one alert as resolved |
16,269 | def create_event ( id , category , text , extras ) event = { } event [ 'id' ] = id event [ 'ctime' ] = Time . now . to_i * 1000 event [ 'category' ] = category event [ 'text' ] = text event . merge! ( extras ) { | _key , v1 , _v2 | v1 } http_post ( '/events' , event ) end | Inject an event into Hawkular - alerts |
16,270 | def add_tags ( alert_ids , tags ) query = generate_query_params ( alertIds : alert_ids , tags : tags ) http_put ( '/tags' + query , { } ) end | Add tags to existing Alerts . |
16,271 | def remove_tags ( alert_ids , tag_names ) query = generate_query_params ( alertIds : alert_ids , tagNames : tag_names ) http_delete ( '/tags' + query ) end | Remove tags from existing Alerts . |
16,272 | def lookup ( pubkey ) ptr = ffi_delegate . lookup ( pubkey ) return nil if ptr . null? Certificate . from_ffi_delegate ( ptr ) end | Initializes a new certificate store . |
16,273 | def insert ( cert ) raise ArgumentError unless cert . is_a? ( Certificate ) @_inserted_pubkeys ||= Set . new pubkey = cert . public_key raise ArgumentError if @_inserted_pubkeys . include? pubkey ffi_delegate . insert ( cert . ffi_delegate ) @_inserted_pubkeys << pubkey end | Inserts a new certificate into the store . |
16,274 | def record ( method , * args , & block ) self << { method : method , args : DeepDup . ( args ) , block : block } end | Record inheritable assignments for replay in an inheriting class . |
16,275 | def find_method_module ( methodname , ancestors ) methodname = methodname . to_s ancestors . each do | a | begin a . instance_method ( methodname ) return a rescue NameError end end nil end | This Method tries to find the first module that implements the method named + methodname + in the array of + ancestors + . If this fails nil is returned . |
16,276 | def listen ( * events ) events . each do | event | EVENTS . include? ( event ) or raise ArgumentError , "invalid event: #{event.inspect}" end @actor << [ "LISTEN" , * events ] end | Configure monitor to listen for specific events . |
16,277 | def print_errors_for_code ( code , errors ) name = fetch_error_messages ( code , errors ) output << " <testcase classname=\"jshint.#{code}\" name=\"#{escape(name)}\">\n" errors . each do | error | output << add_error_message ( code , error ) end output << " </testcase>\n" output end | Appends new error elements to the Report output |
16,278 | def to_ruby ( result = '' ) result << "#{name} = Protocol do" first = true if messages . empty? result << "\n" else messages . each do | m | result << "\n" m . to_ruby ( result ) end end result << "end\n" end | Concatenates the protocol as Ruby code to the + result + string and return it . At the moment this method only supports method signatures with generic argument names . |
16,279 | def understand? ( name , arity = nil ) name = name . to_s ! ! find { | m | m . name == name && ( ! arity || m . arity == arity ) } end | Returns true if it is required to understand the |
16,280 | def check_failures ( object ) check object rescue CheckFailed => e return e . errors . map { | e | e . protocol_message } end | Return all messages for whick a check failed . |
16,281 | def inherit ( modul , methodname , block_expected = nil ) Module === modul or raise TypeError , "expected Module not #{modul.class} as modul argument" methodnames = methodname . respond_to? ( :to_ary ) ? methodname . to_ary : [ methodname ] methodnames . each do | methodname | m = parse_instance_method_signature ( modu... | Inherit a method signature from an instance method named + methodname + of + modul + . This means that this protocol should understand these instance methods with their arity and block expectation . Note that automatic detection of blocks does not work for Ruby methods defined in C . You can set the + block_expected + ... |
16,282 | def method_added ( methodname ) methodname = methodname . to_s if specification? and methodname !~ / / protocol_check = instance_method ( methodname ) parser = MethodParser . new ( self , methodname ) if parser . complex? define_method ( "__protocol_check_#{methodname}" , protocol_check ) understand methodname , protoc... | Capture all added methods and either leave the implementation in place or add them to the protocol description . |
16,283 | def << ( message ) message = Message . coerce ( message ) if TERM == message [ 0 ] terminate else begin @mtx . synchronize do raise DeadActorError if not @running message . send_to ( self ) end rescue IO :: EAGAINWaitWritable retry end end self end | Creates a new actor . Either pass a callback directly or a block . The block will be called for every received message . |
16,284 | def send_picture ( picture , * args ) @mtx . synchronize do raise DeadActorError if not @running Zsock . send ( ffi_delegate , picture , * args ) end end | Sends a message according to a picture . |
16,285 | def terminate @mtx . synchronize do return false if not @running Message . new ( TERM ) . send_to ( self ) await_handler_death true end rescue IO :: EAGAINWaitWritable retry end | Tells the actor to terminate and waits for it . Idempotent . |
16,286 | def ancestors ( options = { } ) ids = [ ] if options [ :generations ] raise ArgumentError , ":generations option must be an Integer" unless options [ :generations ] . is_a? Integer generation_count = 0 generation_ids = parents . compact . map ( & :id ) while ( generation_count < options [ :generations ] ) && ( generati... | get list of known ancestrors iterateing over parents |
16,287 | def descendants ( options = { } ) ids = [ ] if options [ :generations ] generation_count = 0 generation_ids = children . map ( & :id ) while ( generation_count < options [ :generations ] ) && ( generation_ids . length > 0 ) next_gen_ids = [ ] ids += generation_ids until generation_ids . empty? ids . unshift ( generatio... | get list of known descendants iterateing over children ... |
16,288 | def uncles_and_aunts ( options = { } ) relation = case options [ :lineage ] when :paternal [ father ] when :maternal [ mother ] else parents end ids = relation . compact . inject ( [ ] ) { | memo , parent | memo |= parent . siblings ( half : options [ :half ] ) . pluck ( :id ) } gclass . where ( id : ids ) end | list of uncles and aunts iterating through parents siblings |
16,289 | def modify ( socket , events ) ptr = ptr_for_socket ( socket ) rc = ZMQ . poller_modify ( @poller_ptr , ptr , events ) HasFFIDelegate . raise_zmq_err if rc == - 1 remember_socket ( socket , events ) end | Modifies the events of interest for the given socket . |
16,290 | def remove ( socket ) ptr = ptr_for_socket ( socket ) rc = ZMQ . poller_remove ( @poller_ptr , ptr ) HasFFIDelegate . raise_zmq_err if rc == - 1 forget_socket ( socket ) end | Removes a previously registered socket . Won t raise if you re trying to remove a socket that s not registered . |
16,291 | def remove_reader ( socket ) if event_mask_for_socket ( socket ) == ZMQ :: POLLIN remove ( socket ) return end raise ArgumentError , "not registered for readability only: %p" % socket end | Removes a reader socket that was registered for readability only . |
16,292 | def remove_writer ( socket ) if event_mask_for_socket ( socket ) == ZMQ :: POLLOUT remove ( socket ) return end raise ArgumentError , "not registered for writability only: %p" % socket end | Removes a reader socket that was registered for writability only . |
16,293 | def wait ( timeout = - 1 ) rc = ZMQ . poller_wait ( @poller_ptr , @event_ptr , timeout ) if rc == - 1 case CZMQ :: FFI :: Errors . errno when Errno :: EAGAIN :: Errno , Errno :: ETIMEDOUT :: Errno return nil else HasFFIDelegate . raise_zmq_err end end return Event . new ( self , @event_ptr ) end | Waits for registered sockets to become readable or writable depending on what you re interested in . |
16,294 | def invoke_specific_operation ( operation_payload , operation_name , & callback ) fail Hawkular :: ArgumentError , 'Operation must be specified' if operation_name . nil? required = %i[ resourceId feedId ] check_pre_conditions operation_payload , required , & callback invoke_operation_helper ( operation_payload , operat... | Invokes operation on the WildFly agent that has it s own message type |
16,295 | def add_deployment ( hash , & callback ) hash [ :enabled ] = hash . key? ( :enabled ) ? hash [ :enabled ] : true hash [ :force_deploy ] = hash . key? ( :force_deploy ) ? hash [ :force_deploy ] : false required = %i[ resource_id feed_id destination_file_name binary_content ] check_pre_conditions hash , required , & call... | Deploys an archive file into WildFly |
16,296 | def undeploy ( hash , & callback ) hash [ :remove_content ] = hash . key? ( :remove_content ) ? hash [ :remove_content ] : true required = %i[ resource_id feed_id deployment_name ] check_pre_conditions hash , required , & callback hash [ :destination_file_name ] = hash [ :deployment_name ] operation_payload = prepare_p... | Undeploy a WildFly deployment |
16,297 | def enable_deployment ( hash , & callback ) required = %i[ resource_id feed_id deployment_name ] check_pre_conditions hash , required , & callback hash [ :destination_file_name ] = hash [ :deployment_name ] operation_payload = prepare_payload_hash ( [ :deployment_name ] , hash ) invoke_operation_helper ( operation_payl... | Enable a WildFly deployment |
16,298 | def export_jdr ( resource_id , feed_id , delete_immediately = false , sender_request_id = nil , & callback ) fail Hawkular :: ArgumentError , 'resource_id must be specified' if resource_id . nil? fail Hawkular :: ArgumentError , 'feed_id must be specified' if feed_id . nil? check_pre_conditions ( & callback ) invoke_sp... | Exports the JDR report |
16,299 | def update_collection_intervals ( hash , & callback ) required = %i[ resourceId feedId metricTypes availTypes ] check_pre_conditions hash , required , & callback invoke_specific_operation ( hash , 'UpdateCollectionIntervals' , & callback ) end | Updates the collection intervals . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.