idx int64 0 24.9k | question stringlengths 68 4.14k | target stringlengths 9 749 |
|---|---|---|
8,700 | def to_bson ( buffer = ByteBuffer . new , validating_keys = Config . validating_keys? ) buffer . put_bytes ( generate_data ) end | Get the object id as it s raw BSON data . |
8,701 | def to_bson ( buffer = ByteBuffer . new , validating_keys = Config . validating_keys? ) buffer . put_byte ( TRUE_BYTE ) end | Get the true boolean as encoded BSON . |
8,702 | def to_bson ( buffer = ByteBuffer . new , validating_keys = Config . validating_keys? ) position = buffer . length buffer . put_int32 ( 0 ) buffer . put_byte ( SUBTYPES [ type ] ) buffer . put_int32 ( data . bytesize ) if type == :old buffer . put_bytes ( data . force_encoding ( BINARY ) ) buffer . replace_int32 ( posi... | Encode the binary type |
8,703 | def get ( byte , field = nil ) if type = MAPPINGS [ byte ] || ( byte . is_a? ( String ) && type = MAPPINGS [ byte . ord ] ) type else handle_unsupported_type! ( byte , field ) end end | Get the class for the single byte identifier for the type in the BSON specification . |
8,704 | def to_bson ( buffer = ByteBuffer . new , validating_keys = Config . validating_keys? ) buffer . put_int64 ( ( jd - DATE_REFERENCE ) * MILLISECONDS_IN_DAY ) end | Get the date as encoded BSON . |
8,705 | def to_bson ( buffer = ByteBuffer . new , validating_keys = Config . validating_keys? ) buffer . put_cstring ( source ) buffer . put_cstring ( bson_options ) end | Get the regular expression as encoded BSON . |
8,706 | def to_bson ( buffer = ByteBuffer . new , validating_keys = Config . validating_keys? ) buffer . put_int64 ( ( to_i * 1000 ) + ( usec / 1000 ) ) end | Get the time as encoded BSON . |
8,707 | def fetch ( key , * args , & block ) key = convert_key ( key ) super ( key , * args , & block ) end | Get a value from the document for the provided key . Can use string or symbol access with string access being the faster of the two . |
8,708 | def merge! ( other ) other . each_pair do | key , value | value = yield ( convert_key ( key ) , self [ key ] , convert_value ( value ) ) if block_given? && self [ key ] self [ key ] = value end self end | Merge this document with another document returning the same document in the process . |
8,709 | def to_bson_key ( validating_keys = Config . validating_keys? ) if validating_keys raise BSON :: String :: IllegalKey . new ( self ) if BSON :: String :: ILLEGAL_KEY =~ self end self end | Get the symbol as a BSON key name encoded C symbol . |
8,710 | def inspect_methods return [ ] unless constant . respond_to? ( :methods ) methods = get_methods . map do | name | method_information ( :method , name ) end return methods . sort_by ( & :name ) end | Returns an Array containing all method objects sorted by their names . |
8,711 | def inspect_modules modules = [ ] if constant . respond_to? ( :ancestors ) parent = inspect_superclass modules = constant . ancestors . take_while do | ancestor | parent && ancestor != parent end modules = modules . select do | mod | mod . instance_of? ( Module ) && mod . name end end return modules end | Returns the modules that are included in the constant . |
8,712 | def inspect_superclass parent = nil if constant . respond_to? ( :superclass ) and constant . superclass and constant . superclass . name return constant . superclass end return parent end | Returns the superclass of the current constant or nil if there is none . |
8,713 | def get_methods ( getter = :methods ) parent = inspect_superclass || Object diff = constant . __send__ ( getter , false ) - parent . __send__ ( getter , false ) methods = diff | constant . __send__ ( getter , false ) if include_initialize? ( getter ) methods = methods | [ :initialize ] end return methods end | Gets the methods of the current constant minus those defined in Object . |
8,714 | def resolve_constant ( constant ) current = Object final = nil constant . split ( '::' ) . each do | segment | if current . const_defined? ( segment ) current = final = current . const_get ( segment ) else raise ( ArgumentError , "Constant #{segment} does not exist in #{constant}" ) end end return final end | Converts a String based constant path into an actual constant . |
8,715 | def execute_callback ( name , * args ) return unless respond_to? ( name ) unless arity_cache . key? ( name ) arity_cache [ name ] = method ( name ) . arity end if arity_cache [ name ] == 0 send ( name ) else send ( name , * args ) end end | Executes the specified callback method if it exists . |
8,716 | def constant_segments ( node = self . node ) segments = [ ] if has_child_node? ( node ) segments . concat ( constant_segments ( node . children [ 0 ] ) ) end segments << [ node . type , name_for_node ( node ) ] return segments end | Returns an Array containing the segments of a constant path . |
8,717 | def bootstrap types = VariablePredicates :: RUBY_CLASSES . values ( BOOTSTRAP_CONSTS | types ) . each do | name | load_constant ( name ) end BOOTSTRAP_GVARS . each do | gvar | definitions . define_global_variable ( gvar ) end end | Bootstraps various core definitions . |
8,718 | def load_nested_constant ( constant ) if constant . start_with? ( "::" ) constant = constant . sub ( / / , "" ) else namespaces = module_nesting . size . downto ( 1 ) . map do | n | module_nesting . take ( n ) . join ( "::" ) end namespaces . each do | ns | load_constant ( "#{ns}::#{constant}" ) end end load_constant (... | Tries to load the definitions for the given constant . Takes into account what modules we are in to resolve the constant name . |
8,719 | def load_constant ( constant ) return if loaded? ( constant ) registry . load ( constant ) return unless registry . include? ( constant ) apply ( constant ) end | Tries to load the definitions for the given constant . |
8,720 | def report_levels = ( given ) available = self . class . available_report_levels levels = [ ] given . each do | level | levels << available [ level ] if available [ level ] end if levels . empty? levels = default_report_levels end @report_levels = levels end | Sets a list of the enabled report levels . |
8,721 | def analysis_classes = ( names ) classes = [ ] available = self . class . available_analysis_classes names . each do | name | classes << available [ name ] if available [ name ] end if classes . empty? classes = default_analysis_classes end @analysis_classes = classes end | Sets a collection of the analysis constants to use . |
8,722 | def run_task config = create_configuration runner = RubyLint :: Runner . new ( config ) list = FileList . new output = runner . analyze ( list . process ( files ) ) puts ( output ) unless output . empty? end | Processes a list of files and writes the output to STDOUT . |
8,723 | def build_constant_paths_cache ( constant ) paths = match_globbed_files ( constant_to_path ( constant ) ) if paths . empty? paths = match_globbed_files ( constant_to_dashed_path ( constant ) ) end paths . map! { | p | File . expand_path ( p ) } ignore . each do | pattern | paths . reject! do | path | path . include? ( ... | Searches all the files that could potentially define the given constant and caches them . |
8,724 | def parse_file ( parser , file ) return parser . parse ( File . read ( file , :encoding => Encoding :: UTF_8 ) , file ) end | Parses the given file and returns an Array containing all the associated AST nodes and comments . |
8,725 | def run_analysis ( ast , vm , report ) classes = configuration . analysis_classes . select do | const | const . analyze? ( ast , vm ) end classes . each do | const | instance = const . new ( :vm => vm , :report => report , :config => configuration ) instance . iterate ( ast ) end end | Runs all the registered analysis classes . |
8,726 | def after_initialize @comments ||= { } @associations = { } @definitions = initial_definitions @constant_loader = ConstantLoader . new ( :definitions => @definitions ) @scopes = [ @definitions ] @value_stack = NestedStack . new @variable_stack = NestedStack . new @ignored_nodes = [ ] @visibility = :public reset_docstrin... | Called after a new instance of the virtual machine has been created . |
8,727 | def run ( ast ) ast = [ ast ] unless ast . is_a? ( Array ) @constant_loader . run ( ast ) ast . each { | node | iterate ( node ) } freeze end | Processes the given AST or a collection of AST nodes . |
8,728 | def after_or_asgn variable = variable_stack . pop . first value = value_stack . pop . first if variable and value conditional_assignment ( variable , value , false ) end end | Processes an or assignment in the form of variable || = value . |
8,729 | def after_and_asgn variable = variable_stack . pop . first value = value_stack . pop . first conditional_assignment ( variable , value ) end | Processes an and assignment in the form of variable && = value . |
8,730 | def after_array ( node ) builder = DefinitionBuilder :: RubyArray . new ( node , self , :values => value_stack . pop ) push_value ( builder . build ) end | Builds an Array . |
8,731 | def after_hash ( node ) builder = DefinitionBuilder :: RubyHash . new ( node , self , :values => value_stack . pop ) push_value ( builder . build ) end | Builds a Hash . |
8,732 | def on_self scope = current_scope method = scope . lookup ( scope . method_call_type , 'self' ) push_value ( method . return_value ) end | Pushes the value of self onto the current stack . |
8,733 | def on_class ( node ) parent = nil parent_node = node . children [ 1 ] if parent_node parent = evaluate_node ( parent_node ) if ! parent or ! parent . const? parent = current_scope . lookup ( :const , 'Object' ) end end define_module ( node , DefinitionBuilder :: RubyClass , :parent => parent ) end | Creates the definition for a class . |
8,734 | def on_block ( node ) builder = DefinitionBuilder :: RubyBlock . new ( node , self ) definition = builder . build associate_node ( node , definition ) push_scope ( definition ) end | Builds the definition for a block . |
8,735 | def on_def ( node ) receiver = nil if node . type == :defs receiver = evaluate_node ( node . children [ 0 ] ) end builder = DefinitionBuilder :: RubyMethod . new ( node , self , :type => @method_type , :receiver => receiver , :visibility => @visibility ) definition = builder . build builder . scope . add_definition ( d... | Creates the definition for a method definition . |
8,736 | def after_def previous = pop_scope current = current_scope reset_docstring_tags EXPORT_VARIABLES . each do | type | current . copy ( previous , type ) end end | Exports various variables to the outer scope of the method definition . |
8,737 | def on_send ( node ) name = node . children [ 1 ] . to_s name = SEND_MAPPING . fetch ( name , name ) callback = "on_send_#{name}" value_stack . add_stack execute_callback ( callback , node ) end | Processes a method call . If a certain method call has its own dedicated callback that one will be called as well . |
8,738 | def initial_definitions definitions = Definition :: RubyObject . new ( :name => 'root' , :type => :root , :instance_type => :instance , :inherit_self => false ) definitions . parents = [ definitions . constant_proxy ( 'Object' , RubyLint . registry ) ] definitions . define_self return definitions end | Returns the initial set of definitions to use . |
8,739 | def push_scope ( definition ) unless definition . is_a? ( RubyLint :: Definition :: RubyObject ) raise ( ArgumentError , "Expected a RubyLint::Definition::RubyObject but got " "#{definition.class} instead" ) end @scopes << definition end | Pushes a new scope on the list of available scopes . |
8,740 | def push_variable_value ( node ) return if value_stack . empty? || @ignored_nodes . include? ( node ) definition = definition_for_node ( node ) if definition value = definition . value ? definition . value : definition push_value ( value ) end end | Pushes the value of a variable onto the value stack . |
8,741 | def assign_variable ( type , name , value , node ) scope = assignment_scope ( type ) variable = scope . lookup ( type , name ) if variable variable . reference_amount += 1 variable . value = value if value else variable = Definition :: RubyObject . new ( :type => type , :name => name , :value => value , :instance_type ... | Assigns a basic variable . |
8,742 | def add_variable ( variable , scope = current_scope ) if variable_stack . empty? scope . add ( variable . type , variable . name , variable ) else variable_stack . push ( variable ) end end | Adds a variable to the current scope of if a the variable stack is not empty add it to the stack instead . |
8,743 | def create_primitive ( node , options = { } ) builder = DefinitionBuilder :: Primitive . new ( node , self , options ) return builder . build end | Creates a primitive value such as an integer . |
8,744 | def conditional_assignment ( variable , value , bool = true ) variable . reference_amount += 1 if current_scope . has_definition? ( variable . type , variable . name ) == bool variable . value = value current_scope . add_definition ( variable ) buffer_assignment_value ( variable . value ) end end | Performs a conditional assignment . |
8,745 | def definition_for_node ( node ) if node . const? and node . children [ 0 ] definition = ConstantPath . new ( node ) . resolve ( current_scope ) else definition = current_scope . lookup ( node . type , node . name ) end definition = Definition :: RubyObject . create_unknown unless definition return definition end | Returns the definition for the given node . |
8,746 | def increment_reference_amount ( node ) definition = definition_for_node ( node ) if definition and ! definition . frozen? definition . reference_amount += 1 end end | Increments the reference amount of a node s definition unless the definition is frozen . |
8,747 | def inherit_definition ( definition , inherit ) unless definition . parents . include? ( inherit ) definition . parents << inherit end end | Includes the definition inherit in the list of parent definitions of definition . |
8,748 | def buffer_docstring_tags ( node ) return unless comments [ node ] parser = Docstring :: Parser . new tags = parser . parse ( comments [ node ] . map ( & :text ) ) @docstring_tags = Docstring :: Mapping . new ( tags ) end | Extracts all the docstring tags from the documentation of the given node retrieves the corresponding types and stores them for later use . |
8,749 | def create_unknown_with_method ( name ) definition = Definition :: RubyObject . create_unknown definition . send ( "define_#{@method_type}" , name ) return definition end | Creates an unknown definition with the given method in it . |
8,750 | def definitions_for_types ( types ) definitions = [ ] types . each do | type | if type [ 0 ] == '#' found = create_unknown_with_method ( type [ 1 .. - 1 ] ) else found = lookup_type_definition ( type ) end definitions << found if found end return definitions end | Returns a collection of definitions for a set of YARD types . |
8,751 | def track_method_call ( definition , name , node ) method = definition . lookup ( definition . method_call_type , name ) current = current_scope location = { :line => node . line , :column => node . column , :file => node . file } if current . respond_to? ( :calls ) and ! current . frozen? current . calls . push ( Meth... | Tracks a method call . |
8,752 | def group_constants ( constants ) grouped = Hash . new { | hash , key | hash [ key ] = [ ] } constants . each do | name | root = name . split ( '::' ) [ 0 ] grouped [ root ] << name end return grouped end | Groups constants together based on the top level namespace segment . |
8,753 | def method_information ( inspected ) arg_mapping = argument_mapping info = { :method => { } , :instance_method => { } } inspected . each do | type , methods | methods . each do | method | args = [ ] method . parameters . each_with_index do | arg , index | name = arg [ 1 ] || "arg#{index + 1}" args << { :type => arg_map... | Returns a Hash containing all the instance and class methods and their arguments . |
8,754 | def rvm_task ( name , & block ) if fetch ( :rvm_require_role , nil ) . nil? task name , & block else task name , :roles => fetch ( :rvm_require_role ) , & block end end | defined depending on which selector was used |
8,755 | def rvm_user_command ( options = { } ) return '' unless rvm_type == :mixed && options [ :subject_class ] rvm_user_args = rvm_user . empty? ? 'none' : rvm_user . map ( & :to_s ) . join ( ' ' ) rvm_bin = path_to_bin_rvm ( { :with_ruby => true } . merge ( options ) ) "#{rvm_bin} rvm user #{rvm_user_args} ; " end | If we re operating on something affected by the rvm user mode we need to make sure that the server has the right rvm user mode . This returns a shell command to prepend to an existing command in order to achieve this . |
8,756 | def set_x_axis ( params ) name , encoding = encode_utf16 ( params [ :name ] , params [ :name_encoding ] ) formula = parse_series_formula ( params [ :name_formula ] ) @x_axis_name = name @x_axis_encoding = encoding @x_axis_formula = formula end | Set the properties of the X - axis . |
8,757 | def set_y_axis ( params ) name , encoding = encode_utf16 ( params [ :name ] , params [ :name_encoding ] ) formula = parse_series_formula ( params [ :name_formula ] ) @y_axis_name = name @y_axis_encoding = encoding @y_axis_formula = formula end | Set the properties of the Y - axis . |
8,758 | def set_plotarea ( params = { } ) return if params . empty? area = @plotarea if params . has_key? ( :visible ) area [ :visible ] = params [ :visible ] return if area [ :visible ] == 0 end area [ :bg_color_index ] = 0x08 if params . has_key? ( :color ) index , rgb = get_color_indices ( params [ :color ] ) if ! index . n... | Set the properties of the chart plotarea . |
8,759 | def close @data = '' store_bof ( 0x0020 ) store_header store_footer store_hcenter store_vcenter store_margin_left store_margin_right store_margin_top store_margin_bottom store_setup store_password store_fbi ( * @config [ :font_numbers ] ) store_fbi ( * @config [ :font_series ] ) store_fbi ( * @config [ :font_title ] ) ... | Create and store the Chart data structures . |
8,760 | def store_window2 record = 0x023E length = 0x000A grbit = 0x0000 rwTop = 0x0000 colLeft = 0x0000 rgbHdr = 0x0000 fDspFmla = 0 fDspGrid = 0 fDspRwCol = 0 fFrozen = 0 fDspZeros = 0 fDefaultHdr = 0 fArabic = 0 fDspGuts = 0 fFrozenNoSplit = 0 fSelected = selected? ? 1 : 0 fPaged = 0 fBreakPreview = 0 grbit = fDspFmla grbit... | Write BIFF record Window2 . Note this overrides the parent Worksheet record because the Chart version of the record is smaller and is used mainly to indicate if the chart tab is selected or not . |
8,761 | def encode_utf16 ( str , encoding = 0 ) return [ nil , nil ] if str . nil? string = str . dup ruby_19 { string = convert_to_ascii_if_ascii ( string ) } if is_utf8? ( string ) string = utf8_to_16be ( string ) encoding = 1 end limit = encoding != 0 ? 255 * 2 : 255 if string . bytesize >= limit string = string [ 0 , limit... | Convert UTF8 strings used in the chart to UTF16 . |
8,762 | def get_color_indices ( color ) invalid = 0x7FFF index = Colors . new . get_color ( color ) index = invalid if color . respond_to? ( :coerce ) && ( color < 8 || color > 63 ) if index == invalid [ nil , nil ] else [ index , get_color_rbg ( index ) ] end end | Convert the user specified colour index or string to an colour index and RGB colour number . |
8,763 | def get_line_pattern ( value ) value = value . downcase if value . respond_to? ( :to_str ) default = 0 patterns = { 0 => 5 , 1 => 0 , 2 => 1 , 3 => 2 , 4 => 3 , 5 => 4 , 6 => 7 , 7 => 6 , 8 => 8 , 'solid' => 0 , 'dash' => 1 , 'dot' => 2 , 'dash-dot' => 3 , 'dash-dot-dot' => 4 , 'none' => 5 , 'dark-gray' => 6 , 'medium-... | Get the Excel chart index for line pattern that corresponds to the user defined value . |
8,764 | def get_line_weight ( value ) value = value . downcase if value . respond_to? ( :to_str ) default = 0 weights = { 1 => - 1 , 2 => 0 , 3 => 1 , 4 => 2 , 'hairline' => - 1 , 'narrow' => 0 , 'medium' => 1 , 'wide' => 2 , } if weights . has_key? ( value ) weights [ value ] else default end end | Get the Excel chart index for line weight that corresponds to the user defined value . |
8,765 | def store_chart_stream store_chart ( * @config [ :chart ] ) store_begin store_plotgrowth if @chartarea [ :visible ] != 0 store_chartarea_frame_stream end index = 0 @series . each do | series | store_series_stream ( :index => index , :value_formula => series [ :values ] [ 0 ] , :value_count => series [ :values ] [ 1 ] ,... | Store the CHART record and it s substreams . |
8,766 | def store_series_stream ( params ) name_type = _formula_type_from_param ( 2 , 1 , params , :name_formula ) value_type = _formula_type_from_param ( 2 , 0 , params , :value_formula ) category_type = _formula_type_from_param ( 2 , 0 , params , :category_formula ) store_series ( params [ :value_count ] , params [ :category... | Write the SERIES chart substream . |
8,767 | def store_x_axis_text_stream formula = @x_axis_formula . nil? ? '' : @x_axis_formula ai_type = _formula_type ( 2 , 1 , formula ) store_text ( * @config [ :x_axis_text ] ) store_begin store_pos ( * @config [ :x_axis_text_pos ] ) store_fontx ( 8 ) store_ai ( 0 , ai_type , formula ) unless @x_axis_name . nil? store_series... | Write the X - axis TEXT substream . |
8,768 | def store_axisparent_stream store_axisparent ( * @config [ :axisparent ] ) store_begin store_pos ( * @config [ :axisparent_pos ] ) store_axis_category_stream store_axis_values_stream if ! @x_axis_name . nil? || ! @x_axis_formula . nil? store_x_axis_text_stream end if ! @y_axis_name . nil? || ! @y_axis_formula . nil? st... | Write the AXISPARENT chart substream . |
8,769 | def store_ai ( id , type , formula , format_index = 0 ) formula = '' if formula == [ "" ] record = 0x1051 length = 0x0008 grbit = 0x0000 ruby_19 { formula = convert_to_ascii_if_ascii ( formula ) } formula_length = formula . bytesize length += formula_length header = [ record , length ] . pack ( 'vv' ) data = [ id ] . p... | Write the AI chart BIFF record . |
8,770 | def store_areaformat ( rgbFore , rgbBack , pattern , grbit , indexFore , indexBack ) record = 0x100A length = 0x0010 header = [ record , length ] . pack ( 'vv' ) data = [ rgbFore ] . pack ( 'V' ) data += [ rgbBack ] . pack ( 'V' ) data += [ pattern ] . pack ( 'v' ) data += [ grbit ] . pack ( 'v' ) data += [ indexFore ]... | Write the AREAFORMAT chart BIFF record . Contains the patterns and colours of a chart area . |
8,771 | def store_axcext record = 0x1062 length = 0x0012 catMin = 0x0000 catMax = 0x0000 catMajor = 0x0001 unitMajor = 0x0000 catMinor = 0x0001 unitMinor = 0x0000 unitBase = 0x0000 catCrossDate = 0x0000 grbit = 0x00EF store_simple ( record , length , catMin , catMax , catMajor , unitMajor , catMinor , unitMinor , unitBase , ca... | Write the AXCEXT chart BIFF record . |
8,772 | def store_axis ( type ) record = 0x101D length = 0x0012 reserved1 = 0x00000000 reserved2 = 0x00000000 reserved3 = 0x00000000 reserved4 = 0x00000000 header = [ record , length ] . pack ( 'vv' ) data = [ type ] . pack ( 'v' ) data += [ reserved1 ] . pack ( 'V' ) data += [ reserved2 ] . pack ( 'V' ) data += [ reserved3 ] ... | Write the AXIS chart BIFF record to define the axis type . |
8,773 | def store_axisparent ( iax , x , y , dx , dy ) record = 0x1041 length = 0x0012 header = [ record , length ] . pack ( 'vv' ) data = [ iax ] . pack ( 'v' ) data += [ x ] . pack ( 'V' ) data += [ y ] . pack ( 'V' ) data += [ dx ] . pack ( 'V' ) data += [ dy ] . pack ( 'V' ) append ( header , data ) end | Write the AXISPARENT chart BIFF record . |
8,774 | def store_catserrange record = 0x1020 length = 0x0008 catCross = 0x0001 catLabel = 0x0001 catMark = 0x0001 grbit = 0x0001 store_simple ( record , length , catCross , catLabel , catMark , grbit ) end | Write the CATSERRANGE chart BIFF record . |
8,775 | def store_chartformat ( grbit = 0 ) record = 0x1014 length = 0x0014 reserved1 = 0x00000000 reserved2 = 0x00000000 reserved3 = 0x00000000 reserved4 = 0x00000000 icrt = 0x0000 header = [ record , length ] . pack ( 'vv' ) data = [ reserved1 ] . pack ( 'V' ) data += [ reserved2 ] . pack ( 'V' ) data += [ reserved3 ] . pack... | Write the CHARTFORMAT chart BIFF record . The parent record for formatting of a chart group . |
8,776 | def store_dataformat ( series_index , series_number , point_number ) record = 0x1006 length = 0x0008 grbit = 0x0000 store_simple ( record , length , point_number , series_index , series_number , grbit ) end | Write the DATAFORMAT chart BIFF record . This record specifies the series that the subsequent sub stream refers to . |
8,777 | def store_fbi ( index , height , width_basis , height_basis , scale_basis ) record = 0x1060 length = 0x000A height = height * 20 store_simple ( record , length , width_basis , height_basis , height , scale_basis , index ) end | Write the FBI chart BIFF record . Specifies the font information at the time it was applied to the chart . |
8,778 | def store_frame ( frame_type , grbit ) record = 0x1032 length = 0x0004 store_simple ( record , length , frame_type , grbit ) end | Write the FRAME chart BIFF record . |
8,779 | def store_legend ( x , y , width , height , wType , wSpacing , grbit ) record = 0x1015 length = 0x0014 header = [ record , length ] . pack ( 'vv' ) data = [ x ] . pack ( 'V' ) data += [ y ] . pack ( 'V' ) data += [ width ] . pack ( 'V' ) data += [ height ] . pack ( 'V' ) data += [ wType ] . pack ( 'C' ) data += [ wSpac... | Write the LEGEND chart BIFF record . The Marcus Horan method . |
8,780 | def store_lineformat ( rgb , lns , we , grbit , index ) record = 0x1007 length = 0x000C header = [ record , length ] . pack ( 'vv' ) data = [ rgb ] . pack ( 'V' ) data += [ lns ] . pack ( 'v' ) data += [ we ] . pack ( 'v' ) data += [ grbit ] . pack ( 'v' ) data += [ index ] . pack ( 'v' ) append ( header , data ) end | Write the LINEFORMAT chart BIFF record . |
8,781 | def store_markerformat ( rgbFore , rgbBack , marker , grbit , icvFore , icvBack , miSize ) record = 0x1009 length = 0x0014 header = [ record , length ] . pack ( 'vv' ) data = [ rgbFore ] . pack ( 'V' ) data += [ rgbBack ] . pack ( 'V' ) data += [ marker ] . pack ( 'v' ) data += [ grbit ] . pack ( 'v' ) data += [ icvFor... | Write the MARKERFORMAT chart BIFF record . |
8,782 | def store_objectlink ( link_type ) record = 0x1027 length = 0x0006 link_index1 = 0x0000 link_index2 = 0x0000 store_simple ( record , length , link_type , link_index1 , link_index2 ) end | Write the OBJECTLINK chart BIFF record . |
8,783 | def store_plotgrowth record = 0x1064 length = 0x0008 dx_plot = 0x00010000 dy_plot = 0x00010000 header = [ record , length ] . pack ( 'vv' ) data = [ dx_plot ] . pack ( 'V' ) data += [ dy_plot ] . pack ( 'V' ) append ( header , data ) end | Write the PLOTGROWTH chart BIFF record . |
8,784 | def store_pos ( mdTopLt , mdBotRt , x1 , y1 , x2 , y2 ) record = 0x104F length = 0x0014 header = [ record , length ] . pack ( 'vv' ) data = [ mdTopLt ] . pack ( 'v' ) data += [ mdBotRt ] . pack ( 'v' ) data += [ x1 ] . pack ( 'V' ) data += [ y1 ] . pack ( 'V' ) data += [ x2 ] . pack ( 'V' ) data += [ y2 ] . pack ( 'V' ... | Write the POS chart BIFF record . Generally not required when using automatic positioning . |
8,785 | def store_serauxtrend ( reg_type , poly_order , equation , r_squared ) record = 0x104B length = 0x001C intercept = [ 'FFFFFFFF0001FFFF' ] . pack ( 'H*' ) forecast = [ '0000000000000000' ] . pack ( 'H*' ) backcast = [ '0000000000000000' ] . pack ( 'H*' ) header = [ record , length ] . pack ( 'vv' ) data = [ reg_type ] .... | Write the SERAUXTREND chart BIFF record . |
8,786 | def store_series ( category_count , value_count ) record = 0x1003 length = 0x000C category_type = 0x0001 value_type = 0x0001 bubble_type = 0x0001 bubble_count = 0x0000 store_simple ( record , length , category_type , value_type , category_count , value_count , bubble_type , bubble_count ) end | Write the SERIES chart BIFF record . |
8,787 | def store_seriestext ( str , encoding ) ruby_19 { str = convert_to_ascii_if_ascii ( str ) } record = 0x100D length = 0x0000 id = 0x0000 cch = str . bytesize encoding ||= 0 cch /= 2 if encoding != 0 str = str . unpack ( 'v*' ) . pack ( 'n*' ) if encoding != 0 length = 4 + str . bytesize header = [ record , length ] . pa... | Write the SERIESTEXT chart BIFF record . |
8,788 | def store_shtprops record = 0x1044 length = 0x0004 grbit = 0x000E empty_cells = 0x0000 grbit = 0x000A if @embedded store_simple ( record , length , grbit , empty_cells ) end | Write the SHTPROPS chart BIFF record . |
8,789 | def store_tick record = 0x101E length = 0x001E tktMajor = 0x02 tktMinor = 0x00 tlt = 0x03 wBkgMode = 0x01 rgb = 0x00000000 reserved1 = 0x00000000 reserved2 = 0x00000000 reserved3 = 0x00000000 reserved4 = 0x00000000 grbit = 0x0023 index = 0x004D reserved5 = 0x0000 header = [ record , length ] . pack ( 'vv' ) data = [ tk... | Write the TICK chart BIFF record . |
8,790 | def store_valuerange record = 0x101F length = 0x002A numMin = 0x00000000 numMax = 0x00000000 numMajor = 0x00000000 numMinor = 0x00000000 numCross = 0x00000000 grbit = 0x011F header = [ record , length ] . pack ( 'vv' ) data = [ numMin ] . pack ( 'd' ) data += [ numMax ] . pack ( 'd' ) data += [ numMajor ] . pack ( 'd' ... | Write the VALUERANGE chart BIFF record . |
8,791 | def parse_formula ( formula , byte_stream = false ) tokens = reverse ( parse ( formula ) ) tokens . unshift ( '_vol' ) if check_volatile ( tokens ) != 0 unless byte_stream parse_tokens ( tokens ) tokens else parse_tokens ( tokens ) end end | Takes a textual description of a formula and returns a RPN encoded byte string . |
8,792 | def parse_tokens ( tokens ) parse_str = '' last_type = '' modifier = '' num_args = 0 _class = 0 _classary = [ 1 ] args = tokens . dup while ( ! args . empty? ) token = args . shift if ( token == '_arg' ) num_args = args . shift elsif ( token == '_class' ) token = args . shift _class = @functions [ token ] [ 2 ] exit "U... | Convert each token or token pair to its Excel ptg equivalent . |
8,793 | def convert_number ( num ) if ( ( num =~ / \d / ) && ( num . to_i <= 65535 ) ) return [ @ptg [ 'ptgInt' ] , num . to_i ] . pack ( "Cv" ) else num = [ num . to_f ] . pack ( "d" ) num . reverse! if @byte_order return [ @ptg [ 'ptgNum' ] ] . pack ( "C" ) + num end end | Convert a number token to ptgInt or ptgNum |
8,794 | def convert_string ( str ) ruby_19 { str = convert_to_ascii_if_ascii ( str ) } encoding = 0 str . sub! ( / / , '' ) str . sub! ( / / , '' ) str . gsub! ( / / , '"' ) length = ruby_18 { str . gsub ( / \W \d / , ' ' ) . length } || ruby_19 { str . length } if is_utf8? ( str ) str = utf8_to_16le ( str ) ruby_19 { str . fo... | Convert a string to a ptg Str . |
8,795 | def convert_function ( token , num_args ) exit "Unknown function #{token}() in formula\n" if @functions [ token ] [ 0 ] . nil? args = @functions [ token ] [ 1 ] if ( args >= 0 ) if ( args != num_args ) raise "Incorrect number of arguments for #{token}() in formula\n" else return [ @ptg [ 'ptgFuncV' ] , @functions [ tok... | Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes . |
8,796 | def convert_name ( name , _class ) name_index = get_name_index ( name ) if _class == 0 ptgName = @ptg [ 'ptgName' ] elsif _class == 1 ptgName = @ptg [ 'ptgNameV' ] elsif _class == 2 ptgName = @ptg [ 'ptgNameA' ] end [ ptgName , name_index ] . pack ( 'CV' ) end | Convert a symbolic name into a name reference . |
8,797 | def close store_dimensions store_autofilters store_autofilterinfo store_filtermode @colinfo . reverse . each do | colinfo | store_colinfo ( colinfo ) end store_defcol store_password store_protect store_obj_protect store_setup store_margin_bottom store_margin_top store_margin_right store_margin_left store_vcenter store_... | Constructor . Creates a new Worksheet object from a BIFFwriter object |
8,798 | def hide @hidden = true @selected = false @workbook . worksheets . activesheet = @workbook . worksheets . first @workbook . worksheets . firstsheet = @workbook . worksheets . first end | Hide this worksheet . |
8,799 | def set_tab_color ( color ) color = Colors . new . get_color ( color ) color = 0 if color == 0x7FFF @tab_color = color end | Set the colour of the worksheet colour . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.