<commit_before>#!/usr/bin/env ruby -wKU

# Collection of declaration snippets for use
# within public, protected or private namespaces.

@method    = " function ${1:name}($2):${3:void}{\n\t$0${3/void$|(.+)/(?1:return null;)/}\n}"
@getter    = " function get ${1:name}():${2:Object}{\n\treturn ${3:_$1};\n}$0"
@setter    = " function set ${1:name}(value:${2:Object}):void {\n\t${3:_$1} = value;\n}$0"
@variable  = " var _${1:variableName}:${2:Object};"
@property  = " var ${1:propertyName}:${2:Object};"
@namespace = " namespace ${1:nameSpaceName};"
@constant  = " const ${1:CONSTANT_NAME}:${2:Object};"

@static_variable = "static" + @property
@static_function = "static" + @method
@static_constant = "static" + @constant

def get_statics()
    r = [ 
        list_object('static const', @static_constant),
        list_object('static function', @static_function),
        list_object('static var', @static_variable)
    ]
end

def get_snippets(ns)
    
    v = ns == "public" ? @property : @variable
    
    r = [
          { 'title' => 'function', 'data' => ns + @method}, 
          { 'title' => 'get', 'data' => ns + @getter},      
          { 'title' => 'set', 'data' => ns + @setter}, 
          { 'title' => 'var', 'data' => ns + v},
          { 'title' => 'namespace', 'data' => ns + @namespace},          
    ]
    
    r += [
        { 'title' => '----'},
        { 'title' => 'static const', 'data' => ns + " static" + @constant }        
        { 'title' => 'static function', 'data' => ns + " static" + @method }, 
        { 'title' => 'static get', 'data' => ns + " static" + @getter }, 
        { 'title' => 'static set', 'data' => ns + " static" + @setter }, 
        { 'title' => 'static var', 'data' => ns + " static" + v }, 
    ] unless ns == "protected"
    
    return r
end

# Getter/Setters

def getter
    @getter
end<commit_msg>Making compatible with ruby 1.8.2<commit_after>#!/usr/bin/env ruby -wKU

# Collection of declaration snippets for use
# within public, protected or private namespaces.

@method    = " function ${1:name}($2):${3:void}{\n\t$0${3/void$|(.+)/(?1:return null;)/}\n}"
@getter    = " function get ${1:name}():${2:Object}{\n\treturn ${3:_$1};\n}$0"
@setter    = " function set ${1:name}(value:${2:Object}):void {\n\t${3:_$1} = value;\n}$0"
@variable  = " var _${1:variableName}:${2:Object};"
@property  = " var ${1:propertyName}:${2:Object};"
@namespace = " namespace ${1:nameSpaceName};"
@constant  = " const ${1:CONSTANT_NAME}:${2:Object};"

@static_variable = "static" + @property
@static_function = "static" + @method
@static_constant = "static" + @constant

def get_statics()
    r = [ 
        list_object('static const', @static_constant),
        list_object('static function', @static_function),
        list_object('static var', @static_variable)
    ]
end

def get_snippets(ns)
    
    v = ns == "public" ? @property : @variable
    
    r = [
          list_object( 'function',  ns + @method), 
          list_object( 'get',       ns + @getter),      
          list_object( 'set',       ns + @setter), 
          list_object( 'var',       ns + v),
          list_object( 'namespace', ns + @namespace)          
    ]

    if ns != "protected" 
        r += [
            { 'title' => '----'},
            list_object( 'static const',    ns + " static" + @constant ),
            list_object( 'static function', ns + " static" + @method   ), 
            list_object( 'static get',      ns + " static" + @getter   ), 
            list_object( 'static set',      ns + " static" + @setter   ), 
            list_object( 'static var',      ns + " static" + v         )
        ]
    end
    
    return r
end

# Getter/Setters

def getter
    @getter
end
{'fraction_non_alphanumeric': 0.20059235325794292, 'fraction_numerical': 0.013193322563274098, 'mean_word_length': 2.610301263362488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1052746', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1256, 'n_words': 284}