query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Set the type of the Iq stanza (chainingfriendly) v:: [Symbol] or nil
|
def set_type(v)
self.type = v
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def type=(type); end",
"def set_type\n end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type(val); @type = val; self; end",
"def type=(val)\n case val\n when :error then super('error')\n when :probe then super('probe')\n when :subscribe then super('subscribe')\n when :subscribed then super('subscribed')\n when :unavailable then super('unavailable')\n when :unsubscribe then super('unsubscribe')\n when :unsubscribed then super('unsubscribed')\n else super(nil)\n end\n end",
"def bar_type=(s)\n self[:type] = s\n end",
"def type=(type)\n @type = type.to_sym\n end",
"def type=(val)\n @type = val.to_sym\n end",
"def set_q_type\n @q_type = QType.find(params[:id])\n end",
"def type=(type)\n @type = type\n\n setOption('type', @type)\n end",
"def type=(value)\n @type = value.to_sym\n end",
"def type=(type)\n @type = type\n end",
"def set_type_if_empty\n self.type = 'Protonym' if self.type.nil?\n end",
"def type=(type)\n self['type'] = type\n end",
"def type=(type)\n @type = type\n end",
"def _type=(_)\n end",
"def type=(val)\n @type = val.to_sym if %w(UNSPECIFIED MEDIA MASTER).include? val.to_s\n end",
"def type=(v)\n case v\n when :get then super('get')\n when :set then super('set')\n when :result then super('result')\n when :error then super('error')\n else super(nil)\n end\n end",
"def set_type(val)\n self.type = val\n self\n end",
"def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end",
"def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end",
"def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end",
"def type(type)\n opts[:type] = type\n end",
"def type=(type)\n @type = type\n end",
"def initialize(type = nil, to = nil)\n super(\"iq\")\n if not to.nil?\n set_to(to)\n end \n if not type.nil?\n set_type(type)\n end \n end",
"def type=(type)\n type = type.intern\n super type\n end",
"def set_type sym, type\n @types[sym] = type\n end",
"def type=(type)\n @@type = type\n end",
"def type=(new_type)\n @type = new_type.to_sym\n end",
"def type=(value)\n @type = value\n end",
"def type=(value)\n @type = value\n end",
"def type=(value)\n @type = value\n end",
"def type=(value)\n @type = value\n end",
"def type=(value)\n @type = value\n end",
"def type=(value)\n @type = value\n end",
"def type=(value)\n @type = value\n end",
"def type=(type)\n write_attr :type, type\n end",
"def type=(type)\n Munson.register_type(type, self)\n munson.type = type\n end",
"def initialize type, **options\n super **options\n @type = NRSER::Types.make type\n end",
"def initialize type, **options\n super **options\n @type = NRSER::Types.make type\n end",
"def set_type_from(s)\n\t\t\treturn unless s.include?('-')\n\t\t\tt = (s=~/^fill-extrusion/ ? \"fill-extrusion\" : s.split('-')[0]).to_sym\n\t\t\tif t==:icon || t==:text then t=:symbol end\n\t\t\tif @type && @type!=t then raise \"Attribute #{s} conflicts with deduced type #{@type} in layer #{@kv[:id]}\" end\n\t\t\t@type=t\n\t\tend",
"def type= new_type\n frozen_check!\n @gapi.type = new_type\n end",
"def type= new_type\n frozen_check!\n @gapi.type = new_type\n end",
"def record_type(t)\n @type = t\n end",
"def type(value_=nil)\n if value_\n @type = value_\n else\n @type\n end\n end",
"def type= (type)\n self.tweet_type = type\n end",
"def of_type(type)\n options[:type] = type\n self\n end",
"def type= new_type\n @gapi.update! type: verify_type(new_type)\n end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type_name=(val)\n self['type_name'] = val\n end",
"def set_typecode(v)\n @typecode = v\n end",
"def fix_type\n self.type ||= self.imap_provider.class_for(PartnerConnection).to_s\n end",
"def device_type=(s)\n self[:type] = s\n end",
"def set_Type(value)\n set_input(\"Type\", value)\n end",
"def set_Type(value)\n set_input(\"Type\", value)\n end",
"def setResponseType(type)\n if type == 0\n @audience = Human.new\n elsif type == 1\n @audience = Asura.new\n elsif type == 2\n @audience = Charr.new\n elsif type == 3\n @audience = Norn.new\n elsif type == 4\n @audience = Sylvari.new\n else\n @audience = Skritt.new\n end\n end",
"def attr_set_sb1(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def type(type); end",
"def set_pair_type\n @type = 'class' if @key == '*c' || @key == '*class'\n if @key == '*C' || @key == '*CLASS'\n @type = 'class'\n @key = @key.downcase\n end\n @type = 'id' if @key == '*i' || @key == '*id'\n @type = 'name' if @key == '*n' || @key == '*name'\n @type = 'name' if @key == '*N' || @key == '*NAME'\n @type = 'superclass' if @key == '*S' || @key == '*SUPERCLASS'\n @type = 'superclass' if @key == '*s' || @key == '*superclass'\n @type = 'keylist' if @key == '*a' || @key == '*assign'\n @type = 'version' if @key == '*V' || @key == '*VERSION'\n @type = 'method' if @key == '*m' || @key == '*method'\n @type = 'transform' if @key == '*t' || @key == '*transform'\n if @key == '*L' || @key == '*LOAD'\n @key = @key.downcase\n @type = 'import'\n if @array\n @global.freeze_max_files(@array.abstractArrayItems.length)\n elsif @valueItem&.value&.array\n @global.freeze_max_files(@valueItem&.value&.array.abstractArrayItems.length)\n elsif @valueItem&.value&.nbArray\n @global.freeze_max_files(@valueItem&.value&.nbArray.arrayItems.length)\n else\n @global.freeze_max_files(1)\n end\n end\n if @key == '*l' || @key == '*load'\n @type = 'import'\n end\n @type = 'index' if @key == '?'\n @type = 'hidden' if @key.start_with? '_'\n @type = 'allow' if @key.downcase == '*allow'\n end",
"def set_type\n if self.mp3.present?\n self.type = \"Audio::UploadedAudio\"\n\n elsif self.enco_number.present? && self.enco_date.present?\n self.type = \"Audio::EncoAudio\"\n\n elsif self.external_url.present?\n self.type = \"Audio::DirectAudio\"\n\n end\n end",
"def attr_set_sb4(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def initialize(type, value = nil)\n\t\t@type = type\n\t\t\n\t\tif (value != nil)\n\t\t\tif (type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)\n\t\t\t\tif (value.kind_of?(Fixnum))\n\t\t\t\t\t@value = value.to_s\n\t\t\t\telse\n\t\t\t\t\t@value = value.dup\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@value = value\n\t\t\tend\n\t\tend\n\tend",
"def query_type=(query_option)\n @browser.select_list(:id => \"smartSearchSubtype_0\").select(query_option)\n end",
"def device_type=(s)\n self[:type] = s\n end",
"def set_type(name)\n @type = name\n ProcessRecord::TYPE_TABLE[name] = self\n end",
"def type=(new_type=:default)\n ptr = ::FFI::MemoryPointer.new(:int)\n Klass.setServoType(@handle, @index, Phidgets::FFI::AdvancedServoType[new_type])\n new_type\n end",
"def add_type(type)\n end",
"def initialize( type, subtype, qval=Q_DEFAULT, *extensions )\n\t\ttype = nil if type == '*'\n\t\tsubtype = nil if subtype == '*'\n\n\t\t@type = type\n\t\t@subtype = subtype\n\t\t@qvalue = normalize_qvalue( qval )\n\t\t@extensions = extensions.flatten\n\tend",
"def setpostypeid(value)\r\n setvalue(SVTags::POS_TYPE_ID, value)\r\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"\", \"APIC\", \"DCNM\", \"UCSFI\", \"UCSFIISM\", \"IMC\", \"IMCM4\", \"IMCM5\", \"IMCRack\", \"UCSIOM\", \"HX\", \"HyperFlexAP\", \"IWE\", \"UCSD\", \"IntersightAppliance\", \"IntersightAssist\", \"PureStorageFlashArray\", \"UCSC890\", \"NetAppOntap\", \"NetAppActiveIqUnifiedManager\", \"EmcScaleIo\", \"EmcVmax\", \"EmcVplex\", \"EmcXtremIo\", \"VmwareVcenter\", \"MicrosoftHyperV\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ServiceNow\", \"ReadHatOpenStack\", \"CloudFoundry\", \"MicrosoftAzureApplicationInsights\", \"OpenStack\", \"MicrosoftSqlServer\", \"Kubernetes\", \"AmazonWebService\", \"AmazonWebServiceBilling\", \"MicrosoftAzureServicePrincipal\", \"MicrosoftAzureEnterpriseAgreement\", \"DellCompellent\", \"HPE3Par\", \"RedHatEnterpriseVirtualization\", \"NutanixAcropolis\", \"HPEOneView\", \"ServiceEngine\", \"HitachiVirtualStoragePlatform\", \"IMCBlade\", \"TerraformCloud\", \"TerraformAgent\", \"CustomTarget\", \"AnsibleEndpoint\", \"HTTPEndpoint\", \"SSHEndpoint\", \"CiscoCatalyst\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def set_Type(value)\n set_input(\"Type\", value)\n end",
"def set_Type(value)\n set_input(\"Type\", value)\n end",
"def attr_set_sb2(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def value_type= value_type\n self.type = value_type.gsub(\"-\", \"_\").camelize\n end",
"def inqmarkertype\n inquiry_int { |pt| super(pt) }\n end",
"def types=(_arg0); end",
"def query_type=(value)\n @query_type = value\n end",
"def query_type=(value)\n @query_type = value\n end",
"def type=(type)\n @type = type\n @signed = type.name.split('::').last[0] != \"U\"\n type\n end",
"def type locator, value\r\n command 'type', locator, value\r\n end",
"def type locator, value\r\n command 'type', locator, value\r\n end",
"def set_type(qualified_name, type)\n @types[qualified_name] = type\n end",
"def type; nil end",
"def type; nil end"
] |
[
"0.6026808",
"0.5948321",
"0.594715",
"0.594715",
"0.594715",
"0.594715",
"0.594715",
"0.5889045",
"0.58708346",
"0.5870461",
"0.58276063",
"0.57351464",
"0.5718711",
"0.57041264",
"0.5682197",
"0.5648664",
"0.56269836",
"0.56218255",
"0.5598361",
"0.5564985",
"0.55600333",
"0.55544996",
"0.55401826",
"0.5481029",
"0.5481029",
"0.5481029",
"0.54618037",
"0.5441894",
"0.54242694",
"0.5421057",
"0.54082346",
"0.540657",
"0.53876024",
"0.5369924",
"0.5369924",
"0.5369924",
"0.5369924",
"0.5369924",
"0.5369924",
"0.5369924",
"0.53590953",
"0.5357058",
"0.53110266",
"0.53110266",
"0.52715266",
"0.5271026",
"0.5271026",
"0.5268935",
"0.52468413",
"0.5237165",
"0.5216091",
"0.5212686",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.5194028",
"0.519385",
"0.5183793",
"0.5169861",
"0.51537037",
"0.5133088",
"0.5133088",
"0.51328176",
"0.51273346",
"0.51114506",
"0.51019764",
"0.5101015",
"0.50979483",
"0.50955415",
"0.50950336",
"0.509417",
"0.5081286",
"0.50648016",
"0.5047583",
"0.50388604",
"0.50349283",
"0.50188506",
"0.50133055",
"0.50133055",
"0.5002483",
"0.4998803",
"0.49923778",
"0.49844295",
"0.49825156",
"0.49825156",
"0.4982328",
"0.4975057",
"0.4975057",
"0.49475598",
"0.4946718",
"0.4946718"
] |
0.60567546
|
0
|
Returns the iq's query child, or nil result:: [IqQuery]
|
def query
first_element('query')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parent_question\n return nil unless is_sq?\n @parent_question ||= lime_group.lime_questions.find{|question|question.qid==parent_qid}\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def parent_rmq\n @_parent_rmq\n end",
"def q\n self\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def query\n get_query_object\n end",
"def peek()\n @q.first\n end",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def child\n\t\tif is_child?\n\t\t\tself\n\t\telse\n\t\t\tif !familyid.blank?\n\t\t\t\tStudySubject.children.with_subjectid(familyid).first\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend\n\tend",
"def query_root\n return @query_root\n end",
"def sub_query(value = nil, command = nil)\n return unless recursive?\n return @sub_query if value.nil?\n\n @sub_query = sanitize_query(value, command)\n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def query\n return nil\n end",
"def query_parent_id\n @attributes[:query_parent_id]\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def child\n children[0]\n end",
"def result_for_query(query)\n results_for_query(query).first\n end",
"def query\n @query ||= EdgeApi.from_edge(self)\n end",
"def query(q=\"\")\n if @connection != nil \n @data = MonetDBData.new(@connection)\n @data.execute(q)\n end\n return @data\n end",
"def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend",
"def parent\n map do |q|\n q.get_parent_element\n end\n end",
"def find_query(querys,name_q)\n # newq = querys.find{|q| ( q.find{|h| (h.subject_id)})}\n new_q=nil\n\n if !querys.empty?\n new_q=querys.find{|q| (q.query_id==name_q)}\n end\n\n return new_q\n end",
"def get_parent\n\n get_expression_pool.fetch_expression(@parent_id)\n end",
"def qtype\n (parent_qid.to_i == 0) ? QTYPES[type] : \"#{QTYPES[type]}_child\"\n end",
"def query\n @query ||= search.query\n end",
"def query\n self\n end",
"def query\n self\n end",
"def parent_child_where\n a,b = query_string.split(/\\s+/, 2)\n return table[:id].eq(-1) if a.nil? || b.nil?\n table[:name].matches(\"#{a}%\").and(parent[:name].matches(\"#{b}%\"))\n end",
"def query\n @query || params[:q] || params[:tq]\n end",
"def base_query\n [nil]\n end",
"def child_get(name)\n child = @children.select{ |elem| name.eql?(elem.name) }\n return nil unless child\n child\n end",
"def query\n @options[:query].presence\n end",
"def get_one(query)\n res = get_all_by_query(query)\n return nil if res.length == 0\n res[0]\n end",
"def query\n print_banner\n @value = query_ask\n end",
"def query_puppetdb(pql)\n require 'puppet/util/puppetdb'\n return Puppet::Util::Puppetdb.query_puppetdb(pql)\n rescue Puppet::Error\n return nil\n end",
"def bottom\n return nil if empty?\n @que.first\n end",
"def parent\n return @parent unless @parent.nil?\n return Message.find(parent_id) unless parent_id.nil?\n end",
"def parent_reply\n Reply.find_by_id(self.parent_id)\n end",
"def sub_questions\n @sub_questions ||= lime_group.lime_questions.select{|question|question.parent_qid == qid}\n end",
"def query\n unless defined?(@query)\n d = @data\n @query = SeqDesc.new(d[4], d[5], d[9], d[10], d[11], d[12],\n split_comma(d[19]), split_comma(d[21]))\n end\n @query\n end",
"def entry\n return nil unless @item and self.type == :query\n @item['entry']\n end",
"def child(type=nil)\n c = children(type)[0]\n end",
"def query()\n\t\tval = self.client.sys.registry.query_value(self.hkey, self.name)\n\n\t\tif (val != nil)\n\t\t\tself.data = val.data\n\t\t\tself.type = val.type\n\t\tend\n\n\t\treturn self.data\n\tend",
"def query\n attributes.fetch(:query)\n end",
"def query\n @query ||= \n Content::Query.new(query_options.merge(:user_query => search))\n end",
"def get_query_response(query, cursor=nil)\n envelope = { :qname => {:query => query, :escape => false }}\n envelope[:qname][:cursor] = cursor if cursor\n \n response = http_request mqlread_service_url, :queries => envelope.to_json\n result = JSON.parse response\n inner = result['qname']\n handle_read_error(inner)\n Ken.logger.info \"<<< Received Response: #{inner['result'].inspect}\"\n inner\n end",
"def query(num)\n if si = section_index(\"query#{num}\")\n self[si]\n else\n nil\n end\n end",
"def knowledge_base(q)\n KnowledgeBase.find(self, q)\n end",
"def retrieve_message(q)\n WMQ::QueueManager.connect(@connection_options) do |qmgr|\n qmgr.open_queue(:q_name => q.name, :mode => :input) do |queue|\n\n get_options = q.get_options.dup\n wmq_message = WMQ::Message.new\n \n if queue.get(get_options.merge(:message => wmq_message))\n return Message.new(wmq_message, q.name)\n else \n return nil\n end\n end\n end\n end",
"def query_chain(qlass = self, &block)\n chain = QueryChain.new(qlass)\n chain.instance_exec &block if block_given?\n chain._result\n end",
"def query(&block)\n Query.new(self, &block)\n end",
"def self_query\n self.class.where(id: id)\n end",
"def query(&block)\n raise(ArgumentError, 'Query cannot be run. No query root has been set.') unless @query_root\n\n Query.new(@query_root, &block).data\n end",
"def raw_query\n @raw_query\n end",
"def child_replies\n Reply.find_by_parent_id(self.id) \n end",
"def query\n @operation = :query\n self\n end",
"def pioQuery\n client.query(current_company.user => 4)\n end",
"def publication_query(collection=Publication)\n query = init_query(publication_collection(collection))\n query = publication_where(query, SharedQueries::OPTIONAL)\n query = speaker_where(query, SharedQueries::OPTIONAL) unless query.terms == [Conference::UNSPECIFIED] # this is a chart click on unspecified publishers\n return query\n end",
"def query(value)\n Query.new(self, @query_by, value).to_relation\n end",
"def top\n return nil if empty?\n @que.last\n end",
"def getQuery()\n return @uri.query\n end",
"def query\n socket.request[\"Query\"] || {}\n end",
"def of(query)\n query\n end",
"def subquery_for(relation)\n operand = relation.operand\n subquery = dispatch(operand)\n if collapse_subquery_for?(relation)\n @from\n else\n aliased_subquery(subquery)\n end\n end",
"def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def children \n\t\t_c = Children.joins(:families).where(:families => {:parent_id => id} )\n\t\tif _c.present?\n\t\t\t_c\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def discover\n choria.pql_query(@query, true)\n end",
"def get_parent\n return nil\n end",
"def get_child!(children)\n children[1] || children\n end",
"def query(*args, &block)\n @query = block ? @query = Query.new(*args, &block) : args.first\n self\n end",
"def child(name)\n SideJob.find(SideJob.redis.hget(\"#{redis_key}:children\", name))\n end",
"def front()\n return is_empty() ? -1 : @q[@front]\n end",
"def query(value = nil, &block)\n __define__(:query, value, block)\n end",
"def query(sql)\n if NB.neverblocking? && NB.reactor.running?\n send_query sql\n NB.wait(:read, IO.new(socket))\n get_result\n else\n super(sql)\n end\n end",
"def parent_document\n pi = parent_item\n return if pi == nil\n pi_id = pi.id\n return if pi_id == nil\n DocumentRepository.find(pi_id)\n end",
"def parent\n self.class.find_by_id(self.parent_id) unless self.parent_id.nil?\n end",
"def parent\n if parent_id.blank? then nil else unscoped_find(parent_id) end\n end",
"def reply?\n !(self.parent.nil?)\n end",
"def as_child(parent)\n x = self\n return x if x == parent \n while x.parent and x.parent != parent\n x = x.parent\n end\n if x.parent == parent\n x\n end\n end",
"def check_query\n self.query\n end",
"def query\n\t\t\treturn @query if @query\n\n\t\t\t@query = CGI.parse(request.query_string)\n\t\t\t@query.default = nil # ruby/lib/cgi/core.rb:340 = den of iniquity.\n\t\t\t@query\n\t\tend",
"def query\n @query ||= Waves::Request::Query.new( \n Waves::Request::Utilities.destructure( request.query ) )\n end",
"def query_root_node(xpath_query, namespaces = {})\n if !@root_node.nil?\n @root_node.xpath(xpath_query, namespaces)\n end\n end",
"def parent\n return persistence_strategy.parent if\n persistence_strategy.respond_to?(:parent)\n\n nil\n end",
"def queryns \n e = first_element('query')\n if e\n return e.namespace\n else\n return nil\n end\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def xpath(query)\n\t\treturn is_valid ? @doc.xpath(query) : nil\n\tend",
"def query_def; (x = @hits.first) ? x.query_def : nil; end",
"def getParentRec\n outcomes = Tree.where(\n tree_type_id: self.tree_type_id,\n version_id: self.version_id,\n subject_id: self.subject_id,\n grade_band_id: self.grade_band_id,\n code: self.parentCode\n )\n\n if outcomes.count == 0\n return nil\n else\n return outcomes.first\n end\n end",
"def query\n resource_id = @params.fetch(:resourceId)\n all_children_ids = db[:archival_object]\n .filter(:root_record_id => resource_id)\n .select(:id)\n db[:instance]\n .inner_join(:sub_container, :instance_id => :instance__id)\n .inner_join(:top_container_link_rlshp, :sub_container_id => :sub_container__id)\n .inner_join(:top_container, :id => :top_container_link_rlshp__top_container_id)\n .left_outer_join(:top_container_profile_rlshp, :top_container_id => :top_container__id)\n .left_outer_join(:container_profile, :id => :top_container_profile_rlshp__container_profile_id)\n .filter {\n Sequel.|({:instance__resource_id => resource_id},\n :instance__archival_object_id => all_children_ids)\n }\n .select(Sequel.as(Sequel.lit(\"CONCAT(COALESCE(container_profile.name, ''), ' ', top_container.indicator)\"), :container),\n Sequel.as(Sequel.lit(\"GetEnumValueUF(sub_container.type_2_id)\"), :container2Type),\n Sequel.as(:sub_container__indicator_2, :container2Indicator),\n Sequel.as(Sequel.lit(\"GetEnumValueUF(sub_container.type_3_id)\"), :container3Type),\n Sequel.as(:sub_container__indicator_3, :container3Indicator))\n .distinct\n end",
"def query_for_self\n query = Ferret::Search::TermQuery.new(:id, self.id.to_s)\n if self.class.configuration[:single_index]\n bq = Ferret::Search::BooleanQuery.new\n bq.add_query(query, :must)\n bq.add_query(Ferret::Search::TermQuery.new(:class_name, self.class.name), :must)\n return bq\n end\n return query\n end",
"def is_query?\n if @qr.to_i.eql? (0)\n return true\n end\n\n false\n end",
"def query(q)\n gql(prepare: true).query(q)\n end",
"def query(query)\n XMLDB::Base::ResourceSet.getInstance(@obj._invoke('query', 'Ljava.lang.String;', query))\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def pop\n return nil if empty?\n @que.pop\n end",
"def event_query(collection=Conference)\n query = init_query(event_collection(collection))\n query = event_where(query, SharedQueries::OPTIONAL)\n query = presentation_where(query, SharedQueries::OPTIONAL)\n return query\n end"
] |
[
"0.58993775",
"0.5887053",
"0.5784862",
"0.5716823",
"0.5713628",
"0.5713628",
"0.5713628",
"0.5711176",
"0.5588036",
"0.5520873",
"0.55024445",
"0.5483394",
"0.5431771",
"0.54214126",
"0.53631604",
"0.53083885",
"0.53028256",
"0.527592",
"0.5246575",
"0.52173537",
"0.521533",
"0.51861346",
"0.5185974",
"0.518531",
"0.51743346",
"0.51689184",
"0.51529473",
"0.5144889",
"0.5144889",
"0.51317436",
"0.5116055",
"0.51144004",
"0.508855",
"0.5079358",
"0.5075346",
"0.50688255",
"0.5056732",
"0.5055923",
"0.5054449",
"0.5050607",
"0.5046603",
"0.5045004",
"0.50438476",
"0.50336164",
"0.5010826",
"0.49894422",
"0.49834386",
"0.49821797",
"0.4976717",
"0.4972494",
"0.49388534",
"0.49303526",
"0.49248996",
"0.4923972",
"0.4913974",
"0.4885187",
"0.48831278",
"0.48799345",
"0.48716444",
"0.48700717",
"0.4854879",
"0.48536822",
"0.4851406",
"0.4848373",
"0.48456526",
"0.48431",
"0.48267308",
"0.4823745",
"0.4811352",
"0.4791279",
"0.47909203",
"0.47899377",
"0.47859278",
"0.47814453",
"0.47799692",
"0.47670764",
"0.47602773",
"0.4759952",
"0.47533625",
"0.47519326",
"0.47496462",
"0.47478336",
"0.47475988",
"0.4737956",
"0.47353876",
"0.47286224",
"0.47237366",
"0.47123235",
"0.47083107",
"0.4705338",
"0.4692645",
"0.46920803",
"0.46916416",
"0.46915284",
"0.46807128",
"0.46677965",
"0.46624",
"0.4660717",
"0.4659332",
"0.46569318"
] |
0.57244396
|
3
|
Delete old elements named newquery.name newquery:: [REXML::Element] will be added
|
def query=(newquery)
delete_elements(newquery.name)
add(newquery)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_by_query(queries)\n queries = [queries] unless queries.is_a?(Array)\n build do |xml|\n xml.delete do |delete_node|\n queries.each { |query| delete_node.query query }\n end\n end\n end",
"def delete_by_query query, opts = {}\n update opts.merge(:data => xml.delete_by_query(query))\n end",
"def remove_query(query_id)\n add_actions \"removequery(#{query_id})\"\n end",
"def remove_query(*keys)\n return unless query\n\n if keys.size > 1\n keys.map { |key| query.delete(key.to_sym) }\n else\n query.delete(keys.first.to_sym)\n end\n end",
"def query_unset_all\n rebuild_uri :query => nil\n end",
"def delete_all(xpath); end",
"def del(*keys)\n keys.each do |key|\n @queries.delete(key)\n end\n\n self\n end",
"def add_query_elements(query_elements)\n @query_elements.merge! query_elements\n self\n end",
"def retract_definition(*args)\n unless(args.length == 3 && !args.first.is_a?(Array))\n args = args.inject([]) {|a,i| a += i }\n end\n\n args = parse_schema_axioms(args)\n\n triples = QL.to_turtle(args, true)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug triples\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, triples, @schema_graph, \"text/turtle\")\n self\n end",
"def delete_query(project_id, query_id)\n delete \"projects/#{project_id}/queries/#{query_id}\"\n end",
"def delete_query(query)\n do_delete_query(query)\n end",
"def copy(query)\n queries << query\n end",
"def delete_by_query(query)\n rsp = post(\"<delete><query>#{query}</query></delete>\")\n success?(rsp.body) or log_error(rsp.body)\n end",
"def query_unset(name)\n query_set name, nil\n end",
"def reset\n self.query = Query.new\n end",
"def delete_percolator_query(query_name)\n server.request(:delete, percolator_query_path(query_name))\n end",
"def clear_queries\n add_actions 'ClearQueries()'\n end",
"def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end",
"def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def delete_query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.delete({params: query_params })\n self\n end",
"def delete_by_query(queries)\n { delete: { query: queries } }.to_json\n end",
"def delete_element(element); end",
"def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end",
"def delete_all(name); end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def delete(element); end",
"def test_delete_Wire\n printf \"\\n@T:#{__method__}\\n\"\n @root_org = XMLParse.read(\"./tp/test_simple.xml\")\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n golden = [\"wire001\",\"wire003\",\"SEL_w\"]\n golden.each do |wire|\n XMLParse::delete_Wire(@root,\"test\",wire)\n end\n revised = Array.new\n wire_diff(@root_org,@root,\"test\").each do |wire|\n revised << wire.Name\n end \n assert_equal(golden,revised)\n end",
"def delete(field_name)\n @element_map.delete(field_name.to_s)\n end",
"def remove_by_query(index, types, options)\n resp = delete do |req|\n req.url \"#{index}/#{types}/_query\"\n req.body = options\n end\n resp.body\n end",
"def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end",
"def to_xml_updates\n exception_arrays = %w(required_attendees optional_attendees) # exceptions for the DeleteItemField element, those attributes are actually overwritten\n doc = Nokogiri::XML::Document.new\n root = doc.create_element(\"Updates\")\n self.class.elements.each do |name, field|\n value = read_attribute(name)\n # Create or update existing fields\n if changes.include?(name.to_s)\n field.to_xml_updates(value) do |field_uri_xml, element_xml|\n # Exchange does not like updating to nil, so delete those.\n if element_xml.text.present?\n set_item_field = doc.create_element(\"SetItemField\")\n set_item_field << field_uri_xml\n element_wrapper = doc.create_element(tag_name)\n element_wrapper << element_xml\n set_item_field << element_wrapper\n root << set_item_field\n elsif !exception_arrays.include?(name.to_s)\n delete_item_field = doc.create_element(\"DeleteItemField\")\n delete_item_field << field_uri_xml\n root << delete_item_field\n end\n if exception_arrays.include?(name.to_s)\n puts \"FIELD_URI_XML #{field_uri_xml.inspect}\"\n puts \"ELEMENT_XML #{element_xml.inspect}\"\n puts \"-\" * 80\n end\n end\n end\n # Delete removed phone numbers, etc\n if changes.include?(name.to_s) && value.is_a?(Array) && !exception_arrays.include?(name.to_s)\n old_values, new_values = changes[name.to_s]\n deleted_values = old_values - new_values\n field.to_xml_updates(deleted_values) do |field_uri_xml, _|\n delete_item_field = doc.create_element(\"DeleteItemField\")\n delete_item_field << field_uri_xml\n root << delete_item_field\n end\n end\n end\n root\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def remove *k\n\t\t\t# todo combine queries in a transaction\n\t\t\tActiveOrient::Base.logger.debug { \"delete: #{@name} --< #{k.map(&:to_or).join( ' :: ' )}\"}\n\t\t k.map{|l|\t@orient.update( {remove: { @name => l} } ) }\n\t#\t\t@orient.reload!\n\t#\t\t@orient.send @name \n\t\tend",
"def mongoize_queries(queries)\n # delete any information not needed by/compatible with Mongoid execution\n mongoized_queries = queries.dup\n mongoized_queries.each_pair do |name, details|\n # have to dup the query details to avoid changing the original hashes\n mongoized_queries[name] = details.dup.tap {|t| t.delete(:klass) }\n end\n end",
"def move_collection_names\n @record.xpath('./datafield[@tag=\"710\"]/subfield[@code=\"5\"]').each do |subfield|\n collection = subfield.parent.at_xpath('./subfield[@code=\"a\"]').text\n\n Nokogiri::XML::Builder.with(@doc.at('record')) do |xml|\n xml.datafield('ind1' => '0', 'ind2' => '0', 'tag' => '773') do\n xml.subfield(collection, 'code' => 't')\n end\n end\n\n subfield.parent.remove\n end\n end",
"def delete_previous_results(all = false)\n if pom?\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsSiteEnergy\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsCost\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:CalculationMethod\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}AnnualSavingsByFuels\")\n end\n\n # Delete elements from the xml and reset the attributes to empty\n if pom? || cb_modeled? || all\n get_scenario_type_child_element.elements.delete(\"#{@ns}AllResourceTotals\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}ResourceUses\")\n @resource_uses = []\n @all_resource_totals = []\n end\n end",
"def delete_query(query, params = {})\n do_delete_query(query, params)\n end",
"def delete(query)\n @index.query(Query.new(string: query)).each do |state|\n @index.on_state_change(\n state,\n State.new(\n host: state.host,\n service: state.service,\n state: 'unknown',\n description: \"ustate has not heard from this service since #{Time.at(state.time)}\",\n time: Time.now.to_i\n )\n )\n @index.delete state\n end\n end",
"def delete_element\n return false unless new_resource.delim # no delim: delete the key\n\n needs_delete = new_values.any? { |v| current_values.include?(v) }\n if !needs_delete\n logger.trace(\"#{new_resource} element '#{new_resource.value}' does not exist\")\n true # do not delete the key\n else\n new_value =\n current_values.select do |item|\n not new_values.include?(item)\n end.join(new_resource.delim)\n\n if new_value.empty?\n false # nothing left here, delete the key\n else\n old_value = new_resource.value(new_value)\n create_env\n logger.trace(\"#{new_resource} deleted #{old_value} element\")\n new_resource.updated_by_last_action(true)\n true # we removed the element and updated; do not delete the key\n end\n end\n end",
"def purged_xml_for_clone\n local_structs_regex = []\n shape.local_structs.each do | struct |\n local_structs_regex << struct.name.underscore.downcase.dasherize\n end\n xml_doc.search('*[@resource-type=\"ActiveRecord\"]', *local_structs_regex.uniq).unlink\n xml_doc.search('file[@resource-type=\"Primitive\"]').each do |file|\n file['value'] = ''\n file['width'] = ''\n file['height'] = ''\n file['content_type'] = ''\n end\n xml_doc\n end",
"def end_element(name); end",
"def end_element(name); end",
"def op_del(attrname = nil)\n attrname ||= pop\n push pop.dup\n peek.delete(attrname)\n end",
"def generate_xpath_queries!\n # do nothing\n end",
"def remove(query)\n curNode = @head\n while curNode != nil\n if curNode.data.name == query\n if curNode == @head\n if curNode.next != nil\n @head = curNode.next\n curNode.next.prev = nil\n curNode.next = nil\n @size = @size - 1\n return 0\n end\n elsif curNode == @tail\n if curNode.prev != nil\n @tail = curNode.prev\n curNode.prev.setNext(nil)\n curNode.setPrev(nil)\n @size = @size - 1\n return 0\n end\n else\n curNode.prev.setNext(curNode.next)\n curNode.next.setPrev(curNode.prev)\n curNode.setPrev(nil)\n curNode.setNext(nil)\n @size = @size - 1\n return 0\n end\n elsif curNode.next == nil\n return -1\n else\n curNode = curNode.next\n end\n end\n end",
"def cleanup! xml\n ns = { 'pre' => 'info:lc/xmlns/premis-v2' }\n \n conflicts = xml.find(\"//pre:*[starts-with(@xmlID, 'agent-')]\", ns).to_a + \n xml.find(\"//pre:*[starts-with(@xmlID, 'object-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'event-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'bitstream-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'representation-')]\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='DPMD1']\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='PREMIS_AMD']\", ns).to_a\n \n unless conflicts.empty?\n \n # prepend all IDs with 'premis_'\n xml.find(\"//pre:*[@xmlID]\", ns).each do |c| \n c['xmlID'] = \"premis_#{c['xmlID']}\"\n end\n \n # modify corresponding IDRefs\n ['RelEventXmlID', 'RelObjectXmlID', 'LinkObjectXmlID', 'LinkEventXmlID',\n 'LinkAgentXmlID', 'LinkPermissionStatementXmlID'].each do |a|\n \n xml.find(\"//pre:*[@#{a}]\", ns).each do |node|\n new_idref = node[a].split.map { |s| \"premis_#{s}\" }\n node[a] = new_idref * ' '\n end\n\n end\n \n end\n \n xml\n end",
"def add_unranked_query_result\n \n @query_result = Retreval::UnrankedQueryResult.new :query => \"query1\", :gold_standard => @gold_standard\n \n for i in (1..4) do\n @query_result.add_document :id => \"doc#{i}\"\n end\n \n for i in (5..10) do\n @query_result.add_document :id => \"doc#{i}\"\n end\n \n end",
"def delete(query)\n adapter.delete(query)\n end",
"def remove_index_on(node, old_props)\n @config.fields.each { |field| rm_index(node, field, old_props[field]) if old_props[field] }\n end",
"def after_query(query)\n events = query.context.namespace(:subscriptions)[:events]\n if events && events.any?\n @schema.subscriptions.write_subscription(query, events)\n end\n end",
"def test_delete_Port\n printf \"\\n@T:#{__method__}\\n\"\n @root_org = XMLParse.read(\"./tp/test_simple.xml\")\n# p XMLParse::get_PortList(@root_org,\"test\").keys\n\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n golden = [\"CLK2\",\"RST\",\"DIN2\",\"IO_PORT1\"]\n golden.each do |signal|\n @root = XMLParse::delete_Port(@root,\"test\",signal)\n end\n# p XMLParse::get_PortList(@root_org,\"test\").keys\n# XMLParse::save(@root_org,\"mod.xml\")\n# `XMLtoVerilog mod.xml > tp/mod.v`\n# exit\n \n diff = port_diff(@root_org,@root,\"test\")\n revised = Array.new\n diff.each do |signal|\n revised << signal.Name\n end\n assert_equal(golden,revised)\n end",
"def clear_metadata(schema, element, qualifier = nil, language = nil)\n new_metadatum = build_metadatum(schema, element, qualifier, language)\n return if new_metadatum.nil?\n\n updated_metadata = []\n metadata.each do |metadatum|\n if metadatum.matches_field?(new_metadatum)\n metadatum.delete\n else\n updated_metadata << metadatum\n end\n end\n @metadata = MetadataArray.new(updated_metadata)\n end",
"def delete_all!\n delete(query: \"*:*\")\n end",
"def format_query\n output = query.q.dup\n words_to_remove = %w(international airport municipal)\n words_to_remove.each do |word|\n output.gsub!(/#{word}/i, \"\")\n end\n output\n end",
"def cleanup_old_docs(old_object_doc_array, collection_name)\n logger.debug \"Clean up old documents\"\n # iterate over each old doc\n old_object_doc_array.each do\n |old_object_doc|\n # Remove it from MongoDB by referencing '_id' key\n collection_by_name(collection_name).remove({\"_id\" => old_object_doc[\"_id\"]})\n end\n end",
"def unlink(ids)\n ids = [ids] if(ids.is_a?(String))\n query = QL.unlink_sparql_query(ids)\n results = @connection.query(@db_name, query,{}).body\n triples = results[\"results\"][\"bindings\"].map do |h|\n \"<#{h['S']['value']}> <#{h['P']['value']}> <#{h['O']['value']}>\"\n end\n\n if(triples.length > 0)\n triples = \"#{triples.join('.')} .\"\n GRel::Debugger.debug \"REMMOVING\"\n GRel::Debugger.debug triples\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, triples, nil, \"text/turtle\")\n end\n self\n end",
"def user_moved_query _user, query, _old_case\n data = {\n category: 'Queries',\n action: 'Moved a Query',\n label: query.query_text,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end",
"def replace_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = replace_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n \n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def remove(element, new_time)\n @remove_set[element] = new_time.to_i\n self\n end",
"def remove_all(index, type)\n resp = delete do |req|\n req.url \"#{index}/#{type}/_query\", :q => '*'\n end\n resp.body\n end",
"def delete( *regexs )\n self.dup.delete!( *regexs )\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def update_query( hash )\n \n # Convert symbols to strings to avoid duplicate entries\n hash = Hash[hash.map {|k, v| [ k.to_s, v] }] if hash.keys.any? { |k| k.is_a?(Symbol) }\n \n # Merge the changes with the existing query\n query.query_values = query.query_values.merge!( hash )\n \n self\n end",
"def delete_queries\n [\n \"DROP TRIGGER tr_#{suffix} ON #{src_table};\",\n \"DROP FUNCTION fn_#{suffix}();\",\n \"DROP TRIGGER tr_#{suffix}_cleaner ON #{surveys_table};\",\n \"DROP FUNCTION fn_#{suffix}_cleaner();\"\n ]\n end",
"def remove!\n self.results.each{ |r| r.remove! }\n self.metadata.remove!\n end",
"def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end",
"def rehash\n @rules.rehash\n @elements = nil\n end",
"def retract_rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, rules, @schema_graph, \"text/turtle\")\n self\n end",
"def reap(query, age)\n reap! query, age\n compile\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@query.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def expand_queries(queries, threshold, ssr, pgr)\n\t\text_queries = []\n\t\tqueries.each do |q, offsets|\n\t\t\text_queries += expand_query(q, offsets, threshold, ssr, pgr)\n\t\tend\n\t\n\t\t# @return [ {:requested_query => string, :original_query => string, \n\t\t# :range => (begin...end), :sim => float}, ... ]\n\t\text_queries\n\tend",
"def clearQueryCache\r\n result = request(\"DELETE\", \"_api/query-cache\")\r\n return return_delete(result)\r\n end",
"def retract_validation(*args)\n unless(args.length == 3 && !args.first.is_a?(Array))\n args = args.inject([]) {|a,i| a += i }\n end\n triples = QL.to_turtle(args, true)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug triples\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove_icv(@db_name, triples, \"text/turtle\")\n self\n end",
"def delete(name)\n fields.delete(name.to_sym)\n end",
"def sanitize_query(queries)\n cleaned_query = {}\n\n defaults = {\n taxonomy: '',\n terms: [],\n field: 'term_id',\n operator: 'IN',\n include_children: true,\n }\n # queries.each do |key, query|\n # # TODO continue\n # end\n cleaned_query = queries\n\n cleaned_query\n end",
"def reset_query(model)\n nil\n end",
"def q!(query, db)\n # build bindings from references\n bindings = []\n if query.references\n query.references.each do |reference|\n bindings << @row[reference]\n end\n end\n # query\n qry = query.query.gsub(''',\"'\").gsub('"','\"') # replace single and double quotes that rexml substituted out.\n if bindings.empty?\n rows = db.connection.select_all(qry)\n else\n rows = db.connection.select_all(qry, *bindings)\n end\n result_rows = []\n rows.each do |row|\n result_rows << Row.new(query.name, row, query.attributes)\n end\n result_rows.each do |row|\n self << row\n end\n return result_rows\n end",
"def delete(name); end",
"def delete(name); end",
"def clear\n @fetch = nil\n @query = {}\n @query[:q] = []\n self\n end",
"def clear\n @fetch = nil\n @query = {}\n @query[:q] = []\n self\n end",
"def query_set(name, value)\n query = uri.query ? \"&#{uri.query}&\" : ''\n parameter = Regexp.new(\"&#{Regexp.escape name}=.+?&\")\n if query =~ parameter\n new_query = value.nil? ?\n query.gsub(parameter, '&') :\n query.gsub(parameter, \"&#{name}=#{value}&\")\n else\n new_query = value.nil? ? query : \"#{query}#{name}=#{value}\"\n end\n new_query = new_query.gsub(/^&/, '').gsub(/&$/, '')\n new_query = nil if (new_query == '')\n rebuild_uri :query => new_query\n end",
"def add_removals(statements)\n statements.each do |statement|\n add_removal(statement)\n end\n end",
"def modify_search_query\n query_data = params['q'] && params['q'][Garage::SearchPredicate]\n if query_data.present?\n params['q'][Garage::SearchPredicate] = query_data.split(' ')\n end\n end",
"def remove(data = nil, options = {})\n if data\n GRel::Debugger.debug \"REMMOVING\"\n GRel::Debugger.debug QL.to_turtle(data)\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, QL.to_turtle(data), nil, \"text/turtle\")\n else\n args = {:describe => true}\n args = {:accept => \"application/rdf+xml\"}\n\n sparql = @last_query_context.to_sparql_describe\n triples = @connection.query(@db_name,sparql, args).body\n\n @connection.remove(@db_name, triples, nil, \"application/rdf+xml\")\n end\n self\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def end_element(name)\n if name == 'RecordDetails'\n @record = InstrumentDocument.save_from_array(@document)\n @document = nil\n end\n end",
"def clear\n @query = {}\n @query[:searchTerms] = []\n @query[:startPage] = 1\n @query[:count] = 20\n @total_results = 0\n @search_type = \"request\"\n self\n end",
"def remove_all_method\n :\"remove_all_#{self[:name]}\"\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def rewrite_html (html_file)\n\t\tdoc = Nokogiri::HTML(open(html_file))\n\t\tUNNECESARY_HTML_NODES.each do |node_path|\n \tnode = doc.xpath(node_path)\n \tnode.remove\n \t\tend\n \t\tFile.open(html_file,'w') { |file| doc.write_html_to file }\n\tend",
"def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend",
"def clear(_options = nil)\n # TODO: Support namespaces\n @client.delete_by_query index: @index_name, type: 'entry', body: { query: { match_all: {} } }\n end",
"def db_remove\n \"DELETE\" + from_table_where + sql_match_conditions\n end"
] |
[
"0.6609964",
"0.5961317",
"0.5631487",
"0.55475813",
"0.5470925",
"0.54295766",
"0.5419503",
"0.53961045",
"0.53300124",
"0.52318823",
"0.52173513",
"0.51731414",
"0.5161339",
"0.5124656",
"0.50857574",
"0.50843495",
"0.50525343",
"0.50003606",
"0.49995553",
"0.49843356",
"0.4983731",
"0.49719375",
"0.4966355",
"0.49431837",
"0.49140894",
"0.49118313",
"0.4910465",
"0.48976657",
"0.48800117",
"0.4877396",
"0.4872759",
"0.48282132",
"0.48218775",
"0.4762541",
"0.47503045",
"0.4742703",
"0.47332802",
"0.4725399",
"0.47096258",
"0.47046965",
"0.46968997",
"0.46968997",
"0.46804035",
"0.4680195",
"0.46578547",
"0.46526977",
"0.46462524",
"0.46352518",
"0.46314618",
"0.46282622",
"0.46184656",
"0.4613384",
"0.45880815",
"0.4584307",
"0.4567834",
"0.45642024",
"0.4555011",
"0.4542565",
"0.4539064",
"0.45390195",
"0.45356065",
"0.45346412",
"0.4533941",
"0.45304087",
"0.45233157",
"0.45223248",
"0.4521494",
"0.45173398",
"0.4508579",
"0.4499067",
"0.449514",
"0.44806802",
"0.44770327",
"0.44714442",
"0.4470992",
"0.44626644",
"0.4449587",
"0.44472653",
"0.44320518",
"0.44287",
"0.44248635",
"0.44248635",
"0.44116884",
"0.44116884",
"0.44070095",
"0.4406081",
"0.4403743",
"0.44010264",
"0.4396351",
"0.4396351",
"0.4396351",
"0.4396351",
"0.43930182",
"0.4389467",
"0.43826318",
"0.4380435",
"0.43784148",
"0.43777332",
"0.43737322",
"0.43709898"
] |
0.6704397
|
0
|
Returns the iq's query's namespace, or nil result:: [String]
|
def queryns
e = first_element('query')
if e
return e.namespace
else
return nil
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def namespace\n @namespace ||= schema.attributes['Namespace'].value\n end",
"def namespace\n @namespace.ns\n end",
"def namespace\n @namespace ||= metadata.xpath('//Schema').first.attributes['Namespace'].value\n end",
"def namespace\n nil\n end",
"def namespace(ns)\n ns.blank? ? \"nil\" : %|\"#{ns.prefix}\"|\nend",
"def raw_namespaces(result_format=\"application/sparql-results+json\")\n easy = Curl::Easy.new\n easy.headers[\"Accept\"] = result_format\n\n easy.url = self.uri + \"/namespaces\"\n easy.http_get\n\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 200\n\n easy.body_str\n end",
"def namespace\n nil\n end",
"def namespace\n return @namespace\n end",
"def namespace\n return @namespace\n end",
"def namespace_name\n @namespace_name ||= namespaces.join('::')\n end",
"def namespace\n @namespace\n end",
"def namespace\n @namespace || self.class.namespace\n end",
"def namespace(prefix)\n easy = Curl::Easy.new\n easy.url = self.uri + \"/namespaces/\" + easy.escape(prefix)\n easy.http_get\n\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 200\n\n ns = easy.body_str\n ns =~ /^Undefined prefix:/ ? nil : ns\n end",
"def namespace\n return NAMESPACE\n end",
"def namespace\n NAMESPACE\n end",
"def namespace\n @options[:space_name]\n end",
"def namespace\n read_property 'RootNamespace'\n end",
"def namespace\n return self.name ? self.name.downcase.gsub(/[^0-9A-Za-z ]/, '').gsub(' ', '-') : ''\n end",
"def ns(wanted_uri=\"DAV:\")\n _ns = ''\n if(request_document && request_document.root && request_document.root.namespace_definitions.size > 0)\n _ns = request_document.root.namespace_definitions.collect{|__ns| __ns if __ns.href == wanted_uri}.compact\n if _ns.empty?\n _ns = request_document.root.namespace_definitions.first.prefix.to_s if _ns.empty?\n else\n _ns = _ns.first\n _ns = _ns.prefix.nil? ? 'xmlns' : _ns.prefix.to_s\n end\n _ns += ':' unless _ns.empty?\n end\n _ns\n end",
"def namespace\n self.class.new split(NAMESPACE_SEPARATOR).first\n end",
"def namespace\n Matsuri::Platform.send(Matsuri::Config.environment).namespace || 'default'\n end",
"def namespace\n @namestack.join(\"::\")\n end",
"def namespace(value = nil)\n if value\n field_type.namespace(value)\n else\n record.namespace\n end\n end",
"def find_namespace(name = '')\n @namespaces[name]\n end",
"def get_namespace( node, prefix )\n if @namespaces\n return @namespaces[prefix] || ''\n else\n return node.namespace( prefix ) if node.node_type == :element\n return ''\n end\n end",
"def namespace\n cfg_get(:namespace)\n end",
"def namespace\n if Types.use_namespaces?\n 'MG'\n else\n ''\n end\n end",
"def ns(doc,identifier)\n\tdoc.xpath(identifier).text\nend",
"def namespace\n self.class.namespace\n end",
"def query_id\n if prefix = entity_namespace.presence\n \"#{prefix}::#{@query_id}\"\n else\n @query_id\n end\n end",
"def namespaces(name = nil)\n if name\n namespaces.find(:name => name)\n else\n @namespaces.flatten\n end\n end",
"def namespace\n entity_container.namespace\n end",
"def namespace\n entity_container.namespace\n end",
"def namespace\n cfg_get(:namespace)\n end",
"def namespace_uri\n @namespace_uri ||= stream.namespace_uri\n end",
"def rootNamespace\n @namespace ? @namespace.rootNamespace : self\n end",
"def parsingNamespace \n \"parsingNamespace\" \n end",
"def extract_namespace node\n node.ancestors[0].to_s\n end",
"def prefix_for(ns_uri)\n if namespaces_by_uri().has_key?(ns_uri)\n namespaces_by_uri()[ns_uri].prefix || \"\" # namespace.prefix returns nil if there is no prefix defined (default prefix)\n end\n end",
"def current_namespace\n @current_namespace\n end",
"def element_by_xpath_with_default_namespace(xpath_without_ns)\n xpath_without_ns = xpath_without_ns.to_s\n @xml.xpath(xpath_without_ns.gsub(/(^|\\/{1,2})(\\w+)/, '\\1xmlns:\\2'), :xmlns => OMF_NAMESPACE)\n end",
"def namespace(name)\n @node = @parser.namespaces.find(:all, :name => name)\n end",
"def namespace\n @intf_namespace ||= self.class.name.split('::').last.downcase\n end",
"def query_root_node(xpath_query, namespaces = {})\n if !@root_node.nil?\n @root_node.xpath(xpath_query, namespaces)\n end\n end",
"def get_namespace request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_namespace_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ServiceDirectory::V1beta1::Namespace.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def namespaces_by_prefix\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'namespaces' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ns\").inject(Hash.new) do |namespaces, namespace|\n prefix = namespace.attributes[\"canonical\"] || \"\"\n namespaces[prefix] = namespace.attributes[\"id\"].to_i\n namespaces\n end\n end",
"def namespace\n \"#{database.name}.#{name}\"\n end",
"def namespace\n \"#{database.name}.#{name}\"\n end",
"def namespaces\n root ? root.namespaces : {}\n end",
"def namespace\n @namespace ||= [request.args.namespace_name, request.args.application_name].compact.join('-')\n end",
"def get_namespace(node, prefix); end",
"def namespace\n self.class.namespace\n end",
"def custom_namespaces\n Settings.emis.military_information.v1.soap_namespaces\n end",
"def namespace_prefix( doc, ns )\n doc_ns = doc.collect_all_namespaces_href_keys\n if doc_ns.key?( ns )\n doc_ns[ ns ].first.nil? ? 'xmlns' : doc_ns[ ns ].first\n else\n 'xmlns'\n end\nend",
"def namespace_prefix( doc, ns )\n doc_ns = doc.collect_all_namespaces_href_keys\n if doc_ns.key?( ns )\n doc_ns[ ns ].first.nil? ? 'xmlns' : doc_ns[ ns ].first\n else\n 'xmlns'\n end\n end",
"def namespace(value = nil)\n if value\n @namespace = value\n else\n @namespace\n end\n end",
"def namespace\n slice_name.namespace\n end",
"def get_namespace_type(fqns); end",
"def namespace(namespace = nil)\n @namespace = namespace if namespace\n @namespace\n end",
"def qualified_name(x)\n qn = x.name\n qn = \"#{ x.namespace.prefix }:#{ x.name }\" if x.namespace && x.namespace.prefix\n qn\n end",
"def describe_namespace(namespace_name)\n namespace = @admin.getNamespaceDescriptor(namespace_name)\n\n return namespace.to_s unless namespace.nil?\n\n raise(ArgumentError, \"Failed to find namespace named #{namespace_name}\")\n end",
"def on_call_namespace_uri(context, expression = nil)\n node = function_node(context, expression)\n\n if node.respond_to?(:namespace) and node.namespace\n return node.namespace.uri\n else\n return ''\n end\n end",
"def namespaces\n root ? root.collect_namespaces : {}\n end",
"def extract_namespace type\n extract_namespace_and_scope(type)[0]\n end",
"def xmlns_si\n \"xmlns#{siprefix false}=\\\"http://www.volantis.com/xmlns/2004/06/xdimecp/interim/si\\\"\"\n end",
"def subject\n query_root_node(\"dc:subject/text()\", @@NAMESPACES)\n end",
"def namespace(value)\n _namespace(value) or fail ArgumentError, \"Unknown value for namespace: #{value}\"\n end",
"def namespace_text\n\t\t\t@data[\"namespace\"][\"text\"]\n\t\tend",
"def fetch_namespace(resource)\n uri = Addressable::URI.parse(resource.to_s)\n \n if(uri.fragment != nil)\n return \"#{uri.host}#{uri.path}\"\n elsif(resource.to_s.include?(\"bio2rdf.org\"))\n #template = Addressable::Template.new(\"http://{host}/{first}:{fragment}\")\n #template = template.extract(uri)\n ns = resource.to_s.split(\":\")\n return ns[0..(ns.length-1)].join(\":\")\n #return \"#{template[\"host\"]}#{template[\"first\"]}\"\n end\n end",
"def namespaces(name = nil)\n find_children_of_type(\"Namespace\", name)\n end",
"def lookup_namespace_uri( prefix )\n # TODO\n nil\n end",
"def namespace(namespace = nil, options = {})\n return @namespace unless namespace\n\n @namespace = namespace.to_sym if namespace\n @base_namespace = options[:base].to_sym if options[:base]\n end",
"def resolve_namespace_of(name)\n context = nil\n while true\n ns, name = GCCXMLLoader.split_first_namespace(name)\n name = \"/#{name}\"\n break if ns == '/'\n ns = ns[0..-2]\n candidates = info.name_to_nodes[ns].find_all { |n| NAMESPACE_NODE_TYPES.include?(n.name) }\n if !context\n context = candidates.to_a.first\n else\n context = candidates.find { |node| node['context'].to_s == context }\n end\n if !context\n break\n else context = context[\"id\"].to_s\n end\n end\n return name, context\n end",
"def get_namespaces\n response = get_siteinfo('namespaces')\n ret = {}\n response['query']['namespaces'].each do |id, _|\n idid = response['query']['namespaces'][id]['id']\n name = response['query']['namespaces'][id]['*']\n ret[idid] = name\n end\n ret\n end",
"def get_namespaced_name(restarget)\n # Calculated fields or PgQuery::FUNC_CALL can't be used as a query parameter\n restarget.val.column_ref.fields.map { |f| field_parse(f) }.join('.') if restarget.val.column_ref\n end",
"def namespace\n @namespace ||= self.class.to_s.split('::').first.gsub('_', '').sub('Application', '')\n end",
"def on_axis_namespace(ast_node, context)\n nodes = XML::NodeSet.new\n name = ast_node.children[1]\n\n context.each do |context_node|\n next unless context_node.respond_to?(:available_namespaces)\n\n context_node.available_namespaces.each do |_, namespace|\n if namespace.name == name or name == '*'\n nodes << namespace\n end\n end\n end\n\n return nodes\n end",
"def to_s\n \"Namespace prefix ‘#{@prefix}’ for QName ‘#{@qname_string}’ is not bound to a URI\"\n end",
"def query \n first_element('query')\n end",
"def namespace(n)\n only :job\n str! :namespace, n\n end",
"def namespace\n object_id.to_s + \"/\"\n end",
"def xmlns\n product_response[\"xmlns\"]\n end",
"def namespace_id\n\t\t\t@data[\"namespace\"][\"id\"]\n\t\tend",
"def id_of_namespace(namespace)\n ret = RestClient.get \"#{@url}/namespaces?search=#{namespace}\", \n { \"Private-Token\": @token}\n json = JSON.parse(ret.body)\n\n json[0]['id']\n end",
"def namespace(namespace = nil)\n @namespace = namespace if namespace\n @namespace if defined? @namespace\n end",
"def [](ns)\n namespaces = ns.to_s.split(\":\").compact\n rtn = @applications.find {|a| a.name == namespaces.shift }\n begin\n while (!namespaces.empty?)\n rtn = rtn[namespaces.shift]\n end\n rescue\n return nil\n end\n return rtn\n end",
"def namespace(ns)\n if ns == :interpreter\n self\n else\n @storage[ns]\n end\n end",
"def get_namespaces\n raise NotImplementedError\n end",
"def namespaces\n @opts[:namespace]\n end",
"def find_by_namespace(name)\n @namespaces.select {|ns| ns[:namespace] == name}\nend",
"def find(namespace_name = nil)\n return nil if namespace_name.nil?\n\n @namespaces.find { |k| k.name == namespace_name.to_s }\n end",
"def namespace?\n node_type == NAMESPACE_DECL\n end",
"def getNamespace(prefix)\n @obj.getNamespace(prefix)\n end",
"def query_root\n return @query_root\n end",
"def namespace\n @namespace ||= 'silver_spoon'\n end",
"def namespace_names\n @namespaces.map(&:name)\n end",
"def namespace(lang)\n\t\tlang = lang.to_sym\n\t\tnss = select {|x| x.class == Namespace }\n\t\tns = nss.select {|x| x.lang == lang }.last\n\t\tns ||= nss.select {|x| x.lang == :\"*\" }.last\n\t\tns ||= Namespace.new(lang, \"\")\n\t\tns\n\tend",
"def to_qres()\n return QRES::StringResult.new(self.VAR_NAME())\n end",
"def iqn\n \"iqn.2010-09.com.example:01:#{datacenter.name}.#{hostname}\"\n end",
"def namespaces\n warn \"DEPRECATED: this is no longer supported by LDAP. This method will always return an empty Array\"\n []\n end"
] |
[
"0.62251186",
"0.61939293",
"0.6178149",
"0.61747146",
"0.6174442",
"0.6170957",
"0.61697423",
"0.613811",
"0.613811",
"0.5976586",
"0.59408724",
"0.5939381",
"0.589501",
"0.58919036",
"0.58858776",
"0.58840847",
"0.587895",
"0.57759184",
"0.5766562",
"0.57509565",
"0.57450485",
"0.57301545",
"0.56545717",
"0.5564687",
"0.55635417",
"0.5562676",
"0.5552371",
"0.5538211",
"0.55231285",
"0.5522587",
"0.5489456",
"0.546968",
"0.546968",
"0.5466501",
"0.54523283",
"0.54480684",
"0.5433151",
"0.5423367",
"0.5392899",
"0.5385188",
"0.5380146",
"0.53659934",
"0.5340917",
"0.53235656",
"0.5322313",
"0.53210485",
"0.53135",
"0.53135",
"0.53119755",
"0.5308454",
"0.5292059",
"0.52755827",
"0.5252597",
"0.52457345",
"0.523316",
"0.5195539",
"0.5179877",
"0.5140086",
"0.51274455",
"0.5110679",
"0.51101357",
"0.5102219",
"0.50950944",
"0.5093893",
"0.50887704",
"0.50835437",
"0.5074448",
"0.5069444",
"0.5065025",
"0.5055054",
"0.50536084",
"0.5045618",
"0.50452435",
"0.503131",
"0.5027275",
"0.502712",
"0.5017488",
"0.49898356",
"0.49824822",
"0.49688905",
"0.49681365",
"0.49515405",
"0.49452382",
"0.49388286",
"0.49094144",
"0.49005184",
"0.48957974",
"0.4888427",
"0.4878101",
"0.48755458",
"0.48745373",
"0.4851502",
"0.48509735",
"0.48427606",
"0.4837423",
"0.48307896",
"0.4810865",
"0.48073563",
"0.48022535",
"0.47970957"
] |
0.79844165
|
0
|
Returns the iq's child, or nil result:: [IqVcard]
|
def vcard
first_element('vCard')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def child\n children[0]\n end",
"def child\n\t\tif is_child?\n\t\t\tself\n\t\telse\n\t\t\tif !familyid.blank?\n\t\t\t\tStudySubject.children.with_subjectid(familyid).first\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend\n\tend",
"def child_get(name)\n child = @children.select{ |elem| name.eql?(elem.name) }\n return nil unless child\n child\n end",
"def get_child(name)\n Vidalia::checkvar(name,String,self.class.ancestors,\"name\")\n @children[name]\n end",
"def child_from_position(_position)\n value_from_parent_and_position(self, _position)\n end",
"def in_parent_hcard\n @in_parent_hcard ||= self.class.find_in_parent_hcard\n end",
"def child(type=nil)\n c = children(type)[0]\n end",
"def get_child!(children)\n children[1] || children\n end",
"def get_child(line)\n @children.each do |child|\n return child if child.line == line\n end\n nil\n end",
"def [](name)\n name = name.split(\"/\").map{|child| \"ns:#{child}\"}.join(\"/\")\n\n if elem = find_first(name, :ns => VCARD_NS)\n elem.content\n else\n nil\n end\n end",
"def child( path )\n\t\tp = path.reverse\n\t\tn = p.pop\n\t\tif (n<0) | (n>content.length)\n\t\t\tnil\n\t\telsif p.length == 0\n\t\t\t@content[ n ] \n\t\telse\n\t\t\t@content[ n ].child( p.reverse )\n\t\tend;\n\tend",
"def as_child(parent)\n x = self\n return x if x == parent \n while x.parent and x.parent != parent\n x = x.parent\n end\n if x.parent == parent\n x\n end\n end",
"def getChildNode(xml, index)\n\n #puts \"XML -- \\n\\n#{xml}\"\n\t childCount = 0\n if(xml != nil && xml[\"childCount\"] != nil)\n\n childCount = xml[\"childCount\"].to_i\n \t\tif(index >= 0 && index < childCount)\n \t\t return xml[index]\n \t\tend\n end\n\t return nil\n\tend",
"def parent_question\n return nil unless is_sq?\n @parent_question ||= lime_group.lime_questions.find{|question|question.qid==parent_qid}\n end",
"def child(name)\n SideJob.find(SideJob.redis.hget(\"#{redis_key}:children\", name))\n end",
"def child(pat=nil, *rest)\n children(pat, *rest) {|c|\n return c\n }\n return nil\n end",
"def child\n return @links[:child]\n end",
"def FindChildOf(parentByStrat, parentIdentifier, childByStrat, childIdentifier)\n parent = find_element(parentByStrat, parentIdentifier)\n return nil if parent==nil\n return parent.find_element(childByStrat, childIdentifier)\nend",
"def first_child\n child 0\n end",
"def find_vcard(jid)\n raise 'subclass must implement'\n end",
"def object\n object? ? children[2] : nil\n end",
"def child_for_name(name)\n child = child_with_exact_name(name)\n if child\n child\n else\n fallback_child\n end\n end",
"def get_child( rdn )\n\t\tself.log.debug \"Getting child %p from base = %p\" % [ rdn, self.dn ]\n\t\tnewdn = [ rdn, self.dn ].reject {|part| part.empty? }.join( ',' )\n\t\treturn self.class.new( self.directory, newdn )\n\tend",
"def get_child(index)\n @children[index]\n end",
"def getChildren\n begin\n elementObject = waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT)\n children = Squish::Object.children(elementObject)\n return children\n rescue Exception => e\n\t Log.TestFail(\"#{self.class.name}::#{__method__}(): Failed to get children for #{@name}: #{e.message}\")\n return nil\n end\n end",
"def child(childPath)\n %x{ #{ DataSnapshot.new `#@native.child(childPath)` } }\n end",
"def function\n children[0]\n end",
"def child?\n !_parent_id.nil?\n end",
"def children\n @@devices.find {|i, v| i == @id }\n end",
"def children \n\t\t_c = Children.joins(:families).where(:families => {:parent_id => id} )\n\t\tif _c.present?\n\t\t\t_c\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def vcard\n @vcard\n end",
"def get_child(path)\n children.find { |child| child.name == path } || OneDrive404.new\n end",
"def child(index)\n @children[index]\n end",
"def rightChild\r\n children[1]\r\n end",
"def get_child(index)\n \t@children[index]\n end",
"def child\n participant.person\n end",
"def child(id)\n\t\t\t@log.debug(\"id #{id} is frozen?: #{id.frozen?}\")\n\t\t\t\n\t\t\tcase id\n\t\t\twhen String\n\t\t\t\t# Allow the user to use an underscore to specify an \n\t\t\t\t# ampersand for the control name.\n\t\t\t\tby_title = find_window_ex @handle, 0, nil, id.gsub('_', '&')\n\t\t\t\tby_class = find_window_ex @handle, 0, id, nil\n\t\t\t\tif (by_title == 0 && by_class == 0)\n\t\t\t\t\t@log.debug(\"Did not find by title or class, recursing children\")\n\t\t\t\t\t# @children = ChildRecurser.find_all_children(handle) if (@children == nil)\n\t\t\t\t\t# result = search_children(id)\n\t\t\t\t\tresult = ChildEnumerator.find_child(handle, id)\n\t\t\t\t\t@log.debug(\"Found child #{result} for id #{id}\") if (result > 0)\n\t\t\t\telse\n\t\t\t\t\tresult = (by_title > 0) ? by_title : by_class\n\t\t\t\tend\n\t\t\twhen Fixnum\n\t\t\t\tresult = get_dlg_item @handle, id\n\t\t\telse\n\t\t\t\tresult = 0\n\t\t\tend\n\t\n\t\t\traise \"Control '#{id}' not found\" if result == 0\n\t\t\tWindow.new result\n\t\tend",
"def child_with_exact_name(name)\n normal_children.find{|n| n.name == name}\n end",
"def get_child(name, options)\n constant.constants.each do |constant_symbol|\n constant = self.constant.const_get(constant_symbol)\n\n # Check to see if constant is a child class of the public PageObject interface\n next unless constant < get_page_object(options[:interface])\n\n name = constant.name.split('::').last.to_underscore.to_sym\n return create_composite(constant, options[:interface], name)\n end\n\n nil\n end",
"def index_of_child child\n found = nil\n node_id = child.node_id\n each_with_index do |child, idx|\n next unless child.respond_to?(:node_id)\n if child.node_id == node_id\n found = idx\n break\n end\n end\n if ! found\n fail(\"no child of mine: (##{child.node_id} is not in #{node_id}\")\n end\n found\n end",
"def leftChild\r\n children.first\r\n end",
"def fourth_child\n child 3\n end",
"def find_child_from_role(role_name)\n each_out_neighbour_merged(Dependency, intrusive: false) do |myself, child|\n roles = myself[child, Dependency][:roles]\n if roles.include?(role_name)\n if plan\n return plan[child]\n else\n return child\n end\n end\n end\n nil\n end",
"def child_get_string(name)\n @children.each do |elem|\n if(name.eql?(elem.name))\n elem.content\n end\n end\n nil\n end",
"def child?\n @child_pid.nil?\n end",
"def child(place) #call pair.child(1) or pair.child(2) to return that part of the pair. \n choice = place == 1 ? id1 : id2 \n child = Child.find_by_id(choice)\n end",
"def find_child(name, opts = {})\n name_attr = name.include?(\".\") ? \"full_name\" : \"name\"\n\n @children.find do |c|\n (c.should_publish? || !opts[:public_only]) &&\n (c.send(name_attr) == name)\n end\n end",
"def find_child(name_wanted)\n #puts \"Beginning search for child '#{name_wanted}'...\"\n iterate_accessible_children do |child|\n if (child.name == name_wanted)\n #puts \"Found match for name_wanted: '#{child.name}'\"\n #puts child.inspect\n return child\n #else\n # FIXME - release the child object\n end\n end\n raise \"Loop complete, but failed to find child object '#{name_wanted}'!\"\n end",
"def child?\n parent_id = self[nested_set_parent]\n !(parent_id == 0 || parent_id.nil?) && (self[nested_set_left] > 1) && (self[nested_set_right] > self[nested_set_left])\n end",
"def ocare_child_previously_collected_and_equals_one?(question)\n answer_for(question, ocare_child_response_is_one?)\n end",
"def child(name)\n children.select { |child| child.name == name }.first || NonexistentFSObject.new(name, self)\n end",
"def child_by_id(id, scope = {})\n children_by_id(id, scope).first\n end",
"def get_parent(chapno)\n return nil if chapno == [0]\n if chapno.empty?\n # returns the root chapter\n Chapter.root\n else\n chapno = chapno[0 ... chapno.count-1] # cut one element on right\n c = Chapter.find_by(chapter_no: chapno.to_yaml)\n if c\n return c\n else\n get_parent(chapno) \n end\n end\n end",
"def hit \n card = self.cards_deck.pop\n return card\n end",
"def find_current_child\n if adds_deep_link?\n child_id = local_value_for_path(param(:deep_link))\n else\n child_id = param(param_name)\n end\n \n find_child(child_id) || find_child(@current_child_id) || default_child\n end",
"def retrieve_card\n card = @cards.pop\n if card.nil?\n self.reset\n card = @cards.pop\n end\n return card\n end",
"def get_child(node, name)\n a = nil\n node.children.each { |child|\n if child.name == name\n a = child\n break\n end\n }\n return a\nend",
"def search_card(player, id_card)\n player.cards.each do |card|\n return card if id_card.to_s == card.id.to_s\n end\n NIL\n end",
"def second_child\n child 1\n end",
"def get_card()\n @shoe.get_card()\n end",
"def get_card\n @deck.pop\n end",
"def parent\n return @parent unless @parent.nil?\n return Message.find(parent_id) unless parent_id.nil?\n end",
"def value\n @children[0]\n end",
"def string\n children[0]\n end",
"def string\n children[0]\n end",
"def string\n children[0]\n end",
"def find_child(children, child_id)\n raise Error, \"children not true\" unless children\n child_id = child_id.to_s\n children.detect { |x| x.id.to_s == child_id }\n end",
"def getParentRec\n outcomes = Tree.where(\n tree_type_id: self.tree_type_id,\n version_id: self.version_id,\n subject_id: self.subject_id,\n grade_band_id: self.grade_band_id,\n code: self.parentCode\n )\n\n if outcomes.count == 0\n return nil\n else\n return outcomes.first\n end\n end",
"def children_get()\n @children\n end",
"def get_parent\n return nil\n end",
"def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end",
"def get_child(name, options)\n child = hash[name].is_a?(Hash) ? hash[name] : {}\n child_location = location + \"[#{name}]\"\n\n create_composite(options, child, name, child_location)\n end",
"def has_child?(childPath)\n `#@native.hasChild(childPath)`\n end",
"def parent_object\n if has_parent?\n actual_class = parent_class_name.camelize.constantize\n actual_class.find(parent_id)\n else\n nil\n end\n end",
"def children\n objs = @carddav_backend.cards(@address_book_info['id'])\n children = []\n objs.each do |obj|\n obj['acl'] = child_acl\n children << Card.new(@carddav_backend, @address_book_info, obj)\n end\n children\n end",
"def first\n @children[0]\n end",
"def parent\n\t\tself.residue_at_position(@parent_position)\n\tend",
"def peek()\n @q.first\n end",
"def parent\n return nil unless catalog\n\n unless defined?(@parent)\n if parents = catalog.adjacent(self, :direction => :in)\n # We should never have more than one parent, so let's just ignore\n # it if we happen to.\n @parent = parents.shift\n else\n @parent = nil\n end\n end\n @parent\n end",
"def parent_compound\n require 'bio-chembl/compound.rb'\n BioChEMBL::Compound.find(@parent__cmpd__chemblid)\n end",
"def parent?\n !@child_pid.nil?\n end",
"def current_child\n return @current_child if defined?(@current_child) \n if session[:current_child]\n @current_child = (current_user || current_temp_user).children.find_by_id(session[:current_child]);\n else\n @current_child = (current_user || current_temp_user).own_children.first if current_user.own_children.any?\n @current_child = (current_user || current_temp_user).other_children.first if @current_child.nil? && (current_user || current_temp_user).other_children.any?\n set_current_child @current_child.id if @current_child\n end\n @current_child\n end",
"def child_node(html_node)\n # Hack to prevent reading empty text nodes\n child = html_node.child\n is_empty = ( !child.nil? ) && child.text? && child.text.gsub(/[\\r\\n\\s]/, '').empty?\n while is_empty\n child = child.next\n is_empty = ( !child.nil? ) && child.text? && child.text.gsub(/[\\r\\n\\s]/, '').empty?\n end\n child\n end",
"def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end",
"def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end",
"def up_card\n return @cards[0]\n end",
"def parent\n @parent ||= @parent_id ? @book.find_account_by_id(@parent_id) : nil\n end",
"def fetch(key)\n if key.empty?\n return @value\n end\n child = @children[key.shift]\n if child\n child.fetch(key)\n else\n return nil\n end\n end",
"def get_parent_surface()\n get_parents().each do |findcommand|\n [\n \"EXTERIOR-WALL\",\n \"INTERIOR-WALL\",\n \"UNDERGROUND-WALL\",\n \"ROOF\"\n ].each do |type|\n\n if ( findcommand.commandName == type)\n return findcommand\n end\n end\n end\n raise(\"#no parent surface defined!\")\n end",
"def third_child\n child 2\n end",
"def get_room\n return self if parent.tag == :root\n parent.get_room\n end",
"def find_child_by_designation search_designation\n\t\t\t\traise 'deprecated'\n\n\t\t\t\t@logger.debug \"Searching in container [#{level_type}] #{designation} for #{search_designation} (any level type)\"\n\t\t\t\t@children.each { |c|\n\t\t\t\t\t# @logger.debug \"Comparing: #{c.designation} == #{search_designation} ?\"\n\t\t\t\t\t# @logger.debug \"Comparing: #{c.designation.class} == #{search_designation.class} ?\"\n\t\t\t\t\tif c.designation == search_designation\n\t\t\t\t\t\t@logger.debug \"Found: #{c.detail}\"\n\t\t\t\t\t\treturn c\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t@logger.debug \"Not Found.\"\n\t\t\t\treturn nil\n\t\t\tend",
"def get_parent\n\n get_expression_pool.fetch_expression(@parent_id)\n end",
"def child?\n true\n end",
"def find_my_direct_parent\n \t\n \t self.findpapa\n \t directparents = @@directparent.dup\n \t @@directparent.clear\n \t \n \t return directparents\n \t \n end",
"def container_parent\n parent_id = data.at_xpath(\"/c/did/container/@parent\")\n return unless parent_id\n parent = data.at_xpath(\"//c[@id='#{parent_id}']/did/container\")\n \"#{parent.attribute('type').value.capitalize} #{parent.content}\"\n end",
"def direct_child_by_id(id, scope = {})\n direct_children_by_id(id, scope).first\n end",
"def child_id\n\n fei.child_id\n end",
"def child?\n !root?\n end",
"def child?\n !root?\n end"
] |
[
"0.62767905",
"0.62528",
"0.6244299",
"0.59539664",
"0.5777264",
"0.57606936",
"0.5744211",
"0.57117647",
"0.5561242",
"0.55520594",
"0.5542936",
"0.5532454",
"0.54867166",
"0.5435797",
"0.5419696",
"0.5411339",
"0.53962016",
"0.53815913",
"0.53410137",
"0.5336304",
"0.5320952",
"0.5315079",
"0.526959",
"0.526208",
"0.52390814",
"0.52093464",
"0.5204499",
"0.5195949",
"0.5180693",
"0.5166133",
"0.5140177",
"0.51181555",
"0.5115009",
"0.510385",
"0.50909495",
"0.50870574",
"0.5053892",
"0.50411516",
"0.5031641",
"0.50166225",
"0.49823022",
"0.49705875",
"0.4970228",
"0.49666014",
"0.49638766",
"0.49618363",
"0.49355596",
"0.49304286",
"0.49296787",
"0.492074",
"0.4916567",
"0.48836562",
"0.487724",
"0.487045",
"0.4855109",
"0.48534513",
"0.48480424",
"0.48445025",
"0.48439652",
"0.4833726",
"0.4832861",
"0.48288414",
"0.48214507",
"0.4821038",
"0.4821038",
"0.4821038",
"0.48159674",
"0.48144814",
"0.48110038",
"0.47998568",
"0.47821325",
"0.477132",
"0.47691765",
"0.4766395",
"0.47592622",
"0.4758539",
"0.47546902",
"0.4752831",
"0.47521445",
"0.47465622",
"0.47385216",
"0.47373685",
"0.4735529",
"0.47296417",
"0.47296417",
"0.47284922",
"0.4728098",
"0.47276476",
"0.4711217",
"0.47098747",
"0.4704635",
"0.4684907",
"0.4678514",
"0.46779856",
"0.4673308",
"0.46714813",
"0.46666685",
"0.46606985",
"0.46598512",
"0.46598512"
] |
0.54489356
|
13
|
Add an element to the Iq stanza element:: [REXML::Element] Element to add. Will be automatically converted (imported) to a class registered with add_elementclass
|
def typed_add(element)
if element.kind_of?(REXML::Element) && @@element_classes.has_key?(element.name)
super(@@element_classes[element.name]::import(element))
else
super(element)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def <<(element)\n @elements << element\n self\n end",
"def element_add\r\n @env.issue.element_add @meta.element_add ElementAdd.new(@env).insert @is.element_add\r\n end",
"def << elem\n unless @element_type.nil? or elem.is_a?(@element_type)\n raise TypeError.new(\"Cannot add element of type #{elem.class}\")\n end\n self[@hash.call(elem)] = elem\n end",
"def typed_add(element)\n if element.kind_of?(REXML::Element) && (element.name == 'x')\n super(X::import(element))\n else\n super(element)\n end\n end",
"def add_elem(elem)\n # (native code)\n end",
"def add_elem(elem)\n # (native code)\n end",
"def add_elem(elem)\n # (native code)\n end",
"def add_elem(elem)\n # (native code)\n end",
"def add_elem(elem)\n # (native code)\n end",
"def add_elem(elem)\n # (native code)\n end",
"def typed_add(element)\n if element.kind_of?(REXML::Element) && (element.name == 'item')\n item = RosterItem::new.import(element)\n super(item)\n else\n super(element)\n end\n end",
"def add_elem(elem)\n # (native code) \n end",
"def push(element)\r\n # IMPLEMENTME!\r\n end",
"def <<(elem)\r\n self.add elem\r\n end",
"def push_element\n return if @element_name.nil?\n\n # Add the class attribute if the element is a <p> element.\n @attrs[:class] = 'ppp' if :p == @element_name\n\n # Check @void_elements to determine how the element start would be\n # written. HTML includes void elements that are self closing so those\n # should be handled correctly.\n if VOID_ELEMENTS.include?(@element_name)\n @builder.void_element(@element_name, @attrs)\n else\n @builder.element(@element_name, @attrs)\n end\n # Reset the element name.\n @element_name = nil\n @attrs = {}\n end",
"def add(element)\n @element_list << element\n end",
"def typed_add(element)\n if element.kind_of?(REXML::Element) && (element.name == 'item')\n super(XRosterItem::new.import(element))\n else\n super(element)\n end\n end",
"def enqueue(element)\n @items.push(element)\n nil\n end",
"def xml_convert(xml, element)\n xml.doc.root.add_child(element)\n end",
"def start_element(qname, attributes = [])\n clear_characters_buffer\n @doc ||= Nokogiri::XML::Document.new\n @elem ||= @doc # If we have no current element, then, we take the doc\n @elem = @elem.add_child(Nokogiri::XML::Element.new(qname, @doc))\n \n add_namespaces_and_attributes_to_current_node(attributes)\n \n if @elem.name == \"stream:stream\"\n # We activate the callback since this element will never end.\n @callback.call(@elem)\n @doc = @elem = nil # Let's prepare for the next stanza\n # And then, we start a new Sax Push Parser\n end\n end",
"def push(element)\n # IMPLEMENT ME!\n end",
"def <<(element)\n if element.nil?\n pair = [0,NilClass]\n else\n if element.new?\n pair = [element,element.class]\n else\n pair = [element.rod_id,element.class]\n end\n end\n index = @size\n @map[index] = @added.size\n @added << pair\n #@commands << [:append, pair]\n @size += 1\n end",
"def add(element)\n @entries << element\n element.parent = self\n end",
"def add_item(element_class, options = {})\n @items << add_child(@id.next, element_class, options).sym\n end",
"def add(element)\n\t\t@size += 1\n\t\t@data.push(element)\n\t\telement\n\tend",
"def append!(element)\n\t\t\trpc(:append, [@id, element.to_html])\n\t\tend",
"def enqueue(element)\n @in.push(element)\n end",
"def start_element(qname, attributes = [])\n e = Nokogiri::XML::Element.new(qname, @doc)\n add_namespaces_and_attributes_to_node(attributes, e)\n\n # Adding the newly created element to the @elem that is being parsed, or, if no element is being parsed, then we set the @root and the @elem to be this newly created element.\n @elem = @elem ? @elem.add_child(e) : (@root = e)\n \n if @elem.name == \"stream:stream\"\n # Should be called only for stream:stream.\n # We re-initialize the document and set its root to be the doc.\n # Also, we activate the callback since this element will never end.\n @doc = Nokogiri::XML::Document.new\n @doc.root = @root = @elem\n @callback.call(@elem)\n end\n end",
"def append(element)\n insert_at_trailer(element)\n end",
"def append(element)\n updated(@children + [element])\n end",
"def typed_add(element)\n if element.kind_of?(REXML::Element)\n\n if element.name == 'item'\n super(DiscoItem::new.import(element))\n else\n super(element)\n end\n\n else\n super(element)\n end\n end",
"def add_element(element, attrs=nil)\n self << new_element = XML::Node.new(element.to_s, self.document)\n new_element.add_attributes(attrs)\n return new_element\n end",
"def <<(elemento)\n end",
"def add element\n add_last(element)\n end",
"def add element\n add_last(element)\n end",
"def add(element)\n # set element id\n element.id = @next_id\n # push element into elements\n @elements << element\n # save changes\n save_csv\n # increment next_id\n @next_id += 1\n end",
"def push(element); end",
"def _append_element(type, param, noparse=false, str='')\n\t\tif(\n\t\t\t@contents[@content_index += 1] = SifterElement.new(\n\t\t\t\tself, type, param, \n\t\t\t\t((type == 'EMBED' )? param.to_int: @embed_flag ), \n\t\t\t\t((type == 'NOBREAK')? 1 : @nobreak_flag)\n\t\t\t)\n\t\t)\n\t\t\tif(!noparse)\n\t\t\t\tif(!@contents[@content_index]._parse())\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@contents[@content_index]._append_text(str) if(str && str != '')\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\tend",
"def enqueue(element)\n if element.class.name == \"RealQueue\"\n require 'pry'\n binding.pry\n end\n @store.unshift(element)\n self\n end",
"def push(elt)\n @elements << elt\n end",
"def push(element)\n @store.push(element)\n self\n end",
"def __set_element(el, opts = {})\n unless el.is_a?(Nokogiri::XML::Element)\n el = Nokogiri::XML::Element.new(opts[:tag], @__node)\n @__node << el\n if opts[:namespace]\n el.namespace = el.namespace_scopes.find { |n| n.prefix == opts[:namespace] }\n end\n end\n h = __elements_handlers.for_xml_object(el)\n el.instance_variable_set(:@__handler, h)\n __initialize_elements_container(h) << h.from_xml_element(el)\n end",
"def add(elem)\n TstLog(\"Sequence add: #{elem}\")\n @elements.push elem\n @length += elem.length\n self\n end",
"def push(element)\n @data.push(element)\n end",
"def enqueue(el)\n @queue.push(el)\n end",
"def enqueue(el)\n @queue << el\n el\n end",
"def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end",
"def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end",
"def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end",
"def build_up_new_tag(element)\n @current_node.children << TagNode.new(element)\n end",
"def add(el)\n raise NotImplementedError\n end",
"def <<( element )\n case element\n when Otus\n add_otus element\n when Trees\n add_trees element\n when Characters\n add_characters element\n end\n end",
"def add_element(element)\n if nested_child?\n @options.last.last.add_element(element)\n else\n @options.last << element\n end\n end",
"def <<(sym)\n `c$Element.prototype.m$add_class.call(#{@element},sym)`\n return self\n end",
"def <<(tag)\n add(tag)\n end",
"def plus(elem)\n self.class.new(\"#{@name}[#{elem.name}]\", \"#{@id}:#{elem.options[:id] || elem.name}\")\n end",
"def push(new_element)\n @collection.push(new_element)\n end",
"def add(element)\n @push_stack.push(element)\n end",
"def add_as_element(html,id,arr)\n html.elements.each(x_path(id)) do |tag|\n arr.push( tag[0].to_s )\n end\n end",
"def build_iq(query)\n Ox::Element.new(\"iq\").tap do |element|\n element[:xmlns] = \"jabber:client\"\n element[:type] = \"set\"\n element[:id] = Jabber::Generators.id\n\n element << query\n end\n end",
"def element(code)\n @elements << code\n end",
"def push element\n lpush(@key, encode(element))\n end",
"def element(opts={})\n el = Element.new(opts)\n yield(el) if block_given?\n @elements << el\n end",
"def build_iq(query)\n Ox::Element.new(\"iq\").tap do |element|\n element[:xmlns] = \"jabber:client\"\n element[:type] = \"set\"\n element[:id] = Jabber::Generators.id\n\n element << query\n end\n end",
"def createElementNS(nsuri, qname)\n ret = Element.new([nsuri, qname])\n ret.ownerDocument = self\n ret\n end",
"def addStanza stanza\n @stanzaQueue.push(stanza)\n if !@processing\n processStanza\n end\n end",
"def add(tag, klass, position = -1)\n self.instance.add(tag, klass, position)\n end",
"def push(element)\n # add element to the head of @store\n @store.add_first(element)\n end",
"def welo_node\n node = find_first(\"//#{self.class.resource_xml_element}\", self.class.registered_ns)\n node ||= find_first(\"//ns:#{self.class.resource_xml_element}\", :ns => self.class.registered_ns)\n unless node\n (self << (node = Blather::XMPPNode.new(self.class.resource_xml_element, self.document)))\n node.namespace = self.class.registered_ns\n end\n node\n end",
"def element=( element )\n @element = element\n self\n end",
"def js_append_element_to(element, content)\n rjs_method :append_element, :element => element, :content => content\n end",
"def update\n connection.put(element_path, to_xml)\n end",
"def enqueue(el)\n @data.push(el)\n end",
"def add(w)\n adopt(w, getElement())\n @children << w if @children\n end",
"def add_xml(str)\n @xmlstuff << str\n return\n end",
"def push(element)\t\t\n\t\twhile !@q1.empty? do\n\t\t\t@q2.enq(@q1.pop) # Dequeue element from queue q1 and enque the same to q2\n\t\tend\n\t\t@q1.enq(element)\n\t\twhile !@q2.empty? do\n\t\t\t@q1.enq(@q2.pop) # Dequeue element from queue q2 and enque the same to q1\n\t\tend\t\n\tend",
"def enqueue(ele)\n @push_stack.push(ele)\n end",
"def enqueue(el)\n @queue.push(el)\n true\n end",
"def push(element)\n @data = LinkedListNode.new(element, data)\n end",
"def enqueue(el)\n @ivar << el\n end",
"def element\n raise NotImplementedError\n end",
"def push(element)\n @data = LinkedListNode.new(element, @data)\n end",
"def <<(element)\n if element.is_a? Array\n element.each do |e|\n self << e\n end\n return self\n end\n\n element_type_supported = false\n\n ELEMENT_LISTS.each do |list_key, list_def|\n list_type, list_element, list_manifest_key, list_manifest_file_type = *list_def\n if element.class == list_element\n self[list_key] ||= list_type.new([])\n self[list_key] << element\n element_type_supported = true\n end\n end\n\n unless element_type_supported\n raise ValidationError, \"Element provided to #{self.class}#<< has invalid object type (#{element.class})!\"\n end\n\n return self\n end",
"def add(elt)\n if elt.kind_of?(self.class)\n elt.elements.each {|e| unify(e) }\n else\n unify(elt)\n end\n end",
"def initialize(elem)\n @element = elem\n end",
"def push(element)\n @data[@data.length] = element\n end",
"def add(elem)\n raise 'element name conflicts' if @rules[elem.name]\n @elements = nil\n @rules[elem.name] = elem\n elem\n end",
"def add(tag, klass, position = -1)\n @registered_items[tag] ||= []\n arr = self.registered_items[tag]\n position = arr.size if position == -1\n \n arr.insert(position, klass)\n arr.uniq!\n arr.compact!\n end",
"def element(opts={})\n el = Element.new(opts)\n yield(el) if block_given?\n @elements ||= []\n @elements << el\n end",
"def push(element)\n \t@data = LinkedListNode.new(element, @data)\n \tend",
"def add(addto, add)\n start_element = nil\n cur_element = nil\n add.each do |build|\n unless cur_element.nil?\n cur_element = cur_element.add_element(build[0])\n else\n cur_element = REXML::Element.new(build[0])\n start_element = cur_element\n end\n end\n addto.first.add_element(start_element)\n end",
"def push(x)\n @q << x \n end",
"def insert(element)\n if @ary.include? element\n return false\n else\n @ary << element\n return element\n end\n end",
"def prepend!(element)\n\t\t\trpc(:prepend, [@id, element.to_html])\n\t\tend",
"def add_element(parent, key, value)\n elem = Nokogiri::XML::Node.new(key, @xml.document)\n elem.content = value\n\n parent.add_child(elem)\n end",
"def to_element\n self\n end",
"def offer(element, timeout = nil)\n @queue.offer(element, timeout || @timeout, java.util.concurrent.TimeUnit::SECONDS)\n end",
"def push(element)\n @store << element #putting the element into the array, thereby putting it into the stack\n end",
"def element(name, type, options = {})\n element = Element.new(name, type, options)\n attr_accessor element.method_name.intern unless @elements[name]\n @elements[name] = element\n end",
"def add_elements(xml_node)\n return if xml_node.nil?\n _log.info(\"Adding XML elements for [#{id}] from [#{xml_node.root.name}]\")\n updated = false\n\n # Find out what XML file document we are being passed.\n case xml_node.root.name\n when \"miq\"\n for element_class in [OperatingSystem, Account, SystemService, GuestApplication, Patch, Network]\n begin\n element_class.add_elements(self, xml_node)\n updated = true\n rescue Exception => err\n _log.log_backtrace(err)\n end\n end\n when \"scan_profiles\"\n ScanItem.add_elements(self, xml_node)\n updated = true\n when \"vm_configuration\" # TODO: should be \"configuration\"?\n Hardware.add_elements(self, xml_node)\n updated = true\n when \"vmevents\" # TODO: should be \"events\"?\n # Record vm operational and configuration events\n MiqEvent.add_elements(self, xml_node)\n end\n # Update the last sync time if we did something\n self.last_sync_on = Time.at(xml_node.root.attributes[\"created_on\"].to_i).utc if updated == true && xml_node.root.attributes[\"created_on\"]\n save\n hardware.save if self.respond_to?(:hardware) && !hardware.nil?\n end"
] |
[
"0.6366394",
"0.63614696",
"0.62773705",
"0.62410116",
"0.61146027",
"0.61146027",
"0.61146027",
"0.61146027",
"0.61146027",
"0.61146027",
"0.6065162",
"0.5983684",
"0.5965557",
"0.5958431",
"0.5924581",
"0.59024113",
"0.58999926",
"0.589973",
"0.5877168",
"0.5833075",
"0.5791969",
"0.579056",
"0.57635593",
"0.575001",
"0.5722138",
"0.5717614",
"0.5708524",
"0.5679215",
"0.5667995",
"0.5651671",
"0.5647648",
"0.5630493",
"0.5606455",
"0.5597534",
"0.5597534",
"0.5597171",
"0.5587226",
"0.55847585",
"0.55636",
"0.551598",
"0.5485773",
"0.5466028",
"0.54592055",
"0.54433376",
"0.5441217",
"0.54400533",
"0.5423878",
"0.5423878",
"0.541856",
"0.54142857",
"0.5412483",
"0.5402115",
"0.53898776",
"0.5383512",
"0.53742653",
"0.5372805",
"0.5359603",
"0.5354437",
"0.5329188",
"0.5322487",
"0.53045547",
"0.52955794",
"0.52931905",
"0.5290429",
"0.5275802",
"0.5272967",
"0.5254624",
"0.52334875",
"0.52274257",
"0.52111065",
"0.5164556",
"0.5141818",
"0.510652",
"0.51055074",
"0.5100514",
"0.50981826",
"0.5087054",
"0.5082768",
"0.5081792",
"0.50786376",
"0.50738156",
"0.5036543",
"0.50285876",
"0.50271726",
"0.5026867",
"0.5022579",
"0.50204104",
"0.50136566",
"0.49979326",
"0.4997409",
"0.49961224",
"0.49911043",
"0.4977573",
"0.49753538",
"0.49741313",
"0.49644184",
"0.49533284",
"0.49429893",
"0.49429867",
"0.49404076"
] |
0.65134525
|
0
|
Iterates the given block for each RDF statement in the input.
|
def each_statement(&block)
@callback = block
parse(@input, START.to_sym, @options.merge(:branch => BRANCH,
:first => FIRST,
:follow => FOLLOW)
) do |context, *data|
loc = data.shift
case context
when :statement
add_statement(loc, RDF::Statement.from(data))
when :trace
debug(loc, *data)
end
end
rescue RDF::LL1::Parser::Error => e
debug("Parsing completed with errors:\n\t#{e.message}")
raise RDF::ReaderError, e.message if validate?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each_statement(&block)\n if block_given?\n @input.rewind\n sample = @input.read(1000)\n if sample.match(%r(<html)i)\n # If it's HTML, parse it to improve detection\n @input.rewind\n sample = @input = ::Nokogiri::HTML.parse(@input)\n puts \"HTML sample = #{sample.to_html}\" if ::RDF::All::debug?\n else\n @input.rewind\n end\n\n @statement_count = {}\n \n RDF::Reader.each do |reader_class|\n puts \"check #{reader_class.name}\" if ::RDF::All.debug?\n if reader_class.detect(sample)\n puts \"detected #{reader_class.name}\" if ::RDF::All.debug?\n begin\n @input.rewind if @input.respond_to?(:rewind)\n reader_class.new(@input, @options) do |reader|\n reader.each_statement do |statement|\n @statement_count[reader_class] ||= 0\n @statement_count[reader_class] += 1\n block.call(statement)\n end\n @base_uri ||= reader.base_uri unless reader.base_uri.to_s.empty?\n end\n rescue RDF::ReaderError\n # Ignore errors\n end\n puts \"parsed #{@statement_count[reader_class].to_i} triples from #{reader_class.name}\" if ::RDF::All.debug?\n end\n end\n end\n enum_for(:each_statement)\n end",
"def each_statement(&block)\n if block_given?\n unless @processed || @root.nil?\n # Add prefix definitions from host defaults\n @host_defaults[:uri_mappings].each_pair do |prefix, value|\n prefix(prefix, value)\n end\n\n # parse\n parse_whole_document(@doc, RDF::URI(base_uri))\n\n # Look for Embedded RDF/XML\n unless @root.xpath(\"//rdf:RDF\", \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\").empty?\n extract_script(@root, @doc, \"application/rdf+xml\", **@options.merge(base_uri: base_uri)) do |statement|\n @repository << statement\n end\n end\n\n # Look for Embedded microdata\n unless @root.xpath(\"//@itemscope\").empty?\n begin\n require 'rdf/microdata'\n add_debug(@doc, \"process microdata\")\n @repository << RDF::Microdata::Reader.new(@doc, **options)\n rescue LoadError\n add_debug(@doc, \"microdata detected, not processed\")\n end\n end\n\n # Perform property copying\n copy_properties(@repository) if @options[:reference_folding]\n\n # Perform vocabulary expansion\n expand(@repository) if @options[:vocab_expansion]\n\n @processed = true\n end\n\n # Return statements in the default graph for\n # statements in the associated named or default graph from the\n # processed repository\n @repository.each do |statement|\n case statement.graph_name\n when nil\n yield statement if @options[:rdfagraph].include?(:output)\n when RDF::RDFA.ProcessorGraph\n yield RDF::Statement.new(*statement.to_triple) if @options[:rdfagraph].include?(:processor)\n end\n end\n\n if validate? && log_statistics[:error]\n raise RDF::ReaderError, \"Errors found during processing\"\n end\n end\n enum_for(:each_statement)\n end",
"def each_statement(&block)\n @callback = block\n\n parser = N3GrammerParser.new\n document = parser.parse(@doc)\n unless document\n puts parser.inspect if $DEBUG\n reason = parser.failure_reason\n raise RDF::ReaderError, reason\n end\n\n process_statements(document)\n end",
"def each_statement(&block)\n return enum_statement unless block_given?\n\n each_subject do |subject|\n graph.query({subject: subject}, &block)\n end\n end",
"def each(solutions:, &block)\n super do |stmt|\n block.call(RDF::Statement.from(stmt.to_quad))\n end\n end",
"def each_statement(&block)\n # Block called from add_statement\n @callback = block\n\n root = @doc.root\n\n\n rdf_nodes = root.xpath(\"/rdf:RDF\", \"rdf\" => RDF.to_uri.to_s)\n statements = []\n rdf_nodes.each do |node|\n\n\n root.xpath(\"//rss:channel\", \"rss\"=>RDF::RSS.to_s).each do |channel|\n if channel.attribute('about')\n channel_uri = RDF::URI.intern(channel.attribute('about').value)\n else\n channel_uri = RDF::Node.new\n end\n statements << RDF::Statement.new(channel_uri, RDF.type, RDF::RSS.channel)\n channel.children.each do |elem|\n unless elem.name == 'items'\n if elem.children.length == 1 && elem.children.first.is_a?(Nokogiri::XML::Text)\n statements << RDF::Statement.new(channel_uri, RDF::URI.intern(elem.namespace.href + elem.name), literal(elem.children.first))\n elsif elem.attribute('resource')\n statements << RDF::Statement.new(channel_uri, RDF::URI.intern(elem.namespace.href + elem.name), RDF::URI.intern(elem.attribute('resource').value))\n end\n else\n stmt = RDF::Statement.new(:subject=>channel_uri, :predicate=>RDF::URI.intern(elem.namespace.href + elem.name))\n elem.children.each do |list|\n if list.attribute('about')\n list_uri = RDF::URI.intern(list.attribute('about').value)\n else\n list_uri = RDF::Node.new\n end\n\n stmt.object = list_uri\n statements << stmt\n list_type = RDF::URI.intern(list.namespace.href + list.name)\n unless list_type == RDF.Description\n statements << RDF::Statement.new(:subject=>list_uri, :predicate=>RDF.type, :object=>list_type)\n end\n list.children.each do |li|\n stmt = RDF::Statement.new(:subject=>list_uri, :predicate=>RDF::URI.intern(li.namespace.href + li.name))\n if li.attribute('resource')\n stmt.object = RDF::URI.intern(li.attribute('resource').value)\n elsif li.children.length == 1 && li.children.first.is_a?(Nokogiri::XML::Text)\n stmt.object = literal(li.children.first)\n end\n statements << stmt if stmt.object\n end\n end\n end\n end\n end\n root.xpath(\"/rdf:RDF/rss:item\", \"rdf\"=>RDF.to_uri.to_s, \"rss\"=>RDF::RSS.to_s).each do |item|\n if item.attribute('about')\n item_uri = RDF::URI.intern(item.attribute('about').value)\n else\n item_uri = RDF::Node.new\n end\n statements.concat statements_from_element(item, item_uri)\n end\n\n\n end\n statements.each do |stmt |\n yield stmt\n end \n statements.to_enum \n end",
"def each\n if @cypher_block || @cypher_query_hash\n query(@cypher_query_hash, &@cypher_block).each { |i| yield i }\n else\n @decl_rel.each_node(@node) { |n| yield n } # Should use yield here as passing &block through doesn't always work (why?)\n end\n end",
"def each\n if block_given?\n self.class.properties.each do |name, property|\n if value = read_attribute(name)\n if self.class.reflect_on_association(name)\n value.each do |val|\n node = build_rdf_value(val, property[:type])\n yield RDF::Statement.new(subject, property[:predicate], node) if valid_object?(node)\n end\n else\n node = build_rdf_value(value, property[:type])\n yield RDF::Statement.new(subject, property[:predicate], node) if valid_object?(node)\n end\n end\n end\n self.class.types.each do |t|\n yield RDF::Statement.new(subject, RDF.type, t)\n end\n else\n enum_for(:each)\n end\n end",
"def read_statements(graph_element, &block)\n graph_name = read_graph(graph_element)\n graph_name = base_uri.join(graph_name) if\n base_uri && graph_name && graph_name.relative?\n triple_elements(graph_element).each do |triple_element|\n block.call(read_triple(triple_element, graph_name: graph_name))\n end\n end",
"def each(*args, &block)\n return enum_for(:each) unless block_given?\n repository = repository_for_attributes(attributes)\n repository.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n repository.each(*args, &block)\n end",
"def each_pattern(&block)\n n3statements.each do |statement|\n terms = {}\n [:subject, :predicate, :object].each do |part|\n terms[part] = case o = statement.send(part)\n when RDF::N3::Algebra::Formula\n form_statements(o, solution: RDF::Query::Solution.new(), &block)\n else\n o\n end\n end\n\n pattern = RDF::Query::Pattern.from(terms)\n block.call(pattern)\n end\n end",
"def each_triple(&block)\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end",
"def each_triple(&block)\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end",
"def each_quad(&block)\n each_statement do |statement|\n block.call(*statement.to_quad)\n end\n end",
"def each_statement(&block)\n @callback = block\n\n parse(START.to_sym)\n end",
"def each(&block)\n if block\n @block = block\n parser_dispatch\n else\n enum_for(:each)\n end\n end",
"def each(&block)\n if block\n @block = block\n @parser.parse(@handle)\n else\n enum_for(:each)\n end\n end",
"def run(ast)\n ast.each { |node| iterate(node) }\n end",
"def each(*args, &block)\n @stmt.each(*args, &block)\n end",
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n block.call(statement.to_triple)\n end\n end\n enum_for(:each_triple)\n end",
"def each(node, &block); end",
"def each(&block)\n @all.each_batch { |batch| batch.each { |s| yield s } }\n end",
"def each(&block)\n parse.each(&block)\n end",
"def each(&block)\n each_vertex(&block)\n end",
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end\n enum_for(:each_triple)\n end",
"def each(node, &block)\n visit(node, &block)\n end",
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end\n enum_for(:each_triple)\n end",
"def deep_each(&block)\n self.each_sexp do |sexp|\n block[sexp]\n sexp.deep_each(&block)\n end\n end",
"def for_each_in_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n return_value = ForEachInStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal156 = nil\n string_literal157 = nil\n char_literal158 = nil\n string_literal160 = nil\n char_literal162 = nil\n for_in_statement_initialiser_part159 = nil\n expression161 = nil\n block163 = nil\n\n tree_for_string_literal156 = nil\n tree_for_string_literal157 = nil\n tree_for_char_literal158 = nil\n tree_for_string_literal160 = nil\n tree_for_char_literal162 = nil\n stream_RPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RPAREN\" )\n stream_FOR = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token FOR\" )\n stream_IN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token IN\" )\n stream_EACH = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token EACH\" )\n stream_LPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LPAREN\" )\n stream_expression = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule expression\" )\n stream_for_in_statement_initialiser_part = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule for_in_statement_initialiser_part\" )\n stream_block = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule block\" )\n begin\n # at line 483:5: 'for' 'each' '(' for_in_statement_initialiser_part 'in' expression ')' block\n string_literal156 = match( FOR, TOKENS_FOLLOWING_FOR_IN_for_each_in_statement_3240 )\n if @state.backtracking == 0\n stream_FOR.add( string_literal156 )\n end\n string_literal157 = match( EACH, TOKENS_FOLLOWING_EACH_IN_for_each_in_statement_3242 )\n if @state.backtracking == 0\n stream_EACH.add( string_literal157 )\n end\n char_literal158 = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_for_each_in_statement_3244 )\n if @state.backtracking == 0\n stream_LPAREN.add( char_literal158 )\n end\n @state.following.push( TOKENS_FOLLOWING_for_in_statement_initialiser_part_IN_for_each_in_statement_3247 )\n for_in_statement_initialiser_part159 = for_in_statement_initialiser_part\n @state.following.pop\n if @state.backtracking == 0\n stream_for_in_statement_initialiser_part.add( for_in_statement_initialiser_part159.tree )\n end\n string_literal160 = match( IN, TOKENS_FOLLOWING_IN_IN_for_each_in_statement_3250 )\n if @state.backtracking == 0\n stream_IN.add( string_literal160 )\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_for_each_in_statement_3253 )\n expression161 = expression\n @state.following.pop\n if @state.backtracking == 0\n stream_expression.add( expression161.tree )\n end\n char_literal162 = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_for_each_in_statement_3256 )\n if @state.backtracking == 0\n stream_RPAREN.add( char_literal162 )\n end\n @state.following.push( TOKENS_FOLLOWING_block_IN_for_each_in_statement_3259 )\n block163 = block\n @state.following.pop\n if @state.backtracking == 0\n stream_block.add( block163.tree )\n end\n # AST Rewrite\n # elements: block, for_in_statement_initialiser_part, expression, EACH\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 484:5: -> ^( 'each' for_in_statement_initialiser_part expression block )\n # at line 484:8: ^( 'each' for_in_statement_initialiser_part expression block )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_EACH.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_for_in_statement_initialiser_part.next_tree )\n @adaptor.add_child( root_1, stream_expression.next_tree )\n @adaptor.add_child( root_1, stream_block.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 35 )\n\n end\n \n return return_value\n end",
"def each(&block)\n @rules.each(&block)\n end",
"def each_quad(&block)\n if block_given?\n each_statement do |statement|\n block.call(*statement.to_quad)\n end\n end\n enum_for(:each_quad)\n end",
"def each(&block)\n # get the first\n node=getnext([])\n $DEBUG.puts \"each: first node is #{node}\"\n while node\n block.call node\n oldnode=node\n node=getnext(node.oid)\n $DEBUG.puts \"each: next of #{oldnode} is #{node}\"\n end\n end",
"def each(&block)\n ns = NormalizationState.new(**@options)\n log_debug(\"ca:\")\n log_debug(\" log point\", \"Entering the canonicalization function (4.5.3).\")\n log_depth(depth: 2) {normalize_statements(ns, &block)}\n end",
"def block(sexp)\n statements(sexp)\n end",
"def each(&block)\n @relation.each(&block)\n end",
"def each( &block )\n\t\titer = Enumerator.new do |yielder|\n\t\t\tstate = new_state = self.axiom.dup\n\n\t\t\tbegin\n\t\t\t\tyielder.yield( new_state )\n\t\t\t\tstate = new_state\n\t\t\t\tnew_state = self.apply_rules( state )\n\t\t\tend until state == new_state\n\t\tend\n\n\t\treturn iter unless block\n\t\treturn iter.each( &block )\n\tend",
"def each(&block)\n @ledger.each(&block)\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end",
"def each(&block)\n old_raw = @raw\n yield self unless self.nil?\n self.left_sentence.each{|el|block.call el} if self.left_sentence\n while (not old_raw.eql?(@raw)) && (not old_raw.nil?)\n old_raw = @raw\n yield self unless self.nil?\n end\n self.right_sentence.each{|el|block.call el} if (self.right_sentence) && (not @operator.is_negation?)\n while (not old_raw.eql?(self.raw)) && (not old_raw.nil?)\n old_raw = self.raw\n yield self unless self.nil?\n end\n end",
"def each(&block)\n\n all.each { |wi| block.call(wi) }\n end",
"def each(&block)\n return enum_for :each unless block\n\n %x{\n for (var i = 0, length = #@native.rows.length; i < length; i++) {\n #{block.call(self[`i`])};\n }\n }\n\n self\n end",
"def traverse(parent, &block)\n _self = self\n @statement_list.each do|st|\n st.traverse(self, &block)\n end\n yield parent, self\n end",
"def each(&block)\n @queries.each &block\n end",
"def process_blocks(blocks); end",
"def each(&block)\n records.each(&block)\n end",
"def each(&block)\n @records.each(&block)\n end",
"def each_predicate(&block)\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def each\n if block_given?\n vals = []\n @query_schema.inputs.each_with_index do |input, i|\n vals << input.type.convert_from_ruby(@values[i])\n end\n @table.csv.each do |row|\n if @query_schema.inputs.zip(vals).all? {|input, val| row[input.pos] == val} and\n @query_schema.values.all? {|value| row[value.pos] == value.type.convert_from_ruby(value.value)}\n outputs = []\n cond = @query_schema.outputs.each do |output|\n val = row[output.pos]\n if output.options[:empty] == :ignore and val == \"\"\n break :break\n else\n outputs << output.type.convert_to_ruby(val)\n end\n end\n yield *outputs unless cond == :break\n end\n end\n else\n return Enumerator.new(self)\n end\n end",
"def each(&block)\n attributes.each(&block)\n end",
"def each(&block)\n attributes.each(&block)\n end",
"def find_all(&block)\n @asset.representation_utis.each do |uti|\n find_by_uti(uti) do |rep|\n block.call(rep)\n end\n end\n end",
"def each!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 63 )\n\n type = EACH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 184:8: 'each'\n match( \"each\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 63 )\n\n end",
"def each(&block)\n end",
"def each(&block)\n @result_records.each(&block)\n end",
"def each(&block)\n results.each(&block)\n end",
"def each(&block) \n reset\n \n while transaction = next_transaction\n yield transaction\n end\n end",
"def each\n @theLines.each { |s| yield s }\n end",
"def each(&block)\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def each_flow(&blk)\n @flows.each { |name,flow| blk.yield(flow) }\n end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each\n @body.each do |block|\n yield @resource.send(@encoder, @resource.send(@charsetter, block.to_s))\n end\n end",
"def each( & block )\n \n return atomic_cursor.each( & block )\n\n end",
"def each (&block)\n\n return unless block\n\n wis = Workitem.find_by_store_name(@store_name)\n\n wis.each { |wi| block.call(wi) }\n end",
"def each\n\t while !eof()\n\t\tyield nextEntity()\n\t end\n\tend",
"def for_loop\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = ForLoopReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal77 = nil\n string_literal83 = nil\n __ID85__ = nil\n __FOR_IN88__ = nil\n __ID90__ = nil\n variable_statement78 = nil\n expression79 = nil\n expression80 = nil\n expression81 = nil\n block82 = nil\n variable_statement84 = nil\n expression86 = nil\n block87 = nil\n variable_statement89 = nil\n expression91 = nil\n block92 = nil\n\n tree_for_string_literal77 = nil\n tree_for_string_literal83 = nil\n tree_for_ID85 = nil\n tree_for_FOR_IN88 = nil\n tree_for_ID90 = nil\n\n begin\n # at line 116:3: ( ^( 'for' ( variable_statement | expression ) expression expression block ) | ^( 'each' ( variable_statement | ID ) expression block ) | ^( FOR_IN ( variable_statement | ID ) expression block ) )\n alt_24 = 3\n case look_24 = @input.peek( 1 )\n when FOR then alt_24 = 1\n when EACH then alt_24 = 2\n when FOR_IN then alt_24 = 3\n else\n raise NoViableAlternative( \"\", 24, 0 )\n end\n case alt_24\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 116:5: ^( 'for' ( variable_statement | expression ) expression expression block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal77 = match( FOR, TOKENS_FOLLOWING_FOR_IN_for_loop_603 )\n\n tree_for_string_literal77 = @adaptor.copy_node( string_literal77 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal77, root_1 )\n\n\n\n match( DOWN, nil )\n # at line 116:15: ( variable_statement | expression )\n alt_21 = 2\n look_21_0 = @input.peek( 1 )\n\n if ( look_21_0 == VAR )\n alt_21 = 1\n elsif ( look_21_0.between?( AMP, AMP_ASGN ) || look_21_0 == POST_DECR || look_21_0.between?( GEQ, AREF ) || look_21_0.between?( GREATER, HAT ) || look_21_0.between?( ARROW, HAT_ASGN ) || look_21_0 == ASGN || look_21_0 == REGEX || look_21_0 == IN || look_21_0 == INCR || look_21_0.between?( INSTANCEOF, RSHIFT3 ) || look_21_0 == RSHIFT3_ASGN || look_21_0 == RSHIFT_ASGN || look_21_0 == LEQ || look_21_0.between?( LESS, SLASH ) || look_21_0 == SLASH_ASGN || look_21_0.between?( STAR, DECR ) || look_21_0 == STAR_ASGN || look_21_0 == LSHIFT || look_21_0.between?( DELETE, THIS ) || look_21_0.between?( MINUS, TILDE ) || look_21_0.between?( MINUS_ASGN, MOD ) || look_21_0.between?( MOD_ASGN, TYPEOF ) || look_21_0.between?( NEQ, UMINUS ) || look_21_0.between?( NEQQ, UNDEFINED ) || look_21_0 == NEW || look_21_0 == NOT || look_21_0.between?( NULL, UPLUS ) || look_21_0 == OBJECT || look_21_0.between?( EQ, OR_ASGN ) || look_21_0 == FALSE || look_21_0 == PIPE || look_21_0 == PIPE_ASGN || look_21_0 == PLUS || look_21_0.between?( ID, DOC ) )\n alt_21 = 2\n else\n raise NoViableAlternative( \"\", 21, 0 )\n end\n case alt_21\n when 1\n # at line 116:17: variable_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_variable_statement_IN_for_loop_608 )\n variable_statement78 = variable_statement\n @state.following.pop\n\n @adaptor.add_child( root_1, variable_statement78.tree )\n\n\n when 2\n # at line 116:38: expression\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_for_loop_612 )\n expression79 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression79.tree )\n\n\n end\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_for_loop_616 )\n expression80 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression80.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_for_loop_618 )\n expression81 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression81.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_for_loop_620 )\n block82 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block82.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 117:5: ^( 'each' ( variable_statement | ID ) expression block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal83 = match( EACH, TOKENS_FOLLOWING_EACH_IN_for_loop_630 )\n\n tree_for_string_literal83 = @adaptor.copy_node( string_literal83 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal83, root_1 )\n\n\n\n match( DOWN, nil )\n # at line 117:15: ( variable_statement | ID )\n alt_22 = 2\n look_22_0 = @input.peek( 1 )\n\n if ( look_22_0 == VAR )\n alt_22 = 1\n elsif ( look_22_0 == ID )\n alt_22 = 2\n else\n raise NoViableAlternative( \"\", 22, 0 )\n end\n case alt_22\n when 1\n # at line 117:17: variable_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_variable_statement_IN_for_loop_634 )\n variable_statement84 = variable_statement\n @state.following.pop\n\n @adaptor.add_child( root_1, variable_statement84.tree )\n\n\n when 2\n # at line 117:38: ID\n _last = @input.look\n __ID85__ = match( ID, TOKENS_FOLLOWING_ID_IN_for_loop_638 )\n\n tree_for_ID85 = @adaptor.copy_node( __ID85__ )\n\n @adaptor.add_child( root_1, tree_for_ID85 )\n\n\n\n end\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_for_loop_642 )\n expression86 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression86.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_for_loop_644 )\n block87 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block87.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 118:5: ^( FOR_IN ( variable_statement | ID ) expression block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __FOR_IN88__ = match( FOR_IN, TOKENS_FOLLOWING_FOR_IN_IN_for_loop_654 )\n\n tree_for_FOR_IN88 = @adaptor.copy_node( __FOR_IN88__ )\n\n root_1 = @adaptor.become_root( tree_for_FOR_IN88, root_1 )\n\n\n\n match( DOWN, nil )\n # at line 118:15: ( variable_statement | ID )\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == VAR )\n alt_23 = 1\n elsif ( look_23_0 == ID )\n alt_23 = 2\n else\n raise NoViableAlternative( \"\", 23, 0 )\n end\n case alt_23\n when 1\n # at line 118:17: variable_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_variable_statement_IN_for_loop_658 )\n variable_statement89 = variable_statement\n @state.following.pop\n\n @adaptor.add_child( root_1, variable_statement89.tree )\n\n\n when 2\n # at line 118:38: ID\n _last = @input.look\n __ID90__ = match( ID, TOKENS_FOLLOWING_ID_IN_for_loop_662 )\n\n tree_for_ID90 = @adaptor.copy_node( __ID90__ )\n\n @adaptor.add_child( root_1, tree_for_ID90 )\n\n\n\n end\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_for_loop_666 )\n expression91 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression91.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_for_loop_668 )\n block92 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block92.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n \n return return_value\n end",
"def each(&block)\n txactions.each(&block)\n end",
"def each(&block) \n current = @head\n \n while current\n block.call(current.value)\n current = current.successor\n end\n end",
"def each(&block)\n @all.each(&block)\n end",
"def each(*args, &block)\n @body.each(*args, &block)\n ensure\n unless @closed\n @closed = true\n @block.call\n end\n end",
"def each\n @rules.each { |h,ds| ds.each { |d| yield [h, d] } }\n end",
"def each_predicate(&block) # :nodoc:\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def each(&block)\n @entries.each(&block)\n end",
"def each (&block)\n\n @items.each { |i| block.call(i) }\n end",
"def each_node(&block)\n nodes.each(&block)\n end",
"def each_node(&block)\n nodes.each_value(&block)\n end",
"def each(&block)\n tree.each(&block)\n end",
"def each &block\n end",
"def each(&block)\n entries.each(&block)\n end",
"def each(&block)\n entries.each(&block)\n end",
"def each_node(&block)\n nodes.each_node &block\n end",
"def each_node(&block)\n nodes.each_node &block\n end",
"def each_node(&block)\n\t\t\tnodes.each(&block)\n\t\tend",
"def each &block\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def each &block\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def map_statements!(&ruby_block)\n @statements.map! do |stmnt|\n stmnt = ruby_block.call(stmnt)\n stmnt.parent = self unless stmnt.parent\n stmnt\n end\n end",
"def each(&block)\n Placeholder.each(node_data, &block)\n end",
"def each(&block)\n rows.each(&block)\n end",
"def each(&block)\n shell.say_line(\"Reading VDR XML #{filename if filename}\")\n @start = Time.now\n\n Nokogiri::XML::Reader(@io).each do |node|\n element_types = [:TYPE_ELEMENT, :TYPE_END_ELEMENT].\n collect { |c| Nokogiri::XML::Reader.const_get(c) }\n next unless element_types.include?(node.node_type)\n encounter_node(node, node.node_type == 1, &block)\n end\n\n @end = Time.now\n\n shell.clear_line_then_say(\n \"Completed read of %6d records in %d seconds (%3.1f per second)\\n\" %\n [@record_count, load_time, load_rate])\n ensure\n @io.close if filename\n end",
"def _each(&block)\n _next.each(&block) if _next\n end",
"def each_token(&block)\n each_input_line do |line|\n each_token_in_line line, &block\n end\n\n alter_stack [], &block\n end",
"def each_input_line(&block)\n @input.each_line {|l| block.call l.chomp }\n end",
"def each\n @rules.each {|rule, obj| yield obj }\n end",
"def each &block\n @tokens.each &block\n end",
"def eachNode(&block)\n @nodeSets.each { |s|\n s.eachNode &block\n }\n end",
"def each(&block)\n attributes.each_value(&block)\n end"
] |
[
"0.78742886",
"0.7744474",
"0.7542271",
"0.7003516",
"0.6743582",
"0.67221117",
"0.65967774",
"0.6593459",
"0.6517501",
"0.6395181",
"0.63136494",
"0.63123786",
"0.63123786",
"0.624668",
"0.6219534",
"0.61793005",
"0.6175033",
"0.615955",
"0.6156915",
"0.6089419",
"0.60851973",
"0.6070304",
"0.6033333",
"0.6033161",
"0.60112274",
"0.6010561",
"0.60050535",
"0.5952694",
"0.59407747",
"0.59269583",
"0.5870091",
"0.58320576",
"0.58166814",
"0.57754004",
"0.5770868",
"0.57481515",
"0.57406205",
"0.57404566",
"0.57124144",
"0.57023704",
"0.5691075",
"0.5656998",
"0.56270295",
"0.5623871",
"0.5622418",
"0.5604993",
"0.5601237",
"0.5571298",
"0.5568752",
"0.5568752",
"0.55676085",
"0.55583125",
"0.5554673",
"0.55507094",
"0.5549326",
"0.55479586",
"0.5542678",
"0.5541841",
"0.55362004",
"0.5526757",
"0.5526757",
"0.5526757",
"0.5526757",
"0.5526757",
"0.5526757",
"0.5522536",
"0.55214953",
"0.5521286",
"0.55086094",
"0.5507935",
"0.5495274",
"0.5491462",
"0.5490536",
"0.5482115",
"0.5479294",
"0.54711866",
"0.5471018",
"0.5467285",
"0.546514",
"0.5456127",
"0.54515207",
"0.5448186",
"0.54393464",
"0.54393464",
"0.54376394",
"0.54376394",
"0.5433935",
"0.54326105",
"0.54326105",
"0.54310066",
"0.5426804",
"0.54227036",
"0.5418226",
"0.54082066",
"0.5405776",
"0.54027915",
"0.53951305",
"0.53931785",
"0.53913695",
"0.53827673"
] |
0.7401051
|
3
|
Iterates the given block for each RDF quad in the input.
|
def each_quad(&block)
each_statement do |statement|
block.call(*statement.to_quad)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each_quad(&block)\n if block_given?\n each_statement do |statement|\n block.call(*statement.to_quad)\n end\n end\n enum_for(:each_quad)\n end",
"def each(solutions:, &block)\n super do |stmt|\n block.call(RDF::Statement.from(stmt.to_quad))\n end\n end",
"def each(&block)\n each_vertex(&block)\n end",
"def each_statement(&block)\n if block_given?\n @input.rewind\n sample = @input.read(1000)\n if sample.match(%r(<html)i)\n # If it's HTML, parse it to improve detection\n @input.rewind\n sample = @input = ::Nokogiri::HTML.parse(@input)\n puts \"HTML sample = #{sample.to_html}\" if ::RDF::All::debug?\n else\n @input.rewind\n end\n\n @statement_count = {}\n \n RDF::Reader.each do |reader_class|\n puts \"check #{reader_class.name}\" if ::RDF::All.debug?\n if reader_class.detect(sample)\n puts \"detected #{reader_class.name}\" if ::RDF::All.debug?\n begin\n @input.rewind if @input.respond_to?(:rewind)\n reader_class.new(@input, @options) do |reader|\n reader.each_statement do |statement|\n @statement_count[reader_class] ||= 0\n @statement_count[reader_class] += 1\n block.call(statement)\n end\n @base_uri ||= reader.base_uri unless reader.base_uri.to_s.empty?\n end\n rescue RDF::ReaderError\n # Ignore errors\n end\n puts \"parsed #{@statement_count[reader_class].to_i} triples from #{reader_class.name}\" if ::RDF::All.debug?\n end\n end\n end\n enum_for(:each_statement)\n end",
"def each_statement(&block)\n if block_given?\n unless @processed || @root.nil?\n # Add prefix definitions from host defaults\n @host_defaults[:uri_mappings].each_pair do |prefix, value|\n prefix(prefix, value)\n end\n\n # parse\n parse_whole_document(@doc, RDF::URI(base_uri))\n\n # Look for Embedded RDF/XML\n unless @root.xpath(\"//rdf:RDF\", \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\").empty?\n extract_script(@root, @doc, \"application/rdf+xml\", **@options.merge(base_uri: base_uri)) do |statement|\n @repository << statement\n end\n end\n\n # Look for Embedded microdata\n unless @root.xpath(\"//@itemscope\").empty?\n begin\n require 'rdf/microdata'\n add_debug(@doc, \"process microdata\")\n @repository << RDF::Microdata::Reader.new(@doc, **options)\n rescue LoadError\n add_debug(@doc, \"microdata detected, not processed\")\n end\n end\n\n # Perform property copying\n copy_properties(@repository) if @options[:reference_folding]\n\n # Perform vocabulary expansion\n expand(@repository) if @options[:vocab_expansion]\n\n @processed = true\n end\n\n # Return statements in the default graph for\n # statements in the associated named or default graph from the\n # processed repository\n @repository.each do |statement|\n case statement.graph_name\n when nil\n yield statement if @options[:rdfagraph].include?(:output)\n when RDF::RDFA.ProcessorGraph\n yield RDF::Statement.new(*statement.to_triple) if @options[:rdfagraph].include?(:processor)\n end\n end\n\n if validate? && log_statistics[:error]\n raise RDF::ReaderError, \"Errors found during processing\"\n end\n end\n enum_for(:each_statement)\n end",
"def each\n if @cypher_block || @cypher_query_hash\n query(@cypher_query_hash, &@cypher_block).each { |i| yield i }\n else\n @decl_rel.each_node(@node) { |n| yield n } # Should use yield here as passing &block through doesn't always work (why?)\n end\n end",
"def each(node, &block); end",
"def each\r\n # Cache to ensure unprocessed quad's native faces doesn't return twice.\r\n skip = {}\r\n for entity in all\r\n if entity.is_a?( Sketchup::Face )\r\n next if skip[ entity ]\r\n if quad = @faces_to_quads[ entity ]\r\n # Existing Quad\r\n for face in quad.faces\r\n skip[ face ] = face\r\n end\r\n yield( quad )\r\n elsif QuadFace.is?( entity )\r\n # Unprocessed Quad\r\n quad = QuadFace.new( entity )\r\n cache_entity( quad )\r\n for face in quad.faces\r\n skip[ face ] = face\r\n end\r\n yield( quad )\r\n else\r\n # Native Face\r\n cache_entity( entity )\r\n yield( entity )\r\n end\r\n else\r\n # All other entities\r\n cache_entity( entity )\r\n yield( entity )\r\n end\r\n end\r\n end",
"def each(&block)\n # get the first\n node=getnext([])\n $DEBUG.puts \"each: first node is #{node}\"\n while node\n block.call node\n oldnode=node\n node=getnext(node.oid)\n $DEBUG.puts \"each: next of #{oldnode} is #{node}\"\n end\n end",
"def each_triple(&block)\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end",
"def each_triple(&block)\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end",
"def each(&block)\n @relation.each(&block)\n end",
"def each(&block)\n return @parts.each(&block)\n end",
"def each_statement(&block)\n @callback = block\n\n parser = N3GrammerParser.new\n document = parser.parse(@doc)\n unless document\n puts parser.inspect if $DEBUG\n reason = parser.failure_reason\n raise RDF::ReaderError, reason\n end\n\n process_statements(document)\n end",
"def each(&block)\n @atlas.each(&block)\n end",
"def each(&block)\n @all.each_batch { |batch| batch.each { |s| yield s } }\n end",
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n block.call(statement.to_triple)\n end\n end\n enum_for(:each_triple)\n end",
"def each &block\n @parts.each(&block)\n end",
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end\n enum_for(:each_triple)\n end",
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n block.call(*statement.to_triple)\n end\n end\n enum_for(:each_triple)\n end",
"def each(&block)\n @queries.each &block\n end",
"def each_vertex; @vertices.each {|v| yield v} end",
"def each(node, &block)\n visit(node, &block)\n end",
"def each(filter = {}, &block)\n vertices(filter).each(&block)\n end",
"def each\n\t\t\t@joints.each { |x| yield x }\n\t\tend",
"def each\n self.num_geometries.times do |n|\n yield self.get_geometry_n(n)\n end\n nil\n end",
"def each\n self.num_geometries.times do |n|\n yield self.get_geometry_n(n)\n end\n nil\n end",
"def each_statement(&block)\n return enum_statement unless block_given?\n\n each_subject do |subject|\n graph.query({subject: subject}, &block)\n end\n end",
"def each(&block)\n\n all.each { |wi| block.call(wi) }\n end",
"def each(&block)\n results.each(&block)\n end",
"def find_all(&block)\n @asset.representation_utis.each do |uti|\n find_by_uti(uti) do |rep|\n block.call(rep)\n end\n end\n end",
"def each_statement(&block)\n # Block called from add_statement\n @callback = block\n\n root = @doc.root\n\n\n rdf_nodes = root.xpath(\"/rdf:RDF\", \"rdf\" => RDF.to_uri.to_s)\n statements = []\n rdf_nodes.each do |node|\n\n\n root.xpath(\"//rss:channel\", \"rss\"=>RDF::RSS.to_s).each do |channel|\n if channel.attribute('about')\n channel_uri = RDF::URI.intern(channel.attribute('about').value)\n else\n channel_uri = RDF::Node.new\n end\n statements << RDF::Statement.new(channel_uri, RDF.type, RDF::RSS.channel)\n channel.children.each do |elem|\n unless elem.name == 'items'\n if elem.children.length == 1 && elem.children.first.is_a?(Nokogiri::XML::Text)\n statements << RDF::Statement.new(channel_uri, RDF::URI.intern(elem.namespace.href + elem.name), literal(elem.children.first))\n elsif elem.attribute('resource')\n statements << RDF::Statement.new(channel_uri, RDF::URI.intern(elem.namespace.href + elem.name), RDF::URI.intern(elem.attribute('resource').value))\n end\n else\n stmt = RDF::Statement.new(:subject=>channel_uri, :predicate=>RDF::URI.intern(elem.namespace.href + elem.name))\n elem.children.each do |list|\n if list.attribute('about')\n list_uri = RDF::URI.intern(list.attribute('about').value)\n else\n list_uri = RDF::Node.new\n end\n\n stmt.object = list_uri\n statements << stmt\n list_type = RDF::URI.intern(list.namespace.href + list.name)\n unless list_type == RDF.Description\n statements << RDF::Statement.new(:subject=>list_uri, :predicate=>RDF.type, :object=>list_type)\n end\n list.children.each do |li|\n stmt = RDF::Statement.new(:subject=>list_uri, :predicate=>RDF::URI.intern(li.namespace.href + li.name))\n if li.attribute('resource')\n stmt.object = RDF::URI.intern(li.attribute('resource').value)\n elsif li.children.length == 1 && li.children.first.is_a?(Nokogiri::XML::Text)\n stmt.object = literal(li.children.first)\n end\n statements << stmt if stmt.object\n end\n end\n end\n end\n end\n root.xpath(\"/rdf:RDF/rss:item\", \"rdf\"=>RDF.to_uri.to_s, \"rss\"=>RDF::RSS.to_s).each do |item|\n if item.attribute('about')\n item_uri = RDF::URI.intern(item.attribute('about').value)\n else\n item_uri = RDF::Node.new\n end\n statements.concat statements_from_element(item, item_uri)\n end\n\n\n end\n statements.each do |stmt |\n yield stmt\n end \n statements.to_enum \n end",
"def each(&block)\n axis_iterator(:child).each(&block)\n end",
"def each(&block)\n raise Error::UnsupportedOperation, \"Method GeometryCollection#each not defined.\"\n end",
"def each(&block)\n (@first .. @last).each(&block)\n end",
"def each_edge(&block)\n\t\t\tedges.each(&block)\n\t\tend",
"def process_blocks(blocks); end",
"def each()\n yield izq\n yield der\n end",
"def each_pattern(&block)\n n3statements.each do |statement|\n terms = {}\n [:subject, :predicate, :object].each do |part|\n terms[part] = case o = statement.send(part)\n when RDF::N3::Algebra::Formula\n form_statements(o, solution: RDF::Query::Solution.new(), &block)\n else\n o\n end\n end\n\n pattern = RDF::Query::Pattern.from(terms)\n block.call(pattern)\n end\n end",
"def each(&block)\n @pz.each do |row|\n row.each do |cell|\n yield cell\n end\n end\n end",
"def each(&block)\n parse.each(&block)\n end",
"def each(&block)\n @ledger.each(&block)\n end",
"def each_record(&block)\n return to_enum(:each_record) unless block_given?\n\n @relation.to_enum(:in_batches, of: @of, start: @start, finish: @finish, load: true, order: @order).each do |relation|\n relation.records.each(&block)\n end\n end",
"def each(&block)\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def each(&block)\n enum = @relation.to_enum(:in_batches, of: @of, start: @start, finish: @finish, load: false, order: @order, use_ranges: @use_ranges)\n return enum.each(&block) if block_given?\n enum\n end",
"def each(&block)\n radios.each(&block)\n end",
"def each_graph(&block)\n if block_given?\n yield self\n end\n enum_graph\n end",
"def each\n if block_given?\n self.num_geometries.times do |n|\n yield self.get_geometry_n(n)\n end\n self\n else\n self.num_geometries.times.collect { |n|\n self.get_geometry_n(n)\n }.to_enum\n end\n end",
"def read_statements(graph_element, &block)\n graph_name = read_graph(graph_element)\n graph_name = base_uri.join(graph_name) if\n base_uri && graph_name && graph_name.relative?\n triple_elements(graph_element).each do |triple_element|\n block.call(read_triple(triple_element, graph_name: graph_name))\n end\n end",
"def each_node(&block)\n nodes.each_value(&block)\n end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each_node(&block)\n\t\t\tnodes.each(&block)\n\t\tend",
"def each_node(&block)\n nodes.each(&block)\n end",
"def iterate(itr)\n @left.iterate(itr)\n @right.iterate(itr)\n end",
"def each\n\n\t\t@a.each do |x|\n\t\t\tyield x\n\t\tend\n\tend",
"def each_node(&block)\n nodes.each_node &block\n end",
"def each_node(&block)\n nodes.each_node &block\n end",
"def each\n if block_given?\n self.class.properties.each do |name, property|\n if value = read_attribute(name)\n if self.class.reflect_on_association(name)\n value.each do |val|\n node = build_rdf_value(val, property[:type])\n yield RDF::Statement.new(subject, property[:predicate], node) if valid_object?(node)\n end\n else\n node = build_rdf_value(value, property[:type])\n yield RDF::Statement.new(subject, property[:predicate], node) if valid_object?(node)\n end\n end\n end\n self.class.types.each do |t|\n yield RDF::Statement.new(subject, RDF.type, t)\n end\n else\n enum_for(:each)\n end\n end",
"def run(ast)\n ast.each { |node| iterate(node) }\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end",
"def each(&block)\n end",
"def each_statement(&block)\n @callback = block\n\n parse(@input, START.to_sym, @options.merge(:branch => BRANCH,\n :first => FIRST,\n :follow => FOLLOW)\n ) do |context, *data|\n loc = data.shift\n case context\n when :statement\n add_statement(loc, RDF::Statement.from(data))\n when :trace\n debug(loc, *data)\n end\n end\n rescue RDF::LL1::Parser::Error => e\n debug(\"Parsing completed with errors:\\n\\t#{e.message}\")\n raise RDF::ReaderError, e.message if validate?\n end",
"def each\n @inputs.each do |inny|\n inny.each do |i|\n yield i\n end\n end\n end",
"def each &block\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def each &block\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def each(&block)\n if block\n @block = block\n parser_dispatch\n else\n enum_for(:each)\n end\n end",
"def each(&block) \n current = @head\n \n while current\n block.call(current.value)\n current = current.successor\n end\n end",
"def each(&blk)\n @tuples.each(&blk)\n end",
"def each(&block)\n @extent.each(&block)\n end",
"def each(&block)\n @all.each(&block)\n end",
"def each(&block)\n Placeholder.each(node_data, &block)\n end",
"def each_mid(&block)\n \n end",
"def each(&block)\n @results.each &block\n end",
"def each(&block)\n block.call(self)\n @child_array.each do |node|\n node.each(&block)\n end\n end",
"def each\n while (part = readpartial)\n yield part\n end\n end",
"def each(&block)\n all.each(&block)\n end",
"def each(&block)\n @lock.synchronize do\n @links.each(&block)\n end\n end",
"def each(&block)\n @results.each(&block)\n end",
"def each(&blk)\n coordinates.each { |coordinate| yield coordinate }\n end",
"def each(&block)\n records.each(&block)\n end",
"def each\n return vertices.values.each unless block_given?\n vertices.values.each { |v| yield v }\n end",
"def query_block(rel, &block)\n rel = yield(rel) if block_given?\n rel.all\n end",
"def each_row_streaming(&block)\n Roo::Utils.each_element(@path, 'row', &block)\n end",
"def each(&block)\n process_results unless @processed\n @results.each(&block)\n end",
"def each (&block)\n\n @items.each { |i| block.call(i) }\n end",
"def each(part=nil,group=nil)\n if subproducts.nil? || subproducts.empty?\n INCOME_RANGE.each do |i|\n row = row_with_metadata(part, group, i)\n binding.pry if @data[i].nil?\n row << amount(@data[i])\n row << INCOME\n yield row\n end\n\n SPENDING_RANGE.each do |i|\n row = row_with_metadata(part, group, i)\n binding.pry if @data[i].nil?\n row << amount(@data[i])\n row << SPENDING\n yield row\n end\n else\n subproducts.each do |subproduct|\n if part.nil?\n subproduct.each(self) { |line| yield line }\n else\n subproduct.each(part, self) { |line| yield line }\n end\n end\n end\n end",
"def each(&block)\n root.each(&block)\n end",
"def each(&block)\n @batch_queue.each(&block)\n end",
"def each(*args,&blk)\n\t\t@rounds.each(*args,&blk) \n\tend",
"def each(&block)\r\n @range.each(&block)\r\n end",
"def each(&block)\n @result_records.each(&block)\n end",
"def each_raw\n iterator.each { |i| yield i }\n end",
"def each\n @flux.each do |ligne|\n yield(ligne)\n end\n end",
"def each_node(&block)\n @nodes.each &block\n end",
"def each_node(&block)\n @nodes.each &block\n end"
] |
[
"0.7068529",
"0.66853106",
"0.6563826",
"0.637273",
"0.63396627",
"0.61988866",
"0.61057884",
"0.6056404",
"0.60215825",
"0.6017053",
"0.6017053",
"0.6000423",
"0.5961103",
"0.59479266",
"0.594221",
"0.59064204",
"0.5891409",
"0.5873933",
"0.5841416",
"0.5818396",
"0.58069956",
"0.5803248",
"0.57951117",
"0.5771567",
"0.5712901",
"0.5695683",
"0.5695683",
"0.56685954",
"0.56683",
"0.56562597",
"0.56312156",
"0.5629277",
"0.56134486",
"0.5607619",
"0.5605934",
"0.55997336",
"0.55853873",
"0.5582285",
"0.55660886",
"0.5563067",
"0.55355406",
"0.55302113",
"0.5525681",
"0.55218434",
"0.5515636",
"0.55139744",
"0.55128884",
"0.54990923",
"0.54966664",
"0.5490036",
"0.548855",
"0.548855",
"0.548855",
"0.548855",
"0.548855",
"0.548855",
"0.5484519",
"0.54825276",
"0.5480143",
"0.5473357",
"0.5472856",
"0.5472856",
"0.54703385",
"0.5467782",
"0.54552543",
"0.5454618",
"0.5451814",
"0.5444885",
"0.5439633",
"0.5439633",
"0.5434888",
"0.54228735",
"0.54083115",
"0.5405173",
"0.5404301",
"0.5402452",
"0.54015064",
"0.54010683",
"0.5394507",
"0.53926986",
"0.5375336",
"0.5365256",
"0.5359167",
"0.53591466",
"0.5356373",
"0.53560233",
"0.5355891",
"0.53555626",
"0.5347728",
"0.53472453",
"0.5346587",
"0.5345582",
"0.5341524",
"0.5339049",
"0.5338902",
"0.53335494",
"0.533283",
"0.53327584",
"0.53308123",
"0.53308123"
] |
0.7171513
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_comments
@picture = Picture.find(params[:picture_id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def comment_params
params.require(:comment).permit(:name, :comment, :user_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Set all the level names at once and saves the object. ===Params: levels:: An array containing every level name. A rubric criterion contains RUBRIC_LEVELS levels. If the array is smaller, only the first levels are set. If the array is bigger, higher indexes are ignored. ===Returns: Whether the save operation was successful or not.
|
def set_level_names(levels)
levels.each_with_index do |level, index|
self['level_' + index.to_s + '_name'] = level
end
save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def levels=(levels)\n @levels = levels\n clear_levels_cache!\n end",
"def input_dosing_levels(levels)\n my_levels = levels.split(',')\n for i in 0..my_levels.size()-1\n add_level.click if i > 1\n dosing_factor_levels[i].set my_levels[i]\n end\n end",
"def levels(levels)\n # need to keep nils, so don't remove them\n\n # flatten nested arrays\n levels = [levels].flatten\n\n # make array of levels unique and validate each\n # return the array of validated levels\n levels.uniq.map { |i| Access::Validate.level(i) }\n end",
"def levels\n @levels ||= {}\n end",
"def validate_levels(levels)\n raise ArgumentError, 'Access level array must not be blank.' if levels.blank?\n\n levels = [levels] unless levels.respond_to?(:map)\n\n levels_sym = levels.map { |i| validate_level(i) }.uniq\n validate_level_combination(levels_sym)\n levels_sym\n end",
"def level=(value)\n @level = value\n end",
"def level=(value)\n @level = value\n end",
"def level=(new_lvl)\n @level = new_lvl\n $game_party.quests.add_to_sort_array(:level, @id) if $game_party && \n $game_party.quests\n end",
"def level=(level)\n @level_index = self.class.map_level_to_index(level)\n @level = level\n end",
"def update_level\n tags = []\n user_level = 0\n tags = labels.with_private_scope\n .map { |l| [l.key, l.value].join ':' }\n\n levels = Level.all.order(id: :asc)\n levels.each do |lvl|\n break unless tags.include?(lvl.key + ':' + lvl.value)\n\n user_level = lvl.id\n end\n\n update(level: user_level)\n end",
"def update_level\n user_level = 0\n tags = labels.with_private_scope\n .map { |l| [l.key, l.value].join ':' }\n\n levels = Level.all.order(id: :asc)\n levels.each do |lvl|\n break unless tags.include?(lvl.key + ':' + lvl.value)\n\n user_level = lvl.id\n end\n\n update(level: user_level)\n end",
"def level=(level)\n # Check up and down limits\n level = [[level, $data_actors[@actor_id].final_level].min, 1].max\n # Change EXP\n self.exp = @exp_list[level]\n end",
"def update\n if level_params[:name] &&\n @level.name != level_params[:name] &&\n @level.name.downcase == level_params[:name].downcase\n # do not allow case-only changes in the level name because that confuses git on OSX\n @level.errors.add(:name, 'Cannot change only the capitalization of the level name (it confuses git on OSX)')\n render json: @level.errors, status: :unprocessable_entity\n return\n end\n if @level.update(level_params)\n render json: { redirect: level_url(@level, show_callouts: true) }\n else\n render json: @level.errors, status: :unprocessable_entity\n end\n end",
"def increaseLevels(levels)\n @level += levels\n end",
"def level= level\n if (0..6).include? level then @level = level\n elsif LEVEL.include? level.to_s then @level = LEVEL.index level\n else @level = UNKNOWN\n end\n end",
"def summons_level(level)\n set_summons\n for summon in @summons\n $game_actors[summon.id].level += level\n end\n end",
"def level=( level )\n super(level || 0)\n end",
"def change_level\n if Group::LEVEL_TITLES.include?(params[:level])\n params[:level] = Group::LEVELS[Group::LEVEL_TITLES.index(params[:level])]\n end\n unless Group::LEVELS.include?(params[:level])\n flash[:notice] = 'invalid level'\n render(:update) do |page|\n update_flash(page, flash[:notice])\n end\n return\n end\n\n act_on_members do |gi|\n if gi.level == 'leader' && gi.group.leaders.count == 1\n @member_notices << \"Couldn't change #{gi.person.full_name}'s level from a leader, since that would result in a leaderless group!\"\n else\n @levels_to_update << gi.level # update old\n gi.level = params[:level]\n @levels_to_update << gi.level # update new\n @member_notices << \"#{gi.person.full_name} is now a #{params[:level]}\"\n end\n end\n end",
"def save tariff\n level = Membership::Level.find_or_initialize_by nexudus_id: tariff['Id']\n level.name = tariff['Name']\n level.price = tariff['Price']\n level.nexudus_updated_at = tariff['UpdatedOn']\n level.nexudus_created_at = tariff['CreatedOn']\n level.save!\n end",
"def level=(new_level)\n @level = LEVELS[new_level.to_sym]\n reset_methods(:close)\n end",
"def levels\n levels = [\n \"1.1.1\",\n \"1.2.2\",\n \"1.3.1\",\n \"1.3.2\",\n \"2.1.1\",\n \"2.1.2\",\n \"2.2.1\",\n \"2.3.1\",\n \"2.4.1\",\n \"2.4.2\",\n \"2.4.3\",\n \"2.4.4\",\n \"3.1.1\",\n \"3.2.1\",\n \"3.3.2\",\n \"4.1.1\",\n \"4.1.2\",\n \"1.4.3\",\n \"1.4.4\",\n \"1.4.5\",\n \"2.4.6\",\n \"3.1.2\",\n \"3.2.4\",\n \"1.4.6\",\n \"1.4.8\",\n \"2.1.3\",\n \"2.2.4\",\n \"2.3.2\",\n \"2.4.10\",\n \"2.4.9\",\n \"2.5.5\",\n \"3.1.4\",\n \"3.1.5\",\n \"3.2.5\"\n ]\n return levels\n end",
"def level=(value_)\n if value_.kind_of?(Level)\n @level = value_\n else\n level_obj_ = @level_group.get(value_)\n if level_obj_.nil?\n raise Errors::UnknownLevelError, value_\n end\n @level = level_obj_\n end\n end",
"def level=(new_level)\n super new_level.to_s\n end",
"def decreaseLevels(levels)\n @level = @level - levels >= 1? @level-levels : 1 \n end",
"def create_from_editor\n\t\trender(:json => [\"status\" => false, \"notice\" => [ [\"Not signed in\"] ]]) and return if current_user.nil?\n\n\t\t# Overwriting level?\n\t\t@level = Level.find_by_title(params[:levelName])\n\n\t\t# Create or update\n\t\tif @level.nil?\n\t\t\tLevel.create_from_editor(current_user, params[:levelName], params[:level_json])\n\t\telse\n\t\t\trender(:json => [\"status\" => false, \"notice\" => [[\"Cannot save over another users level\"]] ]) and return if @level.user.id != current_user.id\n\n\t\t\t@level.current_user = current_user\n\t\t\t@level.playable = false if current_user.name != APP_CONFIG[\"DEFAULTS\"][\"MASTER_USER_NAME\"]\n\t\t\t@level.json = params[:level_json]\n\t\t\tunless @level.save\n\t\t\t\trender(:json => [\"notice\" => @level.errors, \"status\" => false])\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\n\t\tif(current_user.name != APP_CONFIG[\"DEFAULTS\"][\"MASTER_USER_NAME\"])\n\t\t\tdir = \"#{APP_CONFIG[\"PATHS\"][\"LEVELS_DIRECTORY\"]}/_users/#{current_user.name}\"\n\t\telse\n\t\t\tdir = \"#{APP_CONFIG[\"PATHS\"][\"LEVELS_DIRECTORY\"]}\"\n\t\tend\n\n\t\t# Save level to file with same name\n\t\tFileUtils.mkdir_p \"#{dir}\"\n\n\t\tfile = File.new(\"#{dir}/#{params[:levelName]}.json\", \"w\")\n\t\tfile.write(params[:level_json])\n\t\tfile.close\n\n\t\t# Spit back info\n\t\trender(:json => [\"status\" => true, \"notice\" => @level])\n\tend",
"def complete_level\n if user_signed_in?\n current_user.completed_repetition_levels.create!(\n repetition_level_id: @level.id\n )\n end\n # TODO handle the very last level\n render json: {\n next: {\n href: @level.next_level.path,\n },\n high_scores: @level.high_scores.map do |user, score|\n [user.username, score]\n end\n }\n end",
"def level=(lvl)\n @level = if lvl.is_a?(Integer)\n lvl\n else\n Level::NAME_TO_LEVEL.fetch(lvl.to_s.upcase)\n end\n end",
"def create\n @envlevel = Envlevel.new(envlevel_params)\n @envlevel.save\n @envlevels = Envlevel.all.sort_by{|envlevel| envlevel.name.downcase}\n end",
"def level_up\n $levels.push('/..')\nend",
"def set_level\n @level = Level.find(params[:id])\n end",
"def set_level\n @level = Level.find(params[:id])\n end",
"def levels\n level_names = []\n properties[\"pages\"].each do |page|\n page[\"levels\"].each do |page_level_name|\n level_names << page_level_name\n end\n end\n\n Level.where(name: level_names)\n end",
"def after_initialize\n self.levels ||= Array.new\n end",
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def levels (args)\n if !instance_variable_defined?(:@log_level)\n Logging.class_eval(Conf.define_accessor(\"log_level\"))\n @log_level = {}\n end\n args.each do |k,v|\n @log_level[k] = v\n end\n end",
"def create\n authorize! :create, :level\n type_class = level_params[:type].constantize\n\n # Set some defaults.\n params[:level].reverse_merge!(skin: type_class.skins.first) if type_class <= Blockly\n if type_class <= Grid\n params[:level][:maze_data] = Array.new(8){Array.new(8){0}}\n params[:level][:maze_data][0][0] = 2\n end\n if type_class <= Studio\n params[:level][:maze_data][0][0] = 16 # studio must have at least 1 actor\n params[:level][:soft_buttons] = nil\n params[:level][:timeout_after_when_run] = true\n params[:level][:success_condition] = Studio.default_success_condition\n params[:level][:failure_condition] = Studio.default_failure_condition\n end\n params[:level][:maze_data] = params[:level][:maze_data].to_json if type_class <= Grid\n params.merge!(user: current_user)\n\n begin\n @level = type_class.create_from_level_builder(params, level_params)\n rescue ArgumentError => e\n render status: :not_acceptable, text: e.message and return\n rescue ActiveRecord::RecordInvalid => invalid\n render status: :not_acceptable, text: invalid and return\n end\n\n render json: { redirect: edit_level_path(@level) }\n end",
"def update_level_\n end",
"def level(level, context = nil)\n context = context.to_s unless context.nil?\n self.levels[context] = level\n clear_levels_cache!\n end",
"def level_params\n \t\tparams.require(:level).permit(:level_name)\n \tend",
"def set_level(level) # Sets both level and exp\n kendrick_actor_skill_progression_data_progress_set_level(level)\n @exp = exp_for_level\n end",
"def set_level\n @level = Level.find(params[:id])\n end",
"def set_level\n if params[:id].nil?\n @level = Level.find(1) # TODO change to cookie thing maybe\n else\n @level = Level.find(params[:id])\n end\n end",
"def level_params\n permitted_params = [\n :name,\n :type,\n :level_num,\n :user,\n :match_text,\n {concept_ids: []}\n ]\n permitted_params.concat(Level.serialized_properties.values.flatten)\n params[:level].permit(permitted_params)\n end",
"def levels?\n @levels\n end",
"def brlevel_params\n params.require(:brlevel).permit(:name, :level, :parent, :ranking, :reorderset, :locale, :chaos)\n end",
"def create\n\t\t@level = Level.new(params[:level])\n\n\t\trespond_to do |format|\n\t\t\tif @level.save\n\t\t\t\tformat.html { redirect_to(@level, :notice => 'Level was successfully created.') }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @level = Level.new(params[:level])\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to @level, notice: 'Level was successfully created.' }\n format.json { render json: @level, status: :created, location: @level }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @level = Level.new(params[:level])\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to @level, notice: 'Level was successfully created.' }\n format.json { render json: @level, status: :created, location: @level }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def load_level(level_name)\n @game.log.info \"Loading level into game #{level_name}\"\n #@game.animation_controller.clear\n @game.level = @game.level_loader.load_level(level_name)\n if !@game.player\n @game.log.info \"Level loading player\"\n @game.player = @game.player_loader.load_player\n end\n #TODO Hackish and an exact double\n if @game.level.player_start_position\n @game.log.info \"Level setting start player position\"\n @game.player.position = @game.level.player_start_position\n end\n if @game.level.player_start_health\n @game.log.info \"Level setting start player health\"\n @game.player.health = ((@game.level.player_start_health.to_f/100.0) * @game.player.max_health).to_i\n end\n\n @game.log.info \"Level adding player #{@game.player} weapon:(#{@game.player.inventory.weapon})\"\n if @game.player.inventory.weapon\n @game.player.inventory.weapon.inactivate\n end\n @game.level.add_player(@game.player)\n if @game.level.background_music\n @game.sound_controller.play_song(@game.level.background_music, true)\n end\n @game.clock.reset\n @game.temporary_message = nil\n @game.rendering_controller.add_consumable_rendering(@game, RenderingTypes::FADE_IN_LEVEL, 60)\n @game.input_controller.enable_all\n @game.level\n end",
"def level=(level)\n validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Inline\", \"Block\", \"Row\", \"Cell\"])\n if level.to_i == 0\n unless validator.valid?(level)\n raise ArgumentError, \"invalid value for 'level', must be one of #{validator.allowable_values}.\"\n end\n @level = level\n else\n @level = validator.allowable_values[level.to_i]\n end\n end",
"def set_level(name, level=nil)\n # Default\n unless level then\n level = name\n name = nil\n end\n\n # Look up the level if the user provided a :symbol or \"string\"\n level = MultiLog.string_to_level(level.to_s) unless level.is_a? Fixnum\n\n if name\n # Set a specific one\n raise \"No log by the name '#{name}'\" unless @logdevs[name]\n @logdevs[name][:level] = level\n else\n # Set them all by default \n @logdevs.each{|_, logdev| logdev[:level] = level }\n end\n end",
"def create\n if admin?\n @level = Level.new(level_params)\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to @level, notice: 'Level was successfully created.' }\n format.json { render :show, status: :created, location: @level }\n else\n format.html { render :new }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def resetLevels\n @level = 1\n @threshold = 200\n end",
"def level=(level)\n @level = level.to_s.downcase.to_sym\n\n loggers.each do |_, logger|\n logger.level = @level\n end\n\n @level\n end",
"def update_level\n new_level_progress = 100 - ((self['level'] * 100) - self['xp'])\n self.update(:level_progress => new_level_progress)\n if self['level_progress'] > 99\n new_level = self['level'] + 1\n self.update(:level => new_level)\n self.update_level\n end\n end",
"def update!(**args)\n @level = args[:level] if args.key?(:level)\n end",
"def update!(**args)\n @level = args[:level] if args.key?(:level)\n end",
"def level=(lvl)\n return if lvl == @level\n\n lvl = lvl.clamp(1, $pokemon_party.level_max_limit)\n @exp = exp_list[lvl]\n @exp_rate = 0\n @level = lvl\n end",
"def increment_level(level)\n\n if !@last_heading_counter[level] \n @last_heading_counter[level] = 0\n end\n @last_heading_counter[level] += 1\n\n for i in 0..(@last_heading_counter.length - 1) do\n if i > level + 1\n @last_heading_counter[i] = 0\n elsif [0, nil].include?(@last_heading_counter[i])\n @last_heading_counter[i] = 1\n end\n end\nend",
"def levels\n grant_id = params[:id]\n grant = Grant.find(grant_id)\n if grant == nil\n render :json => {}\n return\n end\n\n levels_array = []\n grant.funding_levels_csv.split(',').each do |token|\n limits = token.split(\"-\")\n if limits.length == 1\n limit = Integer(limits[0])\n levels_array.append([limit, limit])\n elsif limits.length == 2\n lower = Integer(limits[0])\n upper = Integer(limits[1])\n levels_array.append([lower, upper])\n end\n end\n\n # XXX: We're not supposed to be doing display formatting in the controller\n # like this.\n render :json => {\n pretty: funding_levels_pretty(grant),\n levels: levels_array\n }\n end",
"def level_params\n permitted_params = [\n :name,\n :type,\n :level_num,\n :user,\n :dsl_text,\n :encrypted,\n :published,\n {poems: []},\n {concept_ids: []},\n {soft_buttons: []},\n {examples: []}\n ]\n\n # http://stackoverflow.com/questions/8929230/why-is-the-first-element-always-blank-in-my-rails-multi-select\n params[:level][:soft_buttons].delete_if(&:empty?) if params[:level][:soft_buttons].is_a? Array\n permitted_params.concat(Level.serialized_properties.values.flatten)\n params[:level].permit(permitted_params)\n end",
"def decide_level(levels_input_data)\n course_ds = levels_input_data.course_ds\n course_failures = levels_input_data.course_failures\n recent_absence_rate = levels_input_data.recent_absence_rate\n recent_discipline_actions = levels_input_data.recent_discipline_actions\n\n # Level 4: At least 4 F's\n # OR less than 80% attendance over last 45 school days\n # OR 7 or more discipline actions over the last 45 school days\n level_four_triggers = [\n (:academic if course_failures >= 4),\n (:absence if recent_absence_rate < 0.80),\n (:discipline if recent_discipline_actions >= 7)\n ].compact\n return Level.new(4, level_four_triggers, levels_input_data) if level_four_triggers.size > 0\n\n # Level 3: 3 F's\n # OR less than 85% attendance over last 45\n # OR 5-6 discipline actions over the last 45 school days\n level_three_triggers = [\n (:academic if course_failures >= 3),\n (:absence if recent_absence_rate < 0.85),\n (:discipline if recent_discipline_actions >= 5)\n ].compact\n return Level.new(3, level_three_triggers, levels_input_data) if level_three_triggers.size > 0\n\n # Level 2: 2 F's\n # OR less than 90% attendance over last 45\n # (no discipline involved in calculation)\n level_two_triggers = [\n (:academic if course_failures >= 2),\n (:absence if recent_absence_rate < 0.90)\n ].compact\n return Level.new(2, level_two_triggers, levels_input_data) if level_two_triggers.size > 0\n\n # Level 1: 1 F and 2 Ds\n # OR less than 95% attendance over last 45 days\n # (no discipline involved)\n level_one_triggers = [\n (:academic if course_failures == 1 && course_ds >= 2),\n (:absence if recent_absence_rate < 0.95)\n ].compact\n return Level.new(1, level_one_triggers, levels_input_data) if level_one_triggers.size > 0\n\n # Level 0: Not any of the other levels\n return Level.new(0, [], levels_input_data)\n end",
"def level=(level)\n @level = level\n @implementation.level = @level if @implementation\n level\n end",
"def validate_name names, levels\n error_msg = \"'names' and 'levels' should be of same size. Size of the \"\\\n \"'name' array is #{names.size} and size of the MultiIndex 'levels' and \"\\\n \"'labels' is #{labels.size}.\"\n suggestion_msg = \"If you don\\'t want to set name for particular level \" \\\n \"(say level 'i') then put empty string on index 'i' of the 'name' Array.\"\n\n raise SizeError, error_msg if names.size > levels.size\n raise SizeError, [error_msg, suggestion_msg].join(\"\\n\") if names.size < levels.size\n end",
"def level_up!\n if self.character.skill_points > 0\n self.level += 1\n return self.save\n else\n return false\n end\n end",
"def clear_levels_cache!\n @_levels_cache = nil\n end",
"def sign_in_risk_levels=(value)\n @sign_in_risk_levels = value\n end",
"def level\r\n\tif $lvl == 1\r\n\t\tlevel2\r\n\telse \r\n\t\tif $lvl == 2\r\n\t\t\tlevel3\r\n\t\telse\r\n\t\t\tif $lvl == 3\r\n\t\t\t\tlevel4\r\n\t\t\tend\r\n\t\tend\t\r\n\tend\t\r\nend",
"def create\n @admin_level = Admin::Level.new(admin_level_params)\n\n respond_to do |format|\n if @admin_level.save\n format.html { redirect_to edit_admin_level_path(@admin_level), notice: 'Level was successfully created.' }\n format.json { render :show, status: :created, location: @admin_level }\n else\n format.html { render :new }\n format.json { render json: @admin_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def encode_levels(points, dists, absMaxDist)\r\n encoded_levels = \"\"\r\n if @force_endpoints\r\n encoded_levels << encode_number(@num_levels-1)\r\n else\r\n encoded_levels << encode_number(@num_levels-compute_level(abs_max_dist)-1)\r\n end\r\n for i in 1 .. points.length-1\r\n if !dists[i].nil?\r\n encoded_levels << encode_number(@num_levels-compute_level(dists[i])-1)\r\n end\r\n end\r\n if @force_endpoints\r\n encoded_levels << encode_number(@num_levels-1)\r\n else\r\n encoded_levels << this.encode_number(@num_levels-compute_level(abs_max_dist)-1)\r\n end\r\n return encoded_levels\r\n end",
"def create\n authorize! :create, :level\n type_class = level_params[:type].constantize\n\n # Set some defaults.\n params[:level].reverse_merge!(skin: type_class.skins.first) if type_class <= Blockly\n params.merge!(user: current_user)\n\n begin\n @level = type_class.create_from_level_builder(params, level_params)\n rescue ArgumentError => e\n render status: :not_acceptable, text: e.message and return\n rescue ActiveRecord::RecordInvalid => invalid\n render status: :not_acceptable, text: invalid and return\n end\n\n render json: { redirect: level_url(@level) }.to_json\n end",
"def set_level\n @level =\n if params.include? :key\n Level.find_by_key params[:key]\n else\n Level.find(params[:id])\n end\n @game = @level.game\n end",
"def populate(level)\n\t\tinitialize\n\t\tself.name = level\n\t\tself.path = \"#{self.path}/#{level}\"\n\n\t\tDir.new(base_dir = \"#{self.path}\").each do |name|\n\t\tpath = \"#{base_dir}/#{name}\"\n\t\t\tif name !~ /^\\./\n\t\t\t\tif FileTest.directory?(path)\n\t\t\t\t\ttemp_dir = Directory.new\n\t\t\t\t\ttemp_dir.populate(\"#{level}/#{name}\")\n\t\t\t\t\tself.directories << temp_dir\n\t\t\t\telse\n\t\t\t\t\tself.files << name\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def loglevel= level\n self.class.createlogger unless self.class._logobject\n level = level.to_s.downcase.to_sym\n unless JLogger::Simple::LEVELS.has_key? level\n raise ArgumentError, \"'#{level}' is an invalid loglevel\"\n end\n \n self.class._logobject.level = JLogger::Simple::LEVELS[level]\n end",
"def level_params\n params.require(:level).permit(:nodes_list, :links_list, :number_of_nodes, :name, :flower_id, :game_id, :level_index)\n end",
"def test_level\n assert_equal(0, @root.level, \"A root node's level is 0\")\n\n assert_equal(@root.node_depth, @root.level, \"Level and depth should be the same\")\n\n setup_test_tree\n for child in [@child1, @child2, @child3]\n assert_equal(1, child.level, \"Node #{child.name} should have level 1\")\n assert_equal(@root.node_depth, @root.level, \"Level and depth should be the same\")\n end\n\n assert_equal(2, @child4.level, \"Child 4 should have level 2\")\n end",
"def change_level(kod,iw)\n case kod\n when 'y' # povysit level\n $words[iw].addlevel(1)\n when 'r' # reset level=0\n $words[iw].setlevel(0)\n when 'x' # level +3\n $words[iw].addlevel(3)\n end\nend",
"def addlevel(krok)\n if $en_cz == 'Y' then @enlevel += krok else @czlevel += krok end\n end",
"def level_params\n permitted_attributes(@level || Level.new)\n end",
"def current_level=( level )\n if @base_level.nil?\n @base_level = @cur_level = level\n @level[@base_level-1] = @numbering_start-1\n end\n\n if level < @base_level\n raise ::Webby::Error, \"heading tags are not in order, cannot outline\"\n end\n\n if level == @cur_level\n @level[level-1] += 1\n elsif level > @cur_level\n @cur_level.upto(level-1) {|ii| @level[ii] += 1}\n else\n @cur_level.downto(level+1) {|ii| @level[ii-1] = 0}\n @level[level-1] += 1\n end\n\n @cur_level = level\n end",
"def update_income_levels(round)\n teams = Team.all_without_incomes\n if round == 0\n # Create incomes if none exist for round 0\n if self.incomes.where(round: 0).count == 0\n teams.each do |team|\n #Income starts at 6.\n income = Income.find_or_create_by(game: self, round: round, amount: 6, team: team)\n end\n end\n else\n previous_round = round - 1\n teams.each do |team|\n pr = self.public_relations.where(round: previous_round).where(team: team).sum(:pr_amount)\n previous_income_value = self.incomes.where(round: previous_round, team: team).sum(:amount)\n current_income_value = previous_income_value + self.calculate_income_level(pr)\n\n begin\n current_income = Income.find_or_create_by(round: round, team: team, game: self)\n current_income.update_attribute(:amount, current_income_value)\n rescue ActiveRecord::RecordNotUnique => e\n # If we hit a race condition on for creating new incomes, check before skipping\n if Income.where(round: round, team: team, game: self).count > 0\n continue\n else\n raise\n end\n end\n end\n end\n end",
"def level_params\n params.require(:level).permit(:description, :short_description, :video_url, :classtype_id, :levelname, :length, :age, :gender, :sort_order, :jack_rabbit_name, :color, :image, :show_registration, :active)\n end",
"def update!(**args)\n @depth = args[:depth] if args.key?(:depth)\n @level_type_normalized = args[:level_type_normalized] if args.key?(:level_type_normalized)\n @level_type_source_text = args[:level_type_source_text] if args.key?(:level_type_source_text)\n @level_type_string = args[:level_type_string] if args.key?(:level_type_string)\n @name = args[:name] if args.key?(:name)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"def incrementLevels(l)\n @level += l\n \n if(@level > @@MAXLEVEL)\n @level = 10\n end\n end",
"def level(l)\n @config[:level] = l\n end",
"def level=(level)\n @state[:fiber][:level] = level\n end",
"def build_levels(build)\n\t\tlevels = \"#{build.name}\\n\" + build.lvls.reduce(\"\") {|str,(k,v)| str + \"#{k.to_s}: #{v}\\n\"} \n\tend",
"def setBredthLevels\n stack = []\n queue = []\n level = 0\n\n queue.push(@root)\n\n while(queue.size != 0)\n node = queue.shift\n\n stack.append([node.name, node.level])\n\n node.children.each_with_index do |child, i|\n level += 1 if i == 0\n child.level = level\n queue.push(child)\n end\n end\n\n return stack\n end",
"def level_up\r\r\n return unless can_level\r\r\n return if @level == @max_level\r\r\n @level += 1\r\r\n if @special == nil then\r\r\n @special = 0\r\r\n end\r\r\n level_update\r\r\n end",
"def push_level(x=1) \n x >= 1 ? @level = x : @level = 1\n end",
"def create\n @level = Level.new(params[:level])\n authorize! :create, @level, :message => 'Acceso denegado.'\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to @level, notice: t(\"activerecord.alerts.level.created\") }\n format.json { render json: @level, status: :created, location: @level }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def clear_levels_cache!\n appenders.each(&:clear_levels_cache!)\n end",
"def level\n init unless @initialized\n level = level_to_sym(@level)\n end",
"def lvlres\n @level = 0\n lvlup\n end",
"def set_levels\n @course = Course.find(params[:course_id])\n end",
"def update_level_channel(level, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['Level'] = level\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/level_channels/[Level]'\n\t\targs[:query]['Action'] = 'UpdateLevelChannel'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :level_channel_setting\n\t\t\targs[:body]['LevelChannelSetting'] = optional[:level_channel_setting]\n\t\tend\n\t\tself.run(args)\n\tend",
"def save_level\n File.open(@file_name, 'w') do |file|\n @blocks_array.each do |block|\n new_block = Block.new block.relative_position\n puts new_block.to_s\n end\n end\n end",
"def level(value = nil)\n if value.nil?\n @level\n else\n @level = value\n end\n end",
"def initialize( levels, ignore_size = 0 )\n @trims = Hash.new\n @levels = levels\n @min_ignore_size = ignore_size\n end",
"def numbered_levels\n levels.each_with_index.map do |level, index|\n level.clone.tap { |l| l.level_number = index + 1 }\n end\n end"
] |
[
"0.71385366",
"0.62222093",
"0.6181587",
"0.59082156",
"0.56003654",
"0.55802184",
"0.55802184",
"0.55479366",
"0.55303395",
"0.55172014",
"0.54905945",
"0.54611444",
"0.5395873",
"0.5388535",
"0.536256",
"0.5360733",
"0.531737",
"0.5310692",
"0.52956796",
"0.5260223",
"0.52512145",
"0.5246789",
"0.5228817",
"0.51919526",
"0.51749074",
"0.5174375",
"0.51715773",
"0.5161331",
"0.51603353",
"0.5160175",
"0.5160175",
"0.5150452",
"0.5140524",
"0.5133894",
"0.5126588",
"0.51256037",
"0.5124082",
"0.5111802",
"0.50899106",
"0.5089901",
"0.50772315",
"0.5072682",
"0.507183",
"0.50535715",
"0.5036623",
"0.50202453",
"0.5001379",
"0.5001379",
"0.49944878",
"0.49922246",
"0.4988143",
"0.49737528",
"0.49700925",
"0.49568623",
"0.49526575",
"0.49366757",
"0.49366757",
"0.49282357",
"0.49214438",
"0.4915861",
"0.49075094",
"0.4906811",
"0.49033967",
"0.48723534",
"0.48667833",
"0.48603693",
"0.4844972",
"0.4821423",
"0.48169765",
"0.4816351",
"0.48068434",
"0.47940007",
"0.47906843",
"0.4790519",
"0.47843224",
"0.47821015",
"0.47637922",
"0.47595304",
"0.47487348",
"0.47465333",
"0.474591",
"0.4737976",
"0.4736472",
"0.47343573",
"0.4732322",
"0.47315297",
"0.47196308",
"0.4714867",
"0.47109163",
"0.47096887",
"0.47089154",
"0.47067437",
"0.47046936",
"0.47003084",
"0.4700204",
"0.46954578",
"0.46950775",
"0.46874914",
"0.46866503",
"0.4682943"
] |
0.75213766
|
0
|
before_create :build_image def start_generation MiddleMan.worker(:snap_generator_worker).async_generate(:arg => self.id) end
|
def start_generation
Nanite.request("/nanny/generate", self.id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n GenerateThumbnailsJob.perform_later(@image.id)\n\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate\n GenerateInvoiceJob.perform_later\n end",
"def create\n @bench_test_photo_gen = BenchTest::PhotoGen.new(params[:bench_test_photo_gen])\n\n # create the album and photos which kicks off the work to generate thumbs\n mark_as_starting @bench_test_photo_gen\n\n respond_to do |format|\n if @bench_test_photo_gen.save\n format.html { redirect_to(@bench_test_photo_gen, :notice => 'Photo gen was successfully created.') }\n format.xml { render :xml => @bench_test_photo_gen, :status => :created, :location => @bench_test_photo_gen }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bench_test_photo_gen.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def process_image\n\t\tImageProcessingJob.perform_later(id)\n\tend",
"def initial_generate\n \n end",
"def download_image!\n EventCreationJob.new.perform(\n source: self,\n resource: self\n )\n\n UserImageCreationJob.new.perform(self)\n end",
"def sequence_images\n \n end",
"def image\n r = super\n if r.nil? and not @_generating\n generate\n return super\n end\n r\n end",
"def initialize image_base64\n @image_base64 = image_base64\n @task_id ||= SecureRandom.random_number(1000000000)\n end",
"def start_auto_gen_thumbnail\n\t$open_cbz_ltime = Time.now - 61 # holds the last time the open_cbz is called\n\n\tThread.new {\n\t\tputs \"************* Start Generating Thumbnails *************\" \n\t\t\n\t\tfor bookcode, obj in $db.books\n\t\t\t# if the call to open_cbz has elasped more than 60 seconds, allow to resume generating\n\t\t\tif $open_cbz_ltime + 60 < Time.now\n\t\t\t\tmk_thumb( obj.fullpath, true )\n\t\t\telse\n\t\t\t\tputs \"Thumbnail generating paused.\"\n\t\t\t\tsleep 60\n\t\t\tend\n\t\tend\n\t\t\n\t\tputs \"************* Finish Generating Thumbnails *************\"\n\t}\nend",
"def create_snapshot\n @current_snapshot = @bitmap.to_json if @bitmap\n end",
"def create\n generate\n save\n end",
"def create_thumbnail\n ImageGeneratingService.new(self, 'Thumbnail.png', 'image/png').generate_resized(120)\n end",
"def do_generate(in_background = true)\n update_attributes(:generation_start_time => Time.now)\n logs.create(:message => 'Started generate process')\n generation_started!\n \n generate_rails!\n logs.create(:message => 'Generated Rails')\n \n remove_unwanted_files!\n logs.create(:message => 'Removed unwanted files')\n \n scm_object.initialize_repository\n logs.create(:message => \"Initialized #{scm} repository\")\n \n scm_object.install_plugins\n logs.create(:message => \"Installed #{selected_plugins.count} plugins\")\n \n if capify\n system(\"cd ../#{self.underscored_name} && Capify .\")\n logs.create(:message => \"Capified with Capistrano\")\n end\n \n scm_object.track_all_files\n logs.create(:message => \"Tracked all files\")\n \n scm_object.push_to_server\n logs.create(:message => \"Pushed files to server. Generation completed.\")\n \n update_attributes(:generation_stop_time => Time.now)\n logs.create(:message => 'Finished generate process')\n generation_completed!\n end",
"def build_snapshot\n raise \"build_snapshot not implemented in #{self}\"\n end",
"def create_basic\n ImageGeneratingService.new(self, 'Basic.jpg', 'image/jpeg', 100).generate_resized(600)\n end",
"def create\n @provider = Provider.new(provider_params)\n if @provider.save\n notice = t(\"c.s\")\n if params[:run_builder].present?\n @provider.start_page_builder_process\n #Here My Sidekiq Initializer will come\n notice = t(\"page.generating\")\n end\n redirect_to providers_path, notice: notice\n else\n render action: \"new\", alert: t(\"c.f\")\n end\n end",
"def create_processes_for_snapshot(snapshot)\n [1 .. rand(10)+10].each do\n Sherlock::Models::Process.create!(\n :snapshot => snapshot,\n :timestamp => snapshot.timestamp,\n :user => %w(nobody root httpd postfix).sample,\n :pid => rand(1000) + 1000,\n :cpu_usage => rand(50),\n :memory_usage => rand(25),\n :virtual_memory_size => rand(1000) + 1000,\n :residential_set_size => rand(1000) + 1000,\n :tty => %w(? tty0 tty1 tty2).sample,\n :state => %w(S Ss Z R+).sample,\n :started_at => (Time.now - (rand(100) + 1).minutes).strftime('%H:%M'),\n :cpu_time => (Time.now - (rand(100) + 1).minutes).strftime('%H:%M'),\n :command => %w(syslogd ntpd autofsd httpd cupsd).sample\n )\n end\nend",
"def generate_wallpaper\n if self.order.uncommon_order?\n begin\n rand_id = rand(999999).to_s\n image = MiniMagick::Image.from_file(\"#{Rails.root}/public/assets/printable/#{printable_file_name}-1.jpg\")\n image.gravity('Center')\n image.rotate(90)\n image.resize('400x600^')\n image.crop('320x480+40+120')\n image.write(\"#{Rails.root}/tmp/#{rand_id}.jpg\")\n File.open(\"#{Rails.root}/tmp/#{rand_id}.jpg\", 'rb') { |image| self.wallpaper = image }\n File.delete(\"#{Rails.root}/tmp/#{rand_id}.jpg\")\n self.save\n rescue Exception => e\n UncommonHoptoad::notify(\"Error generating wallpaper for #{id}\",\"Error: #{e.message}\", \"Failed to generate wallpaper for order_item #{self.id}\")\n end\n end\n end",
"def create_snapshot\n @attributes[:create_snapshot]\n end",
"def create\n @greeting_card = GreetingCard.new(greeting_card_params)\n @greeting_card.image.attach(params[:greeting_card][:image])\n respond_to do |format|\n if @greeting_card.save\n ProcessImageJob.perform_later(@greeting_card.id)\n format.html { redirect_to @greeting_card, notice: 'Greeting card was successfully created.' }\n format.json { render :show, status: :created, location: @greeting_card }\n else\n format.html { render :new }\n format.json { render json: @greeting_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate\n if !self.exists?\n if !self.authenticated\n raise ManagedImage::AuthenticationError, \"The ManagedImage::Variant has not been properly authenticated\"\n end\n magick_image = parent_image.magick_image\n magick_image.crop!(*magick_crop_rect)\n # Only resize if the dimensions are incorrect\n if self.width != magick_image.columns || self.height != magick_image.rows\n magick_image.resize!(self.width, self.height)\n end\n storage.create(path, magick_image.to_blob)\n end\n self\n end",
"def create\n @pitch = Pitch.new\n @pitch.attachment.attach(params[:file])\n @pitch.filename = params[:file].original_filename\n if @pitch.save\n PitchWorker.perform_async 'generate_image', @pitch.id\n api_success @pitch.as_json\n else\n api_fail @pitch.errors, :unprocessable_entity\n end\n end",
"def generate\n end",
"def generate\n save\n end",
"def process\n self.generate\n end",
"def set_generated_image\n @generated_image = GeneratedImage.find(params[:id])\n end",
"def create\n super do |resource|\n BackgroundWorker.trigger(resource)\n\n end\n end",
"def create_snap # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function\n uri = URI.parse(url)\n #account = '/Compute-' + @id_domain + '/' + @user\n account = '/Compute-' + id_domain + '/cloud_storage'\n create_data = Hash.new\n create_data = { 'account' => account, 'instance' => container }\n create_data['machineimage'] = @machine_image if !@machine_image.nil?\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field 'Cookie', authcookie\n request.add_field 'Content-type', 'application/oracle-compute-v3+json'\n http.request(request, create_data.to_json)\n end",
"def enqueue_image\n Resque.enqueue(ImageWorker,id,key)\n end",
"def generate; end",
"def generate; end",
"def create\n @snap = Snap.new(snap_params)\n @snap.user = User.first\n\n if @snap.save\n render :show, status: :created, location: @snap\n else\n render json: @snap.errors, status: :unprocessable_entity\n end\n end",
"def on_demand(width, height)\n dims = \"#{width}x#{height}\"\n\n public_path = self.public_path(dims)\n output_path = self.output_path(dims)\n\n if File.exists?(output_path)\n logger.info \"[iphoto library] Thumbnail hit at #{public_path}\"\n else\n FileUtils.mkdir_p(File.dirname(output_path))\n\n unless defined? MiniMagick\n logger.debug \"[iphoto library] Requiring MiniMagick\"\n require 'mini_magick'\n end\n\n image = MiniMagick::Image.from_file(image_path(true))\n image.resize dims\n image.write(output_path)\n FileUtils.chmod 0755, output_path\n\n logger.info \"[iphoto library] Created thumbnail at #{output_path}\"\n end\n\n public_path\n end",
"def create\n @screenshot = Screenshot.new(params[:screenshot])\n #@screenshot.sizes.build(params[:sizes_attributes][0])\n\n respond_to do |format|\n if @screenshot.save\n Resque.enqueue(Screenshot, @screenshot.id)\n format.html { redirect_to screenshot_path(@screenshot,\n :token => @screenshot.token, \n :email => @screenshot.email), notice: 'Screenshot was queued up for delivery.' }\n format.json { render json: @screenshot, status: :created, location: @screenshot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @screenshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def seed_image(filename, imageable_type, imageable_id)\n Picture.create!(\n :id => $image_id,\n :image => image(filename),\n :imageable_type => imageable_type,\n :imageable_id => imageable_id\n )\n $image_id += 1\nend",
"def gv_make_step_image\n gv_reset\n return unless gv_object\n @step = 1 unless @step\n name = \"#{gv_object.name}-#{@step}\"\n file = gv_make_image name\n @step += 1\n gv_reset\n file\n end",
"def create_stripe_client\n NewStripeClientWorker.perform_async self.id\n end",
"def generate\n CfnMonitor::Generate.run(options)\n end",
"def process_images\n ItemWorker.async_image_processor(:image_id => self.id)\n end",
"def start_run_image\n image_path(image_name: params[:start_run_image])\n end",
"def create_image(image)\n self.images.create(image: image) if image.present?\n end",
"def create\n @image = Image.new(image_params)\n @image.ip = ip2long request.remote_ip\n @image.delete_code = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n @image.homepage = false\n @image.save\n end",
"def generate\n end",
"def install_images(object)\n generated_name = Storage.generated_file_name(object)\n install_main_image(object.has_image_id, generated_name)\n generate_thumbnails(object.has_image_id, generated_name) if thumbnails_needed?\n return generated_name\n ensure \n @temp_file.close! if !@temp_file.closed?\n @temp_file = nil\n end",
"def create_snapshot(snap_id, snap_name)\n memory_dumps = true\n memory_dumps = CONFIG[:memory_dumps] \\\n unless CONFIG[:memory_dumps].nil?\n\n snapshot_hash = {\n :name => snap_id,\n :description => \"OpenNebula Snapshot: #{snap_name}\",\n :memory => memory_dumps,\n :quiesce => true\n }\n\n begin\n @item.CreateSnapshot_Task(snapshot_hash).wait_for_completion\n rescue StandardError => e\n error = \"Cannot create snapshot for VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n\n snap_id\n end",
"def create_snapshot(vm, name)\n task = vm.CreateSnapshot_Task(\n name: name,\n memory: false,\n quiesce: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end",
"def photo__after_create_trigger\r\n\r\nif !@photo_cache.blank? && !@photo_cache[:tmp].blank?\r\n @photo_cache[:path] = File.join(FILES_DEST_PHOTO, 'cache', @photo_cache[:tmp])\r\nend\r\nif !@photo_cache.blank? && @photo_cache[:path]\r\n if File.exist?(@photo_cache[:path])\r\n File.rename(@photo_cache[:path], File.join(FILES_DEST_PHOTO, \"#{self.id}_#{self.photo__name}\"))\r\n else\r\n logger.warn(\"Should not happen! cache: #{@photo_cache.inspect} - name: #{self.photo__name}\")\r\n end\r\nend\r\n@photo_cache = {}\r\nend",
"def build_ami(instance)\n provision(instance)\n logger.info { \"Finalizing changes for #{self.region} AMI...\" }\n self.agent_ami = register_hailstorm_ami(instance)\n logger.info { \"New AMI##{self.agent_ami} on #{self.region} created successfully, cleaning up...\" }\n end",
"def create\n @movie = Movie.new(params[:movie])\n @movie.name = @movie.system_files.first.original_name\n @movie.delay.generate_thumbnail\n respond_to do |format|\n if @movie.save\n format.html { redirect_to(@movie, :notice => 'Movie was successfully created.') }\n format.xml { render :xml => @movie, :status => :created, :location => @movie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @movie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_frame_and_thumbnail\n if (File.extname(self.image_sequence) == \".mha\")\n file_path = Rails.root.join(dir_path, self.image_sequence)\n result = system(Rails.root.join('scripts','mha_to_png','bin',\"MhaToPng #{file_path} 1\").to_s)\n base_name = File.basename(file_path, \".mha\")\n image = MiniMagick::Image.open(\"#{dir_path}/#{base_name}_frame.png\")\n image.resize \"200x200\"\n image.format \"png\"\n image.write \"#{dir_path}/#{base_name}_thumbnail.png\"\n File.chmod(0644, \"#{dir_path}/#{base_name}_thumbnail.png\")\n self.thumbnail = \"#{base_name}_thumbnail.png\"\n self.frame = \"#{base_name}_frame.png\"\n end\n end",
"def generate\n Thread.new do\n process_repo\n end\n msg = { :success => true, :message => \"Please wait while we generate activity for the repository!\" }\n end",
"def run_in_background\n InsertOpportunity.perform_async(\"#{self.id}\") \n end",
"def allocate_image(action_handler, image_spec, image_options, machine_spec, machine_options)\n raise \"#{self.class} does not implement create_image\"\n end",
"def start_load_screenshot\n show_loading_bar\n Thread.new{extract_graphic}\n end",
"def create\n reading_id = Reading.next_sequence_id\n params.merge!(\"thermostat_id\" => @thermostat.id)\n $redis.set(reading_id, params)\n ::BackgroundWorker::CreateReading.perform(params, reading_id)\n render status: 200, :json=>{:sequence_id => reading_id} and return\n end",
"def create\n #raise params.inspect\n params.delete :target_id if params[:target_id].to_s == \"\" \n #raise params.inspect\n\n respond_to do |format| \n if @provisioningobject.save \n if @provisioningobject.provisioningtime == Provisioningobject::PROVISIONINGTIME_IMMEDIATE\n if @provisioningobject.provision(:create, @async)\n if @async \n @notice = \"#{@provisioningobject.class.name} is being created (provisioning running in the background).\"\n else\n @notice = \"#{@provisioningobject.class.name} is provisioned.\"\n end\n else # if @provisioningobject.provision(:create, @async)\n @notice = \"#{@provisioningobject.class.name} could not be provisioned\"\n end\n else # if @provisioningobject.provisioningtime == Provisioningobject::PROVISIONINGTIME_IMMEDIATE\n # only save, do not provision:\n @notice = \"#{@provisioningobject.class.name} is created and can be provisioned ad hoc.\"\n end\n \n format.html { redirect_to @provisioningobject, notice: @notice }\n format.json { render :show, status: :created, location: @provisioningobject } \n else # if @provisioningobject.save\n format.html { render :new } \n format.json { render json: @provisioningobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def with_no_cover\n build_image\n self\n end",
"def pre_generation_hook(task)\n end",
"def create_photos\n end",
"def create_custom_part(src_image)\n raise \"no src_image to make custom part #{self.inspect}\" if src_image.nil?\n @custom_part = part_layout.draw_custom_part(part_image, src_image)\n dump('assembled', @custom_part) if Rails.env.development?\n image.store_image!(@custom_part)\n end",
"def create\n\n @picture = Picture.create(params.require(:picture).permit(:image))\n\n respond_to do |wants|\n if @picture.save!\n #puts \"***********PROCESA THUMBNAIL************\"\n #ImageProcessing::Vips\n # .source(ActiveStorage::Blob.service.send(:path_for, @picture.image.key))\n # .resize_to_fill!(400, 400,crop: :attention)\n # .call!\n #puts \"***********THUMBNAIL PROCESADO************\" \n #flash[:notice] = 'La imagen fue cargada exitosamente.'\n #wants.html { redirect_to(:controller=>'welcome',:action =>:index) }\n wants.html { redirect_to @picture, notice: 'La imagen fue cargada exitosamente.' }\n wants.xml { render :xml => @picture, :status => :created, :location => @picture }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @picture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def run_instance options = {}\n instances = InstanceCollection.new(:config => config)\n instances.create(options.merge(:image => self))\n end",
"def create_task step, steps\n task = Rake::Task::define_task( step[ :task ] => steps.collect{ | s | s[ :task ] } ) do | task, arguments |\n tags = build_tags step, steps\n\n if cloud.exists? tags\n puts \"image \\'#{step[ :name ]}\\' already up to date and exists:\"\n tags.each{ | key, value | puts \"\\'#{key}\\' => \\'#{value}\\'\" } \n else\n puts \"starting instance for: \\'#{step[ :name ]}\\'\"\n instance = cloud.start_instance initial_image_id( step, steps )\n puts \"instance for: \\'#{step[ :name ]}\\' started.\"\n\n begin\n dns_name = cloud.dns_name instance\n expand_step = step.dup.merge( setup_name: expand_path( step[ :setup_name ] ) )\n expand_step[ :tags ] = tags \n \n puts \"excuting installation for: \\'#{step[ :name ]}\\'\"\n setup.execute expand_step, dns_name \n puts \"installation for: \\'#{step[ :name ]}\\' done.\"\n\n puts \"storing image for: \\'#{step[ :name ]}\\'\"\n cloud.store_image instance, tags\n puts \"image for: \\'#{step[ :name ]}\\' stored\"\n rescue\n cloud.stop_instance instance\n raise\n end \n end \n end\n\n task.add_description( step[ :description ] ) if step.key? :description\n task\n end",
"def test05()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage_a05.jpg\"\n begin\n # Create the object that will contain the list of commands.\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # Create the name for the importer object.\n importerName = SecureRandom.uuid\n \n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n theCommands.add_command(createImporterCommand)\n\n # Create the image importer object id so we can refer to it later on.\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n\n # Get the dimensions of the image at image index 0 in the image file.\n # So we can calculate how big the bitmap context can be.\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n\n # Create the bitmap context object command but first make the name\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n width: imageDimensions[:width],\n height: imageDimensions[:height],\n name: bitmapContextName)\n\n # Add the create bitmap context to the list of commands\n theCommands.add_command(createBitmapContextCommand)\n\n # Create the bitmapcontext object id so we can refer to it later on.\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n\n # Prepare for the draw element action.\n # The draw element action will draw a rotated image into the bitmapcontext\n width = imageDimensions[:width] * 0.5\n height = imageDimensions[:height] * 0.5\n x = width * 0.5\n y = height * 0.5\n theSize = MIShapes.make_size(width, height)\n theOrigin = MIShapes.make_point(x, y)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n drawImageElement.contextalpha = 0.5\n contextTransform = MITransformations.make_contexttransformation()\n MITransformations.add_translatetransform(contextTransform,\n { :x => width, :y => height })\n MITransformations.add_rotatetransform(contextTransform, Math::PI / 4.0)\n MITransformations.add_translatetransform(contextTransform,\n { :x => -width, :y => -height })\n drawImageElement.contexttransformations = contextTransform\n\n # Create the drawelement command.\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n\n # Add the draw element command to the list of commands.\n theCommands.add_command(drawCommand)\n\n # Prepare for creating the image exporter object command\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n # tempFile = File.join($compareImageDir, baseImageName)\n imageExporterName = SecureRandom.uuid\n \n # Make the image file export object command.\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n \n # Make the add an image to the exporter object command.\n addImageToExporterCommand = CommandModule.make_addimage(\n exporterObject, bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n \n # Make the do export command\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n\n # Add close object commands to the cleanup command list.\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n\n # now actually carry out the commands.\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n unless tempFile.nil?\n FileUtils.rm_f(tempFile)\n # Open3.capture2(\"open\", tempFile)\n # Open3.capture2(\"open\", origFile)\n end\n end\nend",
"def test03()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage2.jpg\"\n begin\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n importerName = SecureRandom.uuid\n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n theCommands.add_command(createImporterCommand)\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n size: imageDimensions,\n name: bitmapContextName)\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n theCommands.add_command(createBitmapContextCommand)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n\n theSize = MIShapes.make_size(imageDimensions[:width] * 0.5,\n imageDimensions[:height] * 0.5)\n theOrigin = MIShapes.make_point(imageDimensions[:width] * 0.25,\n imageDimensions[:height] * 0.25)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n affineTransform = MITransformations.make_affinetransform(\n m11: 0.707, m12: 0.707, m21: -0.707,\n m22: 0.707, tX: 373.74, tY: -221.29)\n drawImageElement.affinetransform = affineTransform\n # With the draw element put together, now create the draw element command\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n theCommands.add_command(drawCommand)\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n imageExporterName = SecureRandom.uuid\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n addImageToExporterCommand = CommandModule.make_addimage(exporterObject, \n bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n puts \"The result is: \" + theResult unless theResult.length.zero?\n\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile, 0)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n # Open3.capture2(\"open\", origFile)\n # Open3.capture2(\"open\", tempFile)\n # FileUtils.rm_f(tempFile) unless tempFile.nil?\n end\nend",
"def create_advanced\n image_service = ImageGeneratingService.new(self, 'Advanced.jpg', 'image/jpeg', 69)\n output_path = image_service.generate\n original_size_mb = File.size(output_path).to_f / 2**20\n if original_size_mb > 1.0\n image_service.generate_resized(1200)\n end\n end",
"def generate\n super\n end",
"def run\n super\n\n uri = _get_entity_attribute \"name\"\n filename = \"screenshot_#{rand(100000000000000)}.png\"\n full_path = \"#{Dir.pwd}/public/screenshots/#{filename}\"\n\n begin\n @task_log.log \"Saving to... #{full_path}\"\n\n f = Screencap::Fetcher.new(uri)\n screenshot = f.fetch(\n :output => full_path, # don't forget the extension!\n # optional:\n #:div => '.header', # selector for a specific element to take screenshot of\n #:width => 1024,\n #:height => 768,\n #:top => 0, :left => 0, :width => 100, :height => 100 # dimensions for a specific area\n )\n\n @task_log.good \"Saved to #{full_path}\"\n _create_entity \"Screenshot\", :name => \"#{uri}_screenshot\", :uri => \"#{$intrigue_server_uri}/screenshots/#{filename}\"\n\n rescue Screencap::Error => e\n @task_log.error \"Unable to capture screenshot: #{e}\"\n end\n\n end",
"def generate\n raise \"must implement\"\n end",
"def log_create_for(object)\n object.log(:log_image_created, name: log_name, touch: true)\n end",
"def snap()\n \n end",
"def test02()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage.jpg\"\n begin\n # Create the object that will contain the list of commands.\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # Create the name for the importer object.\n importerName = SecureRandom.uuid\n \n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n theCommands.add_command(createImporterCommand)\n\n # Create the image importer object id so we can refer to it later on.\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n\n # Get the dimensions of the image at image index 0 in the image file.\n # So we can calculate how big the bitmap context can be.\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n\n # Create the bitmap context object command but first make the name\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n width: imageDimensions[:width],\n height: imageDimensions[:height],\n name: bitmapContextName)\n\n # Add the create bitmap context to the list of commands\n theCommands.add_command(createBitmapContextCommand)\n\n # Create the bitmapcontext object id so we can refer to it later on.\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n\n # Prepare for the draw element action.\n # The draw element action will draw a rotated image into the bitmapcontext\n width = imageDimensions[:width] * 0.5\n height = imageDimensions[:height] * 0.5\n x = width * 0.5\n y = height * 0.5\n theSize = MIShapes.make_size(width, height)\n theOrigin = MIShapes.make_point(x, y)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n contextTransform = MITransformations.make_contexttransformation()\n MITransformations.add_translatetransform(contextTransform,\n { :x => width, :y => height })\n MITransformations.add_rotatetransform(contextTransform, Math::PI / 4.0)\n MITransformations.add_translatetransform(contextTransform,\n { :x => -width, :y => -height })\n drawImageElement.contexttransformations = contextTransform\n\n # Create the drawelement command.\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n\n # Add the draw element command to the list of commands.\n theCommands.add_command(drawCommand)\n\n # Prepare for creating the image exporter object command\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n imageExporterName = SecureRandom.uuid\n \n # Make the image file export object command.\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n \n # Make the add an image to the exporter object command.\n addImageToExporterCommand = CommandModule.make_addimage(\n exporterObject, bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n \n # Make the do export command\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n\n # Add close object commands to the cleanup command list.\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n\n # now actually carry out the commands.\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n unless tempFile.nil?\n FileUtils.rm_f(tempFile)\n # Open3.capture2(\"open\", origFile)\n # Open3.capture2(\"open\", tempFile)\n end\n end\nend",
"def start\n create('start')\n end",
"def create_qrcode\n\n end",
"def generate_on_upload\n {\n transformation: [\n resize_base_image\n ]\n }\n end",
"def generate\n raise NotImplementedError\n end",
"def generate\n raise NotImplementedError\n end",
"def create\n reservation_id = SecureRandom.uuid\n\n Reservation::Worker::Process.perform_async(reservation_id, Time.zone.now.to_i, reservation_params)\n\n render json: { reservation_id: reservation_id }, status: 200\n end",
"def create(*)\n super.tap do\n submission.set_simulation(__method__) if simulating\n end\n end",
"def generate\n @store.save\n end",
"def snapshot()\n puts \"TODO\"\n end",
"def create_backup_photo_for_real\n returning(new_backup_photo) do |p|\n p.backup_photo_album = create_backup_photo_album(:backup_source => create_backup_source)\n p.save\n # Setup source file and stub url\n File.cp File.dirname(__FILE__) + '/../../public/images/bigtest.jpg', \n @tempfile = ActiveSupport::TestCase.fixture_path + 'crap.jpg'\n p.stubs(:source_url).returns(@tempfile)\n end\n end",
"def snapshot_every_n_requests; end",
"def snapshot_every_n_requests=(_arg0); end",
"def create_snapshot(name)\n Fission::Action::Snapshot::Creator.new(self).create_snapshot(name)\n end",
"def create_profile_photo\n randomPhotoIndex = 1 + rand(10)\n p = self.profile_photos.create\n p.remote_photo_url = 'http://ragatzi.s3.amazonaws.com/uploads/profile_default_' + randomPhotoIndex.to_s + '.png'\n p.save! \n end",
"def generate_id\n id_generator.call\n end",
"def take_a_snapshot\n raise NotImplementedError\n end",
"def create image_url, page_url, x, y, h, w\n #@img = Img.create(image_url: image_url, page_url: page_url, x: x, y: y, h: h, w: w)\n end",
"def create\n @game_object_metum = GameObjectMetum.new(game_object_metum_params)\n @game_object_metum.game = @game\n front_img = MiniMagick::Image.new(game_object_metum_params[:front_img].path)\n @game_object_metum.width = front_img.width\n @game_object_metum.height = front_img.height\n\n respond_to do |format|\n if @game_object_metum.save\n @game_object_metum.dev_room.messages.create(level: :info, content: \"#{current_user.username}创建了元物件\\\"#{@game_object_metum.name}\\\".\")\n ActionCable.server.broadcast(@game_object_metum.stream, action: :new_meta, meta: @game_object_metum)\n format.html { redirect_to game_object_meta_new_path, notice: 'Game object metum was successfully created.' }\n format.json { render :show, status: :created, location: game_game_object_metum_path(@game, @game_object_metum) }\n else\n format.html { render :new }\n format.json { render json: @game_object_metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_image\n code = string_generator.generate\n encrypted_code = encrypt(code)\n\n image_filename = \"#{encrypted_code}#{image_generator.file_extension}\"\n image_path = File.join(filesystem_dir, image_filename)\n image_bytes = image_generator.generate(code)\n\n File.open image_path, 'w' do |os|\n os.write image_bytes\n end\n\n return image_path, code\n end",
"def create\n @graph = Graph.where(id: graph_params[:id]).first\n if @graph\n @graph.update(graph_params)\n else\n @graph = Graph.new(graph_params.merge(users_id: @user.id))\n end\n\n #DownWorker.perform_async(@graph['image_link'])\n\n #respond_to do |format|\n if @graph.save\n render json: @graph\n else\n render json: @graph.errors, status: :unprocessable_entity\n end\n #end\n end",
"def build_image\n\n build_image = self.clone\n\n build_image.listeners = [$ll = LogfileListener.new(\"build_#{@name}\"), BuildProfilerListener.new]\n build_image.filters = [IgnoreOutputFilter.new, OutputTimestamperFilter.new] if not Rake::application.options.trace\n\n exit_code = build_image.run \"build_#{@name}\"\n\n fail \"build failed: runalias.exe returned #{exit_code}\" if exit_code != 0\n end",
"def create(options={},&block)\n run_task(MP4CreatorTask.new(options,&block))\n end",
"def create \n @image ||= Image.new(image_params)\n if @image.save\n render json: {\"url\" => @image.image_url(:resized), \"success\" => true}\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def initialize\n @managerName = nil\n @imageName = nil\n @running = nil\n @@instantiated = true\n end",
"def testsnapshot(onwindow: false)\n baseImageName = \"AfterDrawSnapshot.jpg\"\n begin\n # 1. Create window or bitmap context. width: 800, height: 600\n bitmapObject = if onwindow\n SmigHelpers.create_window(width: 800, height: 600)\n else\n SmigHelpers.create_bitmapcontext(width: 800, height: 600)\n end\n\n # 2. Try and draw a snapshot\n didThrow = false\n begin\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n rescue RuntimeError => e\n # 3. Take note that drawing the snapshot failed.\n didThrow = true\n end\n\n # 3. Continued. Raise an exception if snapshot failed & exception not thrown\n unless didThrow\n raise \"Draw shapshot should have failed as no snapshot has been taken\"\n end\n\n if onwindow\n # Need to initialize the window to having a white background.\n windowRect = MIShapes.make_rectangle(size:{ :width => 800,\n :height => 600 },\n origin: { :x => 0, :y => 0 } )\n whiteColor = MIColor.make_rgbacolor(1.0, 1.0, 1.0)\n drawBackgroundElement = MIDrawElement.new(:fillrectangle)\n drawBackgroundElement.rectangle = windowRect\n drawBackgroundElement.fillcolor = whiteColor\n drawBackgroundCommand = CommandModule.make_drawelement(bitmapObject, \n drawinstructions: drawBackgroundElement)\n Smig.perform_command(drawBackgroundCommand)\n end\n\n # 4. Draw some stuff into the bitmap context.\n points = []\n points.push(MIShapes.make_point(100, 50))\n points.push(MIShapes.make_point(700, 50))\n points.push(MIShapes.make_point(400, 550))\n newPath = MIPath.new\n newPath.add_triangle(points: points)\n drawElement = MIDrawElement.new(:fillpath)\n drawElement.fillcolor = MIColor.make_rgbacolor(0.8, 0.2, 0.1)\n drawElement.arrayofpathelements = newPath\n drawElement.startpoint = points[0]\n drawElementCommand = CommandModule.make_drawelement(bitmapObject, \n drawinstructions: drawElement)\n Smig.perform_command(drawElementCommand)\n # 5. Take a snapshot\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :takesnapshot))\n # 6. Draw the snapshot into the bitmap context.\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n # 7. Draw some more stuff into it\n points = []\n points.push(MIShapes.make_point(100, 550))\n points.push(MIShapes.make_point(700, 550))\n points.push(MIShapes.make_point(400, 50))\n newPath = MIPath.new\n newPath.add_triangle(points: points)\n drawElement = MIDrawElement.new(:fillpath)\n drawElement.fillcolor = MIColor.make_rgbacolor(0.2, 0.7, 0.1)\n drawElement.arrayofpathelements = newPath\n drawElement.startpoint = points[0]\n drawElementCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawElement)\n Smig.perform_command(drawElementCommand)\n # 8. Export an image from the bitmap\n tempFile2 = File.join(Dir.tmpdir(), \"BeforeSnapshot.jpg\")\n SmigHelpers.save_image(imagesource: bitmapObject, pathtofile: tempFile2)\n # 9. Draw the snap shot into the bitmap context\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n # 10. Save the bitmap context to an image file.\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n SmigHelpers.save_image(imagesource: bitmapObject, pathtofile: tempFile)\n origFile = File.join($compareImageDir, baseImageName)\n\n unless AreImageFilesSame(origFile, tempFile)\n # 11. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \"Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n Smig.close_object_nothrow(bitmapObject)\n# `open #{tempFile}`\n# `open #{tempFile2}`\n# `open #{origFile}`\n FileUtils.rm_f(tempFile)\n FileUtils.rm_f(tempFile2)\n end\nend",
"def start()\n\t\t_start\n\t\tpossibly_self_provision()\n\tend",
"def perform\n @bitmap.width = @x_axis\n @bitmap.height = @y_axis\n @bitmap.generate_pixels\n end"
] |
[
"0.6473505",
"0.6185129",
"0.6088528",
"0.6026558",
"0.59738034",
"0.5969435",
"0.5946117",
"0.5837913",
"0.5803837",
"0.57497644",
"0.5741899",
"0.5731147",
"0.57152545",
"0.56883013",
"0.5672436",
"0.56591755",
"0.56484574",
"0.5623527",
"0.56118107",
"0.5593125",
"0.5584406",
"0.5578798",
"0.55669355",
"0.5566841",
"0.55552626",
"0.5526649",
"0.55225825",
"0.55210334",
"0.5517221",
"0.5514867",
"0.5465162",
"0.5465162",
"0.54506993",
"0.5447713",
"0.54261464",
"0.5417733",
"0.540586",
"0.53840107",
"0.53837115",
"0.53605664",
"0.53562057",
"0.5346389",
"0.5343161",
"0.5336916",
"0.5293868",
"0.5289446",
"0.52817875",
"0.52689755",
"0.5263521",
"0.5251665",
"0.5249893",
"0.52485454",
"0.52379376",
"0.52357656",
"0.52284795",
"0.5224683",
"0.5221131",
"0.5215302",
"0.5212572",
"0.52122736",
"0.5209407",
"0.51860857",
"0.5183085",
"0.51678467",
"0.51576334",
"0.51372933",
"0.513472",
"0.5128615",
"0.5123867",
"0.5121347",
"0.5119176",
"0.51191396",
"0.5118895",
"0.511185",
"0.51105475",
"0.51035315",
"0.50939053",
"0.5093849",
"0.5089099",
"0.5087543",
"0.508208",
"0.50800025",
"0.5077802",
"0.5076655",
"0.50760704",
"0.5073578",
"0.5071482",
"0.50708157",
"0.50697494",
"0.5068899",
"0.506503",
"0.50611013",
"0.5058086",
"0.50570065",
"0.5054798",
"0.50533587",
"0.5052359",
"0.50512683",
"0.504339",
"0.5031891"
] |
0.6741161
|
0
|
not currently working (needs exact match)
|
def search
@maps = Map.find_map_by_input(@maps, params[:name])
render json: @maps
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def match; end",
"def match; end",
"def case_insensitive_match; end",
"def match(p0) end",
"def match(p0) end",
"def case_insensitive_match=(_arg0); end",
"def pre_match() end",
"def test_strict_match_criteria\n entry = BigramEntry.new\n entry.parse_line(\"8\t工作\t18904\t6.89133239246\t213454\")\n cedict_entry = CEdictEntry.new\n cedict_entry.parse_line(\"工作 工作 [gong1 zuo4] /job/work/construction/task/CL:個|个[ge4],份[fen4],項|项[xiang4]/\")\n \n result = entry.default_match_criteria.call(cedict_entry,entry)\n assert(true,result)\n end",
"def match_query(query); end",
"def match(keyword); end",
"def matcher; end",
"def matcher; end",
"def match(pattern); end",
"def match(input); end",
"def post_match() end",
"def match\n true\n end",
"def match(input)\n input \n end",
"def submatcher; end",
"def submatcher; end",
"def test_match_case_sensitive_within\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.within = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,10)\r\n\t\tassert_equal(13, match,\"no match on content with within.\") #13 pos of second MyMatch\r\n\tend",
"def fnmatch(matcher); end",
"def test_match_case_sensitive_within_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"1234MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.within = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with within.\")\r\n\tend",
"def test_match_case_sensitive_distance\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 1\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,4)\r\n\t\tassert_equal(13, match,\"no match on content with distance.\") #13 position of second MyMatch\r\n\tend",
"def test_match_case_sensitive\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content.\")\r\n\tend",
"def matches(_ext); end",
"def matches(_ext); end",
"def test_match_case_sensitive_binary_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string doesnt contains a match on: My\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"M|79|Mat|63 68|123\" #equals MyMatch123\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"case sensitive match on no match content.\")\r\n\tend",
"def match?(name); end",
"def exact_match_string\n @matches.nil? ? nil : @matches[0]\n end",
"def match()\n end",
"def matches(ext); end",
"def exact_match\n @solr_data[:exact_match]\n end",
"def match(object); end",
"def test_match_case_sensitive_offset\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 3\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with offset.\")\r\n\tend",
"def test_match_case_sensitive_distance_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 11\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,4),\"incorrect match on content with distance.\")\r\n\tend",
"def match=(_); end",
"def test_match_nocase\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(62, match,\"no case insensitive match on content.\")\r\n\tend",
"def matched\n match.to_s if matched?\n end",
"def stop_if_match; true; end",
"def match(regexp); end",
"def test_match_case_sensitive_offset_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 4\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with offset.\")\r\n\tend",
"def strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend",
"def fnmatch?(matcher); end",
"def create_match(nominee)\n names = []\n pname = nominee[:name]\n names << pname\n names << pname.sub(%r{ [A-Z]\\. }, ' ') # drop initial\n personname = ASF::Person.find(nominee[:id]).public_name\n names << personname if personname\n list = names.uniq.map{|name| Regexp.escape(name)}.join('|')\n # N.B. \\b does not match if it follows ')', so won't match John (Fred)\n # TODO: Work-round is to also look for EOS, but this needs to be improved\n %r{\\b(#{list})(\\b|$)}i\nend",
"def pre_match\n end",
"def match\n @match\n end",
"def test_match_case_sensitive_depth_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.depth = 9\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with depth.\")\r\n\tend",
"def test_match_case_sensitive_depth\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.depth = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with depth.\")\r\n\tend",
"def test_match_case_sensitive_no_match\r\n\t\t#content with case insensitive, but not case sensitive match\r\n\t\tcontent = \"first line.\\nthis string doesn not contain a case insensitive match on: mymatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect case sensitive match on content.\")\r\n\tend",
"def exact_match?\n !partial_match?\n end",
"def matching_the_word_and\n /WRITE ME/\n end",
"def file_match(file)\n end",
"def article_match? (query, article_title)\n found = false\n return true if query.empty?\n temp_article = article_title.downcase\n query.each do |kw|\n pattern = Regexp.new /.*#{kw.downcase}.*/\n found = true if temp_article =~ pattern\n end\n found\nend",
"def matcher_name; end",
"def matcher_name; end",
"def match?(name, literal) true end",
"def exact_match?(name1:, name2:)\n return false unless name1.present? && name2.present?\n\n a = name_without_alias(name: name1.downcase)\n b = name_without_alias(name: name2.downcase)\n a == b\n end",
"def test_match_case_sensitive_special_char\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: My(Match123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"My(Match123\" \r\n\t\tsnort_rule_content.nocase = false\r\n\t\t\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content with special char.\")\r\n\tend",
"def match_to_regex(match, type=:fuzzy)\n match.downcase!\n if type == :exact\n /^#{match}$/\n else\n /#{match}/\n end\n end",
"def first_letter_match\n @query[0] == @reference[0]\n end",
"def allow_matcher; end",
"def include?(searchstring, substring)\n\nend",
"def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end",
"def underlying_matcher; end",
"def underlying_matcher; end",
"def on_match_pattern(node); end",
"def methods_matching(re); end",
"def matches?(pattern); end",
"def match_rawname(name, rawlist)\n rawlist.each { |r| return r if name == r }\n rawlist.each { |r| return r if name.downcase == r.downcase }\n may = rawlist.find_all { |r| r.downcase.index(name.downcase) }\n may.first if may.length == 1\n end",
"def match_rawname(name, rawlist)\n rawlist.each { |r| return r if name == r }\n rawlist.each { |r| return r if name.downcase == r.downcase }\n may = rawlist.find_all { |r| r.downcase.index(name.downcase) }\n may.first if may.length == 1\n end",
"def test_exclusion_match_nocase_no_match\r\n\t\tcontent = \"first line.\\nthis string does not contain a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"some other string\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"nocase exclusion match on content didnt fire.\")\t\r\n\tend",
"def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end",
"def return_match\n\t\treturn @matched\n\tend",
"def matcher=(_arg0); end",
"def =~(p0) end",
"def =~(p0) end",
"def =~(p0) end",
"def set_match\n\t\t@matched = true\n\tend",
"def matches?(value, context); end",
"def matchText(fieldName, expectedText, actualText)\n expectedText = expectedText.gsub(\" \", \"\")\n expectedText = expectedText.gsub(\"-\", \"\")\n actualText = actualText.gsub(\" \", \"\")\n actualText = actualText.gsub(\"-\", \"\")\n\n if (actualText.downcase.include? (expectedText.downcase))\n puts expectedText + ' is matched with ' + actualText\n else\n raise 'Expected profile '+fieldName+' is ' + expectedText + ' but found ' + actualText\n end\n end",
"def bubble_up_exact_matches(affil_list:, term:)\n matches_at_beginning = []\n matches_within = []\n other_items = []\n match_term = term.downcase\n affil_list.each do |affil_item|\n name = affil_item[:name].downcase\n if name.start_with?(match_term)\n matches_at_beginning << affil_item\n elsif name.include?(match_term)\n matches_within << affil_item\n else\n other_items << affil_item\n end\n end\n matches_at_beginning + matches_within + other_items\n end",
"def test_exclusion_match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect case sensitive exclusion match on content.\")\r\n\tend",
"def exact_match(user_word)\n @loader.arr.each do |word|\n return word if word == user_word\n end\n end",
"def exact_match?\r\n warning.nil?\r\n end",
"def exact_match?\r\n warning.nil?\r\n end",
"def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string does not contain a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"case sensitive exclusion match on content didnt fire.\")\t\r\n\tend",
"def match_by_email\n true\n end",
"def test_string_matcher\n ngram_builder = SimString::NGramBuilder.new(3)\n db = SimString::Database.new(ngram_builder)\n\n db.add(\"Barack Hussein Obama II\")\n db.add(\"James Gordon Brown\")\n\n matcher = SimString::StringMatcher.new(db, SimString::CosineMeasure.new)\n\n assert_equal([], matcher.search(\"Barack Obama\", 0.6))\n assert_equal([\"James Gordon Brown\"], matcher.search(\"Gordon Brown\", 0.6))\n assert_equal([], matcher.search(\"Obama\", 0.6))\n assert_equal([], matcher.search(\"Obama\", 1, SimString::OverlapMeasure.new))\n assert_equal([], matcher.search(\"Barack Hussein Obama I\", 1, SimString::OverlapMeasure.new))\n assert_equal([\"Barack Hussein Obama II\"], matcher.search(\"Barack Hussein Obama II\", 1, SimString::OverlapMeasure.new))\n assert_equal([\"Barack Hussein Obama II\"], matcher.search(\"Obama\", 0.42, SimString::OverlapMeasure.new))\n assert_equal([], matcher.search(\"Obama\", 0.43, SimString::OverlapMeasure.new))\n end",
"def match?(given_names); end",
"def fuzzy_match\n return unless @keywords.any?\n\n @matches = fuzz_ball.load.find @keywords.join(\" \"), @options[:limit]\n @query = Ydl::Videos\n return if @matches.empty?\n\n # @matches.map! do |match|\n # match.push (match[1]/match[2].to_f * 100).to_i\n # end if @matches.any?\n\n @query = Ydl::Videos.with_pk_in(@matches.map(&:first))\n end",
"def maybe_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 1\nend",
"def on_match_pattern_p(node); end",
"def test_string_match\n s = \"a\"\n assert_equal(0, string_match(\"a\", s))\n assert_equal(0, string_match(/a/, s))\n assert_equal(0, string_match('\\(a\\|\\b\\)', s))\n assert_equal(0, string_match(/a|b/, s))\n assert_equal(0, string_match(/^a/, s))\n assert_equal(0, string_match(/a$/, s))\n assert_equal(0, string_match(/.*/, s))\n assert_equal(nil, string_match(/not-match/, s))\n \n end",
"def found_exact?\n @found_exact\n end",
"def test_find_matches\n @fdb = setup\n @list = @fdb.find_matches(\"Ch\")\n assert(@list.length >= 2, \"Expected at least 2 entries to be found, didn't get that much\")\n end",
"def exact_match?\n search_settings = @settings['search']\n matching = search_settings.fetch('matching', 'pattern').normalize_matching\n matching == :exact\n end",
"def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end",
"def on_matched\n end",
"def element_match(tree, exp, bindings); end",
"def matches\n parse\n end",
"def match(candidates)\n\t\tself.downcase(candidates)\n\t\t@ed.match(candidates)\n\tend"
] |
[
"0.7495227",
"0.7495227",
"0.7449106",
"0.7285074",
"0.7285074",
"0.718046",
"0.70803255",
"0.7033444",
"0.7021869",
"0.7007506",
"0.69651055",
"0.69651055",
"0.6934304",
"0.6929482",
"0.68655473",
"0.686213",
"0.67753726",
"0.6746277",
"0.6746277",
"0.6727391",
"0.670263",
"0.67020994",
"0.66929036",
"0.667129",
"0.6666976",
"0.6666976",
"0.666591",
"0.6636684",
"0.663373",
"0.66239095",
"0.65927994",
"0.6573072",
"0.6501865",
"0.64975834",
"0.64862126",
"0.6482005",
"0.6441075",
"0.6432742",
"0.6420607",
"0.64072984",
"0.6402432",
"0.6390469",
"0.6383011",
"0.6368632",
"0.6368492",
"0.6365446",
"0.6362996",
"0.63476574",
"0.633776",
"0.63229245",
"0.62729895",
"0.6253354",
"0.6213075",
"0.61871475",
"0.61871475",
"0.6183102",
"0.61372346",
"0.6128498",
"0.6126021",
"0.61120427",
"0.6106868",
"0.6104681",
"0.610245",
"0.61018026",
"0.61018026",
"0.6094899",
"0.60730135",
"0.60685426",
"0.60680634",
"0.60680634",
"0.6057104",
"0.6041462",
"0.6041142",
"0.60388017",
"0.6037404",
"0.6037404",
"0.6037404",
"0.60372204",
"0.60365736",
"0.603624",
"0.60273325",
"0.60249144",
"0.60119534",
"0.6010753",
"0.6010753",
"0.59984976",
"0.598066",
"0.5978292",
"0.5958921",
"0.5954531",
"0.59532726",
"0.5951678",
"0.59411985",
"0.59339345",
"0.59337574",
"0.591349",
"0.58907765",
"0.58644485",
"0.58627385",
"0.5859751",
"0.58575433"
] |
0.0
|
-1
|
Initialize from an XML element (from REXML).
|
def initialize(xml_elem)
@name = xml_elem.attributes['name']
@num_bins = xml_elem.attributes['num-bins'].to_i
@range_min = xml_elem.attributes['min'].to_f
@range_max = xml_elem.attributes['max'].to_f
@title = xml_elem.attributes['title']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize_from_element!\n end",
"def initialize(*args)\n\t\t\t@elements = []\n\t\t\tload_xml(args[0]) if args[0].kind_of? REXML::Element\n\t\tend",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def from_xml_elem(ctx, root)\n #p [:from_xml_elem, :ctx, root]\n attributes = root.attributes.inject({ }) { |hash, (k, v)| hash[k] = EscapeXML.unescape(v.to_s); hash}\n text, children = root.children.partition{ |x| text_node?(x) }\n text = text.map{ |x| x.to_s}.reject{ |s| s =~ /^\\s*$/}.join('')\n element_name = root.name\n if element_name !~ /[A-Z]/\n element_name = Doodle::Utils.camel_case(element_name)\n end\n klass = Utils.const_lookup(element_name, ctx)\n #p [:creating_new, klass, text, attributes]\n #p [:root1, root]\n # don't pass in empty text - screws up when class has only\n # child elements (and no attributes) because tries to\n # instantiate child element from empty string \"\"\n if text == \"\"\n text = nil\n end\n args = [text, attributes].compact\n oroot = klass.new(*args) {\n #p [:in_block]\n from_xml_elem(root)\n }\n #p [:oroot, oroot]\n oroot\n end",
"def initialize_element\n end",
"def initialize elem\n\t\t\t@item_elem = elem\n\t\t\tparse_item\n\t\tend",
"def load_xml(str)\r\n @xml = REXML::Document.new(str.to_s)\r\n xml_to_instance\r\n self\r\n end",
"def initialize_xml(xml, root_element)\n @xml = XMLElement.build_xml(xml, root_element)\n\n if OpenNebula.is_error?(@xml)\n @xml = nil\n else\n if NOKOGIRI\n if @xml.size == 0\n @xml = nil\n end\n else\n if @xml.name != root_element\n @xml = nil\n end\n end\n end\n @xml\n end",
"def initialize(elem)\n @element = elem\n end",
"def from_xml(xml)\n\t\tend",
"def initialize(xml_elem, xrc_file)\n @xml_src = xml_elem\n @file_name = xrc_file\n\n @base_id = xml_elem.attributes['name']\n @wx_class = xml_elem.attributes['class']\n @sub_class = xml_elem.attributes['subclass']\n @controls = []\n read_controls\n end",
"def initialize(run, xml)\n @run = run\n\n parse_xml(xml)\n end",
"def initialize(element)\n @element = element\n @name = element.name\n end",
"def from_xml(*args, &block)\n create_represented(*args, &block).from_xml(*args)\n end",
"def from_xml_node(parent, opts=OPTS)\n new.from_xml_node(parent, opts)\n end",
"def initialize(run, xml)\n super(run, xml)\n\n @error = false\n @structure = parse_data(xml_first_child(xml))\n\n # cached outputs\n @values = nil\n @refs = nil\n @types = nil\n @sizes = nil\n @total_size = nil\n end",
"def initialize(element)\n @html_string = element\n element = valid_tag(element) unless element.is_a? Array\n case element[0]\n when :start_element\n @name = element[2]\n @attributes = element[3]\n @children = (Array(element[4..-1]) || []).map {|c | TestTag.new c}\n when :text\n @text = element[1]\n @name = \"text\"\n @attributes = []\n @children = []\n end\n\n end",
"def read_xml_element(x)\n return if x.is_a? Nokogiri::XML::Text\n return unless namespace?(x)\n if flatten?(x)\n parse_xml(x.child)\n elsif type = attribute_type(x)\n set_attribute(x) { type.new(x, self) }\n else\n set_attribute(x) { xml_text_to_value(x.text) }\n end\n end",
"def initialize(xml_node, instance: nil)\n @xml_node = xml_node\n @instance = instance\n end",
"def from_xml(data, *args)\n xml = Nokogiri::XML::Node.from(data)\n\n create_from_xml(*args).tap do |inst|\n refs = representable_attrs.map {|attr| XML.binding_for_definition(attr) }\n \n refs.each do |ref|\n value = ref.value_in(xml)\n \n inst.send(ref.definition.setter, value)\n end\n end\n end",
"def init_from_xml(xmlDoc)\r\n @type = xmlDoc.expanded_name\r\n xmlDoc.each_element(\"ID\") { |e| @procID = e.text }\r\n xmlDoc.each_element(\"GROUP\") { |e| @group = e.text }\r\n xmlDoc.each_element(\"PATH\") { |e| @path = e.text }\r\n xmlDoc.each_element(\"ARGSLINE\") { |e| @cmdLineArgs = e.text }\r\n xmlDoc.each_element(\"ENV\") { |e| @env = e.text }\r\n # Dump the XML description of the OML configuration into a file\r\n xmlDoc.each_element(\"OML_CONFIG\") { |config|\r\n configPath = nil\r\n config.each_element(\"omlc\") { |omlc|\r\n configPath = \"/tmp/#{omlc.attributes['exp_id']}-#{@procID}.xml\"\r\n }\r\n f = File.new(configPath, \"w+\")\r\n config.each_element {|el|\r\n f << el.to_s\r\n }\r\n f.close\r\n # Set the OML_CONFIG environment with the path to the XML file\r\n @env << \" OML_CONFIG=#{configPath} \"\r\n }\r\n end",
"def from_xml(xml)\n @xml = xml\n self.before_from_xml if defined?(before_from_xml)\n from_xml_via_map(@xml)\n end",
"def from_xml(xml)\n b = xml.at(\"//xmlns:bibitem|//xmlns:bibdata\")\n r = mn2relaton_parser(xml.root.name)\n r.from_xml(b.to_xml)\n end",
"def parse_xml(xml)\n new from_xml(xml)\n end",
"def initialize(element)\n set_methods_from_attributes(element)\n set_method_from_text(element)\n update_class_list_variable(element)\n end",
"def initialize(element_type)\n @element_type = element_type\n end",
"def from_xml(xml, opts=OPTS)\n from_xml_node(Nokogiri::XML(xml).children.first, opts)\n end",
"def initialize(element_type)\n @element_type = check_arg_type(element_type, 'element_type')\n end",
"def initialize(item_row_element, arg_bib)\n\t\t\t@bib = arg_bib\n\t\t\tloadFromItemRowElement(item_row_element)\n\t\tend",
"def initialize(element, attributes = {})\n @element = element\n @attributes = Saxxy::Helpers.stringify_keys(attributes)\n end",
"def initialize(xmldata=\"\")\n setPerson(xmldata)\n end",
"def initialize(xml)\n @xml = xml.to_s\n @id = xml.at('id').inner_html\n @updated = DateTime.parse(xml.at('updated').inner_html)\n @title = xml.at('title').inner_html\n @dimensions = xml.search('dxp:dimension').collect do |dimension|\n { dimension.attributes['name'].split(':').last.to_sym => dimension.attributes['value'].split(':', 1).last }\n end\n @metrics = xml.search('dxp:metric').collect do |metric|\n { metric.attributes['name'].split(':').last.to_sym => metric.attributes['value'].split(':', 1).last.to_i }\n end\n end",
"def initialize(data, changeset)\n @reader = XML::Reader.string(data)\n @changeset = changeset\n # document that's (re-)used to handle elements expanded out of the\n # diff processing stream.\n @doc = XML::Document.new\n @doc.root = XML::Node.new(\"osm\")\n end",
"def load_from_xml(node)\n # Get all information from the root's children nodes\n node.children.each do |child|\n case child.name.to_s\n when 'id'\n @id = child.content.to_i\n when 'title'\n @title = child.content\n when 'image'\n check_image_node(child)\n when 'date'\n @date = Time.parse(child.content)\n when 'streamable'\n check_streamable_node(child)\n when 'size'\n @size = child.content.to_i\n when 'description'\n @description = child.content\n when 'duration'\n @duration = child.content.to_i\n when 'creator'\n @creator = child.content\n when 'url'\n @url = child.content\n when 'text'\n # ignore, these are only blanks\n when '#text'\n # libxml-jruby version of blanks\n else\n raise NotImplementedError, \"Field '#{child.name}' not known (#{child.content})\"\n end #^ case\n end #^ do |child|\n end",
"def initialize(*args)\n super\n decorators(Nokogiri::XML::Node) << Nokogiri::Decorators::XBEL\n decorate!\n\n# self.root = '<xbel version=\"1.0\"></xbel>'\n end",
"def initialize(nokogiri_xml, client)\n @xml = nokogiri_xml.to_xml\n @client = client\n @attributes = Vebra.parse(nokogiri_xml)\n end",
"def initialize(xml = nil, edge = nil)\n scanXml(xml, edge) if(!xml.nil?) ;\n end",
"def initialize(elem)\n TstLog(\"Sequence: #{elem}\")\n @offset = elem.offset\n @length = elem.length\n @elements = [elem]\n end",
"def initialize(message, element_type, element_name, element)\n @message = message\n @element_type = element_type\n @element_name = element_name\n @element = element\n end",
"def initialize(element, parent)\n super(element, parent)\n end",
"def initialize(o)\r\n @xml = o\r\n \r\n # map element names to methods, prolly not the best way to do this\r\n @xml.elements.each do |e|\r\n Mb_obj.class_eval(\"def #{e.name.to_s}() REXML::XPath.first(self.xml, \\\"#{e.name.to_s}).text\\\").text end\") \t \r\n end\r\n end",
"def initialize(xml)\n @source = isxml?(xml) ? xml : File.read(xml)\n @doc_stream = AltoDocStream.new\n parser = Nokogiri::XML::SAX::Parser.new(doc_stream)\n parser.parse(@source)\n end",
"def from_xml(xml)\n hash = Hash.from_xml(xml).values.first\n self.all_attributes = hash\n end",
"def start_element(element, attributes = [])\n\t\t\t\t@tag = element\n\t\t\t\t@vals[@tag] = \"\"\n\n\t\t\t\tif !@valid_elements.include?(element)\n\t\t\t\t\tputs \"New XML element detected: #{element}. Please report this to #{Kekkan::EMAIL}\"\n\t\t\t\tend\n\n\t\t\t\tcase element\n\t\t\t\t\twhen \"entry\"\n\t\t\t\t\t\t@entry = Kekkan::Models::Entry.create\n\t\t\t\t\t\t@entry.save\n\n\t\t\t\t\twhen \"vuln:cvss\"\n\t\t\t\t\t\t@cvss = @entry.cvsses.create\n\t\t\t\t\t\t@cvss.save\n\n\t\t\t\t\twhen \"vuln:cwe\"\n\t\t\t\t\t\t@entry.attributes = { :cwe => Hash[attributes][\"id\"] }\n\t\t\t\t\t\t@entry.save\n\n\t\t\t\t\twhen \"vuln:references\"\n\t\t\t\t\t\t@reference = @entry.references.create\n\t\t\t\t\t\t@reference.attributes = {\n\t\t\t\t\t\t\t:ref_type => Hash[attributes][\"reference_type\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@reference.save\n\n\t\t\t\t\twhen \"vuln:reference\"\n\t\t\t\t\t\t@reference.attributes = {\n\t\t\t\t\t\t\t:href => Hash[attributes][\"href\"],\n\t\t\t\t\t\t\t:language => Hash[attributes][\"xml:lang\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@reference.save\n\n\t\t\t\t\twhen \"vuln:assessment_check \"\n\t\t\t\t\t\t@ass = @entry.assessment_check.create\n\t\t\t\t\t\t@ass.attributes = {\n\t\t\t\t\t\t\t:name => Hash[attributes][\"name\"],\n\t\t\t\t\t\t\t:href => Hash[attributes][\"href\"],\n\t\t\t\t\t\t\t:system => Hash[attributes][\"system\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@entry.save\n\n\t\t\t\t\twhen \"vuln:definition\"\n\t\t\t\t\t\t@scanner = @entry.scanners.create\n\t\t\t\t\t\t@scanner.attributes = {\n\t\t\t\t\t\t\t:name => Hash[attributes][\"name\"],\n\t\t\t\t\t\t\t:href => Hash[attributes][\"href\"],\n\t\t\t\t\t\t\t:system => Hash[attributes][\"system\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@scanner.save\n\t\t\t\tend\n\t\t\tend",
"def initialize element, class_chain, blocks\n @element = element.dup\n # TODO: how to convert lists, tables, definition lists etc. to text\n @text = element.text\n @parent = element.parent.name\n @path = element.path\n @wrapper = BLOCK_ELEMENTS.include?(element.name) ? \\\n element.name : parent\n @class_chain = class_chain\n @blocks = blocks\n end",
"def init(element, count)\r\n self.pid = element.attributes['id']\r\n self.pitcher_name = element.attributes['name']\r\n self.out = element.attributes['out']\r\n self.inn = convert_out_to_inn(element.attributes['out'])\r\n self.er = element.attributes['er']\r\n self.r = element.attributes['r']\r\n self.h = element.attributes['h']\r\n self.so = element.attributes['so']\r\n self.hr = element.attributes['hr']\r\n self.bb = element.attributes['bb']\r\n self.w = element.attributes['w']\r\n self.l = element.attributes['l']\r\n self.era = element.attributes['era']\r\n self.note = element.attributes['note']\r\n if count == 1\r\n self.start = true\r\n else\r\n self.start = false\r\n end\r\n end",
"def initialize(parsed_element = nil)\n @name = ''\n @description = []\n @description_text = ''\n\n build_feature_element(parsed_element) if parsed_element\n end",
"def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def initialize\n\t@xml = '<?xml version=\"1.0\"?>\n<?misc:processingInstruction \"with arguments\"?>\n<?other:piNoArgs ?>\n<!DOCTYPE outer PUBLIC \"public id\" \"foobar\" [\n <!ENTITY foo \"bletch\">\n <!ELEMENT el>\n <!ATTLIST el EMPTY>\n <!NOTATION notation ignored>\n]>\n<!-- comment -->\n<outer>\n data&&foo;\nmore on next line<simpleTag>text</simpleTag>\n<inner:tag a=\"tabs\tto\tspaces&foo;\"/><![CDATA[xx<z&xx</\nnewline in cdata\n]]>\n<p>text <b>bold café coffee</b> more text</p>\n</outer>'\n\n\temptyAttrs = Hash.new()\n\t@newlineTok = NQXML::Text.new(\"\\n\")\n\n\tattrs = Hash.new()\n\tattrs['version'] = '1.0'\n\t@xmlDecl = NQXML::XMLDecl.new('xml', attrs, '<?xml version=\"1.0\"?>')\n\n\tsrc = '<?misc:processingInstruction \"with arguments\"?>'\n\t@piWithArgs =\n\t NQXML::ProcessingInstruction.new('misc:processingInstruction',\n\t\t\t\t\t '\"with arguments\"', src)\n\n\t@piNoArgs = NQXML::ProcessingInstruction.new('other:piNoArgs', '',\n\t\t\t\t\t\t '<?other:piNoArgs ?>')\n\n\t@entityTag =\n\t NQXML::GeneralEntityTag.new('foo', 'bletch', nil, nil,\n\t\t\t\t\t'<!ENTITY foo \"bletch\">')\n\t@element = NQXML::Element.new('el', '', '<!ELEMENT el>')\n\t@attlist = NQXML::Attlist.new('el', 'EMPTY', '<!ATTLIST el EMPTY>')\n\t@notation = NQXML::Notation.new('notation', 'ignored',\n\t\t\t\t\t'<!NOTATION notation ignored>')\n\t@doctypePubid =\n\t NQXML::PublicExternalID.new('\"public id\"', '\"foobar\"',\n\t\t\t\t\t'PUBLIC \"public id\" \"foobar\"')\n\t@doctype =\n\t NQXML::Doctype.new('outer', @doctypePubid,\n\t\t\t [@entityTag, @element, @attlist, @notation],\n\t\t\t \"<!DOCTYPE outer PUBLIC \\\"public id\\\" \\\"foobar\\\" [\\n\" +\n\t\t\t \" <!ENTITY foo \\\"bletch\\\">\\n\" +\n\t\t\t \" <!ELEMENT el>\\n\" +\n\t\t\t \" <!ATTLIST el EMPTY>\\n\" +\n\t\t\t \" <!NOTATION notation ignored>\\n\" +\n\t\t\t \"]>\")\n\n\t@comment = NQXML::Comment.new('<!-- comment -->')\n\t@outerStart = NQXML::Tag.new('outer', emptyAttrs, false, '<outer>')\n\t@textDataWithSub = NQXML::Text.new(\"\\n data&bletch\\nmore on next line\")\n\t@simpleTagStart = NQXML::Tag.new('simpleTag', emptyAttrs, false,\n\t\t\t\t\t '<simpleTag>')\n\t@simpleTextData = NQXML::Text.new('text')\n\t@simpleTagEnd = NQXML::Tag.new('simpleTag', nil, true, '</simpleTag>')\n\n\tattrs = Hash.new()\n\tattrs['a'] = 'tabs to spacesbletch'\n\t@innerTagStart = NQXML::Tag.new('inner:tag', attrs, false,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\n\t@innerTagEnd = NQXML::Tag.new('inner:tag', nil, true,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\t@pTagStart = NQXML::Tag.new('p', emptyAttrs, false, '<p>')\n\t@pTagEnd = NQXML::Tag.new('p', nil, true, '</p>')\n\t@bTagStart = NQXML::Tag.new('b', emptyAttrs, false, '<b>')\n\t@bTagEnd = NQXML::Tag.new('b', nil, true, '</b>')\n\t@textText = NQXML::Text.new('text ')\n\t@boldText = NQXML::Text.new('bold café coffee')\n\t@moreTextText = NQXML::Text.new(' more text')\n\n\t@cdata = NQXML::Text.new(\"xx<z&xx</\\nnewline in cdata\\n\",\n\t\t\t\t \"<![CDATA[xx<z&xx</\\nnewline in cdata\\n]]>\")\n\t@outerEnd = NQXML::Tag.new('outer', nil, true, '</outer>')\n\n\t@sub1_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE outer SYSTEM \"foobar\" [\n <!ENTITY example \"<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).</p>\" >\n]>\n'\n\tsrc = '<!ENTITY example \"<p>An ampersand (&#38;) may be' +\n\t ' escaped numerically (&#38;#38;) or with a general entity' +\n\t ' (&amp;).</p> >'\n\tval = \"<p>An ampersand (&) may be escaped numerically\" +\n\t \" (&#38;) or with a general entity (&amp;).</p>\"\n\t@sub1Entity = NQXML::GeneralEntityTag.new('example', val, nil, nil,\n\t\t\t\t\t\t src)\n\t\t\t\t\t\t\n\t@sub2_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE test [\n<!ELEMENT test (#PCDATA) >\n<!ENTITY % xx \\'%zz;\\'>\n<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >\n%xx;\n]>\n<test>This sample shows a &tricky; method.</test>\n'\n\t@xxEntity =\n\t NQXML::ParameterEntityTag.new('xx', '%zz;', nil,\n\t\t\t\t\t '<!ENTITY % zz \\'%zz;\\'>')\n\n\tsrc = '<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >'\n\tval = '<!ENTITY tricky \"error-prone\" >'\n\t@zzEntity = NQXML::ParameterEntityTag.new('zz', val, nil, src)\n end",
"def initialize(xml_str, spec_yaml_str=nil)\n # Flag for the time string format\n @show_seconds = false\n\n raise ArgumentError.new('Parser initiation requires XML String argument') if xml_str.nil? or xml_str.empty?\n if spec_yaml_str.nil? or spec_yaml_str.empty?\n @@spec = YAML::load(File.read(File.expand_path('../../../conf/nemsis_spec.yml', __FILE__)))\n else\n @@spec = YAML::load(spec_yaml_str)\n end\n self.xml_str = xml_str\n self.xml_doc = Nokogiri::XML(xml_str)\n xml_doc.remove_namespaces!\n end",
"def initialize(res, opts = {})\n @data = res\n opts[:parser] ||= Nori.new(\n parser: :rexml,\n convert_tags_to: lambda { |tag| tag.snakecase.to_sym }\n )\n @opts = opts\n end",
"def initialize(xmldoc)\n @xmldoc = xmldoc\n @output = {}\n end",
"def from_node(node); end",
"def initialize(run, xml)\n super(run, xml)\n\n @value = nil\n @file = nil\n @remote_file = false\n end",
"def initialize(xml, fileName, pa, responseDir)\r\n @responseDir = responseDir\r\n @xml = REXML::Document.new(xml) \r\n @fileName = fileName\r\n @nps = []\r\n @seed = 0\r\n\r\n \tif pa == nil\r\n\t \t@parseAdapter = ParseAdapter.new\r\n\t else\r\n\t \t@parseAdapter = pa\r\n \tend\r\n end",
"def initialize(xml)\n #puts \"________________________________________\"\n #puts xml\n #puts \"________________________________________\"\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def load_from_xml(xml_text)\n item = parse_xml(xml_text)\n if block_given? then self.create(item) { |i| yield(i) }\n else self.create(item)\n end\n end",
"def initialize \n @doc = Document.new \n @action = @doc.add_element('action')\n @param = Element.new('parameter')\n end",
"def new_from_element(element)\n OpenStruct.new.tap do |obj|\n obj.asin = element.at('ASIN').inner_text\n obj.url = element.at('DetailPageURL').inner_text\n obj.title = element.at(\"Title\").inner_text\n end\n end",
"def initialize_element(elem, element_id)\n if elem.is_a?(Class) && elem < TreeLayout\n layout = elem.new\n elem = layout.view\n elsif elem.is_a?(Class)\n elem = elem.new\n elsif elem.is_a?(TreeLayout)\n layout = elem\n elem = elem.view\n end\n\n if layout\n if element_id\n name_element(layout, element_id)\n end\n @child_layouts << layout\n elsif element_id\n name_element(elem, element_id)\n end\n\n return elem\n end",
"def rexml!\n @@parser = USE_REXML\n end",
"def load_xml(xml)\n @mmdoc = REXML::Document.new(xml)\n end",
"def typed_add(element)\n if element.kind_of?(REXML::Element) && (element.name == 'x')\n super(X::import(element))\n else\n super(element)\n end\n end",
"def initialize(element, page_url = nil)\n @element = element\n @page_url = page_url\n @properties = extract_properties\n end",
"def initialize(tagname_or_element, *a, &block)\n case tagname_or_element\n when Element\n @tagname = tagname_or_element.tagname_symbol\n @attrs = tagname_or_element.attrs\n @attrs.shared = true\n @attrs_hash = tagname_or_element.attrs_hash\n @hide_hid = tagname_or_element.hide_hid\n if block_given?\n init_body(&block)\n else\n @body = tagname_or_element.body.clone\n end\n when Symbol, String\n set_tag(tagname_or_element)\n @attrs = AttrArray.new\n @attrs_hash = {}\n @hide_hid = false\n if a.size() == 1 and a.kind_of?(AttrArray)\n @attrs = a\n @attrs.shared = true\n @attrs.each do |a|\n @attrs_hash[a.key_symbol] = a\n end\n else\n a.each { |aa| put_attr(aa) }\n end\n if block_given?\n init_body(&block)\n else\n @body = Null\n end\n end\n end",
"def initialize(node)\n self.date = Utils.parse_iso_8601_date(node.content) rescue nil\n self.date_str = node.content\n self.event = node.attribute('event').content rescue nil\n end",
"def initialize(*args)\n super(*args)\n @name = @x.attributes['name'].value\n @value = @x.css('value').text\n end",
"def __element_object_initialize(h, val)\n obj = __element_object_get(h)\n\n val = { '__content' => val } unless val.respond_to?(:each)\n if h.single?\n obj.__initialize_with(val)\n else\n val.map { |v| obj.new(v) }\n end\n end",
"def create_from_xml(xml, pares)\n raise PaResMissing.new \"(2500) PaRes argument can not be omitted.\" if pares.nil?\n @request_xml = REXML::Document.new xml\n REXML::XPath.first(@request_xml, \"//ThreeDSecure\").add_element(\"PaRes\").text=pares\n end",
"def from_xml(node)\r\n @story_id = node['id']\r\n @title = node['name']\r\n @description = node['description'] || \"\"\r\n @url = node['url']\r\n accepted_at_node = node['accepted_at']\r\n @accepted_at = accepted_at_node.nil? ? nil : DateTime.parse(accepted_at_node)\r\n @created_at = DateTime.parse(node['created_at'])\r\n @updated_at = DateTime.parse(node['updated_at'])\r\n @requested_by_id = node['requested_by_id']\r\n @current_state = node['current_state']\r\n owned_by_node = node['owned_by']\r\n @owned_by_id = node['owned_by_id'] # owned_by_node.nil? || owned_by_node.length == 0 ? 'no one' : owned_by_node\r\n @story_type = node['story_type']\r\n estimate_node = node['estimate']\r\n @estimate = estimate_node.nil? ? 0 : estimate_node.to_i\r\n @estimate = 0 if @estimate < 0\r\n labelnode = node['labels']\r\n @labels = labelnode\r\n\r\n self\r\n end",
"def init\n super\n @parser = Nokogiri::XML::SAX::Parser.new(self)\n end",
"def initialize(xml_file_name)\n @xml_file_name = xml_file_name\n @kinvars = Array.new\n doc = REXML::Document.new(File.new(xml_file_name)) \n kv_elem = doc.elements['kinematic-variables']\n kv_elem.elements.each('kinvar'){|kv| @kinvars.push Kinvar.new(kv)}\n @data_file = kv_elem.elements['dat-file'].attributes['file']\n @file = File.new(@data_file,'rb')\n end",
"def invoke_rexml\n @xdoc = nil\n @helper = RexmlHelper.new\n end",
"def from_trusted_xml(xml)\n from_xml xml, []\n end",
"def initialize rdoc, reference # :not-new:\n @reference = reference.equal?(rdoc) ? reference.dup : reference\n\n # unpack\n @reference = @reference.reference if self.class === @reference\n @rdoc = rdoc\n end",
"def initialize(xml_path, namespace='vmw')\n @xml_path = xml_path\n load\n @xml.root.add_namespace namespace, NameSpaces[namespace]\n @namespace = namespace\n end",
"def initialize(xml)\r\n @title = xml.split(/<\\/?title>/)[1] # delim stroku po tegam <title> i </title>\r\n\t@link = xml.split(/<\\/?link>/)[1]\r\n\t@description = xml.split(/<\\/?description>/)[1]\r\n\t@language = xml.split(/<\\/?language>/)[1]\r\n\t@pubDate = xml.split(/<\\/?pubDate>/)[1]\r\n\t\r\n\t# polu4aem rezultat ot delenija po tegam <item> i </item>\r\n\t# i raspechatyvaem\r\n\t@items = Array.new\r\n\txml.split(/<\\/?item>/).each do |item|\r\n\t # sozdaem novyj objekt klassa Item esli \r\n\t # v peremennoj item est' teg <title>\r\n\t @items << Item.new(item) if item.include?(\"<title>\")\r\n\tend\r\n end",
"def load_from_xml(node)\n # Get all information from the root's children nodes\n node.children.each do |child|\n case child.name.to_s\n when 'id'\n @id = child.content.to_i\n when 'title'\n @title = child.content.to_s\n when 'artists'\n @artists = [] if @artists.nil?\n child.children.each do |artist|\n @artists << Artist.new(:name => artist.content) if artist.name == 'artist'\n @headliner = Artist.new(:name => artist.content) if artist.name == 'headliner'\n end\n @artists << @headliner unless @headliner.nil? || headliner_alrady_listed_in_artist_list?\n when 'image'\n check_image_node(child)\n when 'url'\n @url = child.content\n when 'description'\n @description = child.content\n when 'attendance'\n @attendance = child.content.to_i\n when 'reviews'\n @reviews = child.content.to_i\n when 'tag'\n @tag = child.content\n when 'startDate'\n @start_date = Time.parse(child.content)\n when 'startTime'\n @start_time = child.content\n when 'endDate'\n @end_date = Time.parse(child.content)\n when 'tickets'\n # @todo Handle tickets\n when 'venue'\n @venue = Venue.new_from_xml(child)\n when 'website'\n @website = child.content.to_s\n when 'text'\n # ignore, these are only blanks\n when '#text'\n # libxml-jruby version of blanks\n else\n raise NotImplementedError, \"Field '#{child.name}' not known (#{child.content})\"\n end #^ case\n end #^ do |child|\n @artists.uniq!\n end",
"def initialize(equ)\n @xml = LibXML::XML::Node.new('Cell')\n @xml['ss:Formula'] = equ\n end",
"def initialize(text_node)\n Hatemile::Helper.require_not_nil(text_node)\n Hatemile::Helper.require_valid_type(text_node, Nokogiri::XML::Text)\n\n @data = text_node\n init(text_node, self)\n end",
"def initialize(pid, name, xml_document)\n feed = feed\n @pid = pid\n @name = name\n @xml_document = xml_document\n end",
"def initialize(name, xml_attribute, rn, version, inp_out, mask,\n field_names, access, verbs)\n\n @name = name\n @xml_attribute = xml_attribute\n @rn = rn\n @version = version\n @inp_out = inp_out\n @mask = mask\n @field_names = field_names\n @access = access\n #@children = children\n #@parents = parents\n @verbs = verbs\n end",
"def element=(_arg0); end",
"def initialize(elements)\n @elements = elements\n end",
"def parse( x )\n cycle( xml( x ) )\n end",
"def new\n @element = Element.new\n end",
"def from_xml(xml)\n clear\n humanized_attributes = @base.attributes.keys.inject({}) { |h, attr_name| h.update(attr_name.humanize => attr_name) }\n messages = Array.wrap(Hash.from_xml(xml)['errors']['error']) rescue []\n messages.each do |message|\n attr_message = humanized_attributes.keys.detect do |attr_name|\n if message[0, attr_name.size + 1] == \"#{attr_name} \"\n add humanized_attributes[attr_name], message[(attr_name.size + 1)..-1]\n end\n end\n \n add_to_base message if attr_message.nil?\n end\n end",
"def from_node(original_node); end",
"def initialize(node, client)\n @xml = node\n @client = client\n @hash = nil\n \n if self['ID']\n @pe_id = self['ID'].to_i\n else\n @pe_id = nil\n end\n @name = self['NAME'] if self['NAME']\n end",
"def initialize(stats, element = nil)\n super(stats)\n self.element = element if element\n end",
"def initialize(xml=nil)\n @bridge = Bridge.new\n @ip = IP.new\n\n load!(xml) if xml\n end",
"def xml_to_instance\r\n ATTRIBUTES_MAP.each do |name, hash| \r\n elem = @xml.root.elements[hash[\"element\"]]\r\n unless elem.nil?\r\n val = (hash.has_key?(\"attribute\") ? elem.attributes[hash[\"attribute\"]] : elem.text)\r\n val = self.send(hash[\"from_xml\"], val) if hash.has_key?(\"from_xml\")\r\n self.send(name+\"=\", val)\r\n end\r\n end\r\n self.status = :old\r\n\r\n @xml.root.elements.each(\"link\") do |link|\r\n @feed = link.attributes[\"href\"] if link.attributes[\"rel\"] == \"edit\"\r\n end\r\n end",
"def initialize(arg = '')\n @root, @raw =\n if arg.instance_of? self.class\n arg.parsed? ? [arg.root, nil] : [nil, arg.raw]\n elsif arg.is_a? Document\n # For any other RichText object we take the root node\n [arg.root, nil]\n elsif arg.is_a? Entry\n # Also accept an Entry which will be used as the\n # document root\n [arg.root, nil]\n else\n [nil, arg.to_s]\n end\n end",
"def xml_convert(xml, element)\n xml.doc.root.add_child(element)\n end",
"def initialize(xml_data)\n initialize_data(Sequel.postgres('roadworks'), xml_data)\n end",
"def load!(xml)\n root = Nokogiri::XML(xml).root\n try(root.xpath(\"//network\")) do |network|\n try(network.xpath(\"name\")) { |result| self.name = result.text }\n try(network.xpath(\"uuid\")) { |result| self.uuid = result.text }\n try(network.xpath(\"bridge\")) { |result| self.bridge = Bridge.new(result) }\n try(network.xpath(\"ip\")) { |result| self.ip = IP.new(result) }\n end\n end",
"def __set_element(el, opts = {})\n unless el.is_a?(Nokogiri::XML::Element)\n el = Nokogiri::XML::Element.new(opts[:tag], @__node)\n @__node << el\n if opts[:namespace]\n el.namespace = el.namespace_scopes.find { |n| n.prefix == opts[:namespace] }\n end\n end\n h = __elements_handlers.for_xml_object(el)\n el.instance_variable_set(:@__handler, h)\n __initialize_elements_container(h) << h.from_xml_element(el)\n end"
] |
[
"0.74032336",
"0.7217232",
"0.6988989",
"0.6988989",
"0.6988989",
"0.69343686",
"0.6855485",
"0.6804757",
"0.6799742",
"0.6736154",
"0.6673041",
"0.66329205",
"0.6624914",
"0.65383434",
"0.6500895",
"0.64715695",
"0.644519",
"0.64287573",
"0.6375737",
"0.6360501",
"0.6293038",
"0.6286961",
"0.62239146",
"0.6135135",
"0.6134935",
"0.61240536",
"0.6106529",
"0.6086498",
"0.60265046",
"0.60230017",
"0.6014822",
"0.60022926",
"0.59652704",
"0.59505063",
"0.5942942",
"0.5924298",
"0.5921092",
"0.58902675",
"0.5876437",
"0.58734846",
"0.58252066",
"0.5818341",
"0.5804649",
"0.5777186",
"0.5773711",
"0.5765015",
"0.5755794",
"0.5751277",
"0.5710681",
"0.56899536",
"0.56899536",
"0.56893426",
"0.5688737",
"0.5666381",
"0.565403",
"0.5650387",
"0.5647561",
"0.5630502",
"0.5627751",
"0.56201863",
"0.5608696",
"0.5603494",
"0.5603249",
"0.5587828",
"0.55850935",
"0.557412",
"0.557204",
"0.55710363",
"0.556023",
"0.55360466",
"0.5518155",
"0.55063164",
"0.5505946",
"0.5484334",
"0.5466682",
"0.5456654",
"0.5451379",
"0.5440301",
"0.543115",
"0.5425917",
"0.5419029",
"0.5416609",
"0.5415248",
"0.5413732",
"0.5407471",
"0.5405347",
"0.53999907",
"0.53954786",
"0.5392696",
"0.53887165",
"0.5383787",
"0.5382703",
"0.5381498",
"0.5372485",
"0.53652716",
"0.536098",
"0.53556097",
"0.5347027",
"0.53314954",
"0.5325003"
] |
0.7086324
|
2
|
Returns the bin index corresponding to _value_.
|
def bin_index(value)
return -1 if(value < @range_min or value > @range_max)
(@num_bins*(value - @range_min)/(@range_max - @range_min)).to_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def binary_search(value)\n search_result = binary_search_internal(value)\n return search_result[0] ? search_result[1] : -1\n end",
"def raw_count(value)\n @bins[value] || 0\n end",
"def value(bin_index)\n @range_min + (bin_index + 0.5)*(@range_max - @range_min)/@num_bins.to_f\n end",
"def index(value)\n each.with_index do |v, i|\n return i if v == value\n end\n return nil\n end",
"def findValue(value)\n if ! @sorted\n @map.sort{ |a,b| a[0] <=> b[0] }\n @sorted = true\n end\n \n @map.binsearch{|x| x[0] >= value}[1]\n end",
"def index(value)\n index = nil\n\n self.each_with_indices do |yields|\n if yields.first == value\n yields.shift\n index = yields\n break\n end\n end\n\n index\n end",
"def index(value)\n find_index(value, 0, @head, :next, 1)\n end",
"def value_index\n return nil unless self.value\n VALUES.index(self.value.downcase)\n end",
"def sample(value)\n (@bins[value] || 0).to_f / @n.to_f\n end",
"def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end",
"def input_to_index(input)\n position = input.to_i - 1 \n # ^ used gets again here, was wrong.. did gets in bin\n\n # position = position - 1\n return position\n \nend",
"def find(value)\n return binary_search(value)\n end",
"def map_get_index_of value\n sorted_set = @map[value]\n return nil if sorted_set.nil?\n\n return sorted_set.to_a.last\n end",
"def b(value)\n (value & 0x0000ff00) >> 8\n end",
"def b(value)\n (value & 0x0000ff00) >> 8\n end",
"def find(value)\n index = 0\n temp = @head\n while temp\n return index if temp.value == value\n index += 1\n temp = temp.next_node\n end\n nil\n end",
"def binary_index(array, target)\n upper = array.size - 1\n lower = 0\n\n while upper >= lower\n center = lower + (upper - lower) / 2\n\n case @comparator.call(target, array[center])\n when 0\n return center\n when 1\n lower = center + 1\n when -1\n upper = center - 1\n end\n end\n lower\n end",
"def how_many(value)\n lo = 0\n hi = @array.length - 1\n mid = lo + (hi - lo) / 2\n\n # ordinary binary search\n # while both bounds hasn't reach each other\n while (lo <= hi) and @array[mid] != value\n # divide the range where the value could be\n mid = lo + (hi - lo) / 2\n if value < @array[mid] then\n hi = mid - 1\n elsif value > @array[mid] then\n lo = mid + 1\n end\n end\n\n # if didn't find the value with the binary search\n if @array[mid] != value\n return 0\n end\n\n hi_index = find_bounds @array, hi, lo, mid, value, :HI\n lo_index = find_bounds @array, hi, lo, mid, value, :LO\n\n hi_index - lo_index + 1\n end",
"def random_index value\n\t\tn=rand(find_all{|e|e==value}.size)\n\t\teach_with_index{|e,i| return i if e==value and (n-=1)<0 }\n\tend",
"def index\n Dictionary.db.zrank(@key, @value).to_i\n end",
"def get_map_number_index(y_value)\n\tif y_value >= 0 && y_value <= 50\n\t\treturn '1'\n\telsif y_value >= 50 && y_value <= 100\n\t\treturn '2'\n\telsif y_value >= 100 && y_value <= 150\n\t\treturn '3'\n\telsif y_value >= 150 && y_value <= 200\n\t\treturn '4'\n\telsif y_value >= 200 && y_value <= 250\n\t\treturn '5'\n\telsif y_value >= 250 && y_value <= 300\n\t\treturn '6'\t\t\n\telse\n\t\treturn '?'\n\tend\nend",
"def setting(value)\n result = 0\n shift_out_with_index do |bit, i|\n result |= bit.setting(value[i])\n end\n result\n end",
"def get_data_indx(constant_value)\n if @data\n # this subclass handles data\n @data << constant_value.to_f # add a 0 to the list\n return @data.length - 1 # return it's position\n else\n # otherwise check the parent\n return @parent.get_data_indx(constant_value)\n end\n end",
"def binary_search_internal(value)\n return [false, 0] if @inner.size == 0\n left = 0\n right = @inner.size - 1\n return [false, 0] if value < @inner[left]\n return [false, right + 1] if value > @inner[right]\n while left <= right\n middle = (left + right) / 2\n if @inner[middle] == value\n return [true, middle]\n elsif value < @inner[middle]\n right = middle - 1\n else\n left = middle + 1\n end\n end\n return [false, left]\n end",
"def split_index(values)\n binary_length = (values.length - 1).to_s(2).length\n 2**(binary_length - 1) - 1\n end",
"def header_index_of(value)\n header_cell_values.index(value)\n end",
"def ary_bsearch_i(ary, value)\n low = 0\n high = ary.length\n mid = nil\n smaller = false\n satisfied = false\n v = nil\n\n while low < high do\n mid = low + ((high - low) / 2)\n v = (ary[mid] > value)\n if v == true\n satisfied = true\n smaller = true\n elsif !v\n smaller = false\n else\n raise TypeError, \"wrong argument, must be boolean or nil, got '#{v.class}'\"\n end\n\n if smaller\n high = mid\n else\n low = mid + 1;\n end\n end\n\n return nil if low == ary.length\n return nil if !satisfied\n return low\n end",
"def binary_search(arr, value)\n\treturn [-1,0] if arr.length == 0\n\ttimes = 0\n\tmidpoint = arr.length / 2\n\tworstCaseTime = Math.log2(arr.length).floor\n\twhile times <= worstCaseTime do\n\t\ttimes += 1\n\t\tif arr[midpoint] == value\n\t\t\treturn [midpoint,times]\n\t\telsif arr[midpoint] > value\n\t\t\tmidpoint = midpoint/2\n\t\telsif arr[midpoint] < value\n\t\t\tmidpoint = (arr.length - midpoint)/2 + midpoint\n\t\tend\n\tend\n\treturn [arr.index(value),times]\nend",
"def int_to_binary(value)\n nbytes = 0\n nbytes = 1 if value > 0xFF # 1 byte integer\n nbytes += 1 if value > 0xFFFF # 4 byte integer\n nbytes += 1 if value > 0xFFFFFFFF # 8 byte integer\n nbytes = 3 if value < 0 # 8 byte integer, since signed\n\n bdata = Binary.type_bytes(\"1\", nbytes) # 1 is 0001, type indicator for integer\n buff = \"\"\n\n if(nbytes < 3) then\n fmt = \"N\"\n\n if(nbytes == 0) then\n fmt = \"C\"\n elsif(nbytes == 1)\n fmt = \"n\"\n end\n\n buff = [value].pack(fmt)\n else\n # 64 bit signed integer; we need the higher and the lower 32 bit of the value\n high_word = value >> 32\n low_word = value & 0xFFFFFFFF\n buff = [high_word,low_word].pack(\"NN\")\n end\n\n return bdata + buff\n end",
"def game_value\n [VALUES.index(value) + 2, 10].min\n end",
"def serialize_value(value)\n [value.to_i].pack('N')\n end",
"def index value\n l, r = 0, @timers.size - 1\n\n while l <= r\n m = (r + l) / 2\n if value < @timers.at(m)\n r = m - 1\n else\n l = m + 1\n end\n end\n\n l\n end",
"def interpolation_search(value)\n search_result = interpolation_search_internal(value)\n return search_result[0] ? search_result[1] : -1\n end",
"def find_fibonacci_index_by_length(value)\n\tfirst_num = 1\n\tsecond_num = 1\n\tindex = 2\n\tloop do \n\t\tfib = first_num + second_num\n\t\tindex +=1 \n\t\treturn index if fib.to_s.size == value\n\t\tfirst_num = second_num\n\t\tsecond_num = fib\n\tend\nend",
"def index_position_value(position)\n i=((position)/MaxBits.to_f).ceil\n p=((position-1)%MaxBits)\n v=2**p\n [i,p,v]\n end",
"def find(value)\n return nil if head.nil?\n\n index = 0\n curr = head\n until curr.nil?\n return index if curr.value == value\n\n index += 1\n curr = curr.next\n end\n nil\n end",
"def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend",
"def binary_search(ary, value); end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def to_i\n @value\n end",
"def next_value(value, array)\n i = value > 0 ? 0 : 1\n index = value == -1 ? 1 : false\n sum = 0\n while i < 100\n if array[i].abs <= value.abs\n sum += array[i].abs\n i += 2\n index = i\n next\n end\n method = sum >= value.abs ? :sum : :cut\n return [index, method]\n end\n method = sum >= value.abs ? :sum : :cut\n return [index, method]\nend",
"def to_i\n Integer(value)\n end",
"def find(value)\n find_root @indices.fetch(value)\n end",
"def biggest_index(money_value)\n result_index = COINS.size\n COINS.reverse_each do |coin_value|\n result_index-=1\n break if (money_value/coin_value > 0)\n end\n\n result_index\n end",
"def bsearch(array, value)\n return nil if array.empty?\n # return nil if !array.include?(value)\n\n # debugger\n indeces = array.dup.freeze #[1, 2, 3]\n \n middle = (array.length) / 2\n left = array[(0...middle)]\n right = array[(middle..-1)]\n\n # debugger\n if array[middle] == value\n return indeces.index(value) \n elsif value < array[middle]\n bsearch(left, value)\n else\n middle + bsearch(right, value)\n end\n #somewhere bsearch(array[(0..-2)]\nend",
"def bin_search(target,array)\n lo = 0\n hi = array.length - 1\n mid = (lo+hi)/2\n while lo <= hi\n if array[mid] > target\n hi = mid-1\n mid = (lo+hi)/2\n elsif array[mid] < target\n lo = mid+1\n mid = (lo+hi)/2\n else\n return mid\n end\n end\n return -1\nend",
"def column_number_for_value(value)\n cell = cells.find { |cell| clean_cell_value(cell) == value }\n cell.present? ? cell.column : nil\n end",
"def find(value) \n index = 0\n node = @head\n while(node.value != value)\n node = node.next_node\n index += 1\n if(node.value == value)\n return index\n end\n if(node == @tail) && (node.value != value)\n return nil\n end\n end\n return 0 \n end",
"def search(value)\r\n temp = @first\r\n index = 0\r\n while !temp.nil?\r\n if temp.value == value\r\n return index\r\n end\r\n temp = temp.next\r\n index += 1\r\n end\r\n return -1\r\n end",
"def find(value)\n idx = 0\n node = list\n while node != nil\n return idx if node.value == value\n idx += 1\n node = node.nextNode\n end\n return nil\n end",
"def index(list, value)\n index = list.to_a.index {|e| e.eq(value).to_bool}\n index ? number(index + 1) : null\n end",
"def find_by_value(value)\n by_value[value]\n end",
"def find_by_value(value)\n by_value[value]\n end",
"def bin_search(arr, key)\n low = 0\n high = arr.length - 1\n while high >= low do\n mid = low + (high - low) / 2\n if arr[mid] > key\n high = mid - 1\n elsif arr[mid] < key\n low = mid + 1\n else\n return mid\n end\n end\n return 0\nend",
"def find(value)\n result = -1\n @inner.each_with_index do |item, index|\n if value == item\n result = index\n break\n end\n end\n return result\n end",
"def find(value)\n \n index = findIndex(value)\n return nil if ! index\n result = at(index)\n\n if index == 0\n offset = value\n else\n offset = value - result[1]\n end\n \n [index, result[0], result[1], result[2], offset]\n end",
"def exists(value)\n 1 == @client.execute_udf(@key, @PACKAGE_NAME, 'exists', [@bin_name, value], @policy)\n end",
"def calculate_index(range_size, step_size, value)\n (value / step_size + range_size / 2).round\n end",
"def describe_value(value)\r\n\t\tvalues.find(value.to_i).value\r\n\tend",
"def describe_value(value)\r\n\t\tvalues.find(value.to_i).value\r\n\tend",
"def get_value_number\n value ? value : 0\n end",
"def binary_search(array, value)\n return nil if array.length == 1 && array[0] != value\n midpoint = array.length/2\n return midpoint if array[midpoint] == value\n if array[midpoint] < value\n midpoint + binary_search(array[midpoint..array.length], value) if binary_search(array[midpoint..array.length], value)\n else\n binary_search(array[0...midpoint], value)\n end\nend",
"def find(value)\n node = @head \n for i in 0..@size-1 \n return i if node.value == value\n node = node.link \n end\n return nil\n end",
"def value\n (atom % 1).zero? ? atom.to_i : atom\n end",
"def value\n (atom % 1).zero? ? atom.to_i : atom\n end",
"def binary_search array, value, start, ends\n\treturn false if start > ends\n\tpivote = start + ((ends - start) / 2).floor\n\tif value == array[pivote]\n\t\treturn count_repeated array, value, pivote\n\telsif value > array[pivote]\n\t\tbinary_search array, value, pivote+1, ends\n\telse value < array[pivote]\n\t\tbinary_search array, value, start, pivote-1\n\tend\nend",
"def recursive_index_of(value, current_node = @first_node, current_index = 0) \n if current_node.data == value\n return current_index\n else\n recursive_index_of(value, current_node.next_node, current_index + 1) if current_node.next_node\n end\n end",
"def get(value)\n @client.execute_udf(@key, @PACKAGE_NAME, 'get', [@bin_name, value], @policy)\n end",
"def sizeBytes(value)\n checkArg value >= 0\n mval = 0x100\n cnt = 1\n while value >= mval\n cnt += 1\n mval <<= 8\n end\n cnt\n end",
"def search(aValue)\n temp = @first\n indexValue = 0\n while !temp.nil?\n if temp.value == aValue\n return indexValue\n end\n indexValue += 1\n temp = temp.next\n end\n return -1\n end",
"def binary_searcher(array, value)\n array.bsearch { |integer| value <=> integer } || false\n\nend",
"def serialize_hash_to_indexed(value)\n !value.is_a?(::Hash) and raise ArgumentError, \"value must be a hash\"\n\n # index value\n index = \"\"\n index.respond_to?(:force_encoding) and index.force_encoding(\"UTF-8\") # 1.9.2\n # field values\n result = []\n value.each_pair { |key, value|\n index << key.to_i+48 # ASCII integer. 1 => 49, ...\n # recursive call if value is a Hash\n if value.is_a?(::Hash)\n value = serialize_hash_to_indexed(value)\n # array => serializes each element\n elsif value.is_a?(Array)\n value.map! { |val|\n if val.is_a?(::Hash)\n serialize_hash_to_indexed(val)\n else\n val\n end\n }\n end\n # insert encoded value in Array\n result.push value\n }\n # include index as first element\n result.unshift(index)\n end",
"def describe_value(value)\r\n\t\t\tvalues.find(value.to_i).value\r\n\t\tend",
"def nearest_fibonacci_level(val)\n if val < self.begin\n raise FibonacciRangeUtils::ValueOutOfRangeError, \"Must pass a value within the range.\" unless val > self.end\n elsif val > self.begin\n raise FibonacciRangeUtils::ValueOutOfRangeError, \"Must pass a value within the range.\" unless val < self.end\n end\n \n span = (self.end - self.begin).abs\n move = (val - self.begin).abs\n\n current_level = move/span\n nearest_key_level = KEY_FIB_LEVELS.sort_by { |level| (level-current_level).abs }.first\n\n if self.begin < self.end\n nearest_fib_value = self.begin + span*nearest_key_level\n else\n nearest_fib_value = self.begin - span*nearest_key_level\n end\n [nearest_fib_value.round(3), nearest_key_level]\n end",
"def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end",
"def search(aValue)\r\n temp = @first\r\n indexValue = 0\r\n while !temp.nil?\r\n if temp.value == aValue\r\n return indexValue\r\n end\r\n indexValue += 1\r\n temp = temp.next\r\n end\r\n return -1\r\n end",
"def get_color_number_absolute value\n color_number = 0\n color_number += 1 while (value >= (COLOR_THRESHOLDS_ABSOLUTE[color_number]||0) and color_number < COLOR_THRESHOLDS_ABSOLUTE.size)\n color_number\n end",
"def binary_search(array, value)\n \n # First, we establish the lower and upper bounds of where the value we are\n # searching for can be. At the beginning, the lower bound is the first value\n # of the array and the upper bound is the last value of the array.\n lower_bound = 0\n upper_bound = array.length - 1\n\n # Now we start searching for the value inside the array between the lower and upper bounds.\n # In each iteration of the loop, we check the middle value between the lower and upper bounds\n # against the value we are searching for. If the middle value matches the value we are searching\n # for then we stop, otherwise we update the lower and upper bounds of our search accordingly(Should\n # we search to the right or the left of the mid point in the next iteration to find the value we are\n # looking for).\n #\n # If the value at the mid point matches with the value we are looking for, we are done and we return\n # the mid point(index of the value we are looking for).\n #\n # If the value is lower than the value at the mid point, we should to search to the left side of the mid point\n # in the next iteration. So we set the upper bound to the left of mid point.\n #\n # If the value is higher than the value at the mid point, we should to search to the right side of the mid point\n # in the next iteration. So we set the lower bound to the right of mid point.\n\n while lower_bound <= upper_bound\n\n # Find the mid point between the upper and lower bounds\n mid_point = (lower_bound + upper_bound) / 2\n\n # Look up the value at the mid point\n value_at_mid_point = array[mid_point]\n\n # Check the value at the mid point against the value we are looking for:\n\n if value == value_at_mid_point\n return mid_point\n elsif value < value_at_mid_point\n upper_bound = mid_point - 1\n elsif value > value_at_mid_point\n lower_bound = mid_point + 1\n end\n end\n\n # If the value is not found, return nil indicating the value we are searching for\n # doesn't exist inside the array.\n return nil\nend",
"def value_to_integer(value)\n case value\n when TrueClass, FalseClass\n value ? 1 : 0\n else\n value.blank? ? nil : value.to_i rescue nil\n end\n end",
"def find(value)\n current_node = @head\n counter = 0\n until current_node.nil?\n return counter if current_node.value == value\n\n current_node = current_node.next_node\n counter += 1\n end\n nil \n end",
"def input_bins=(value)\n @input_bins = value\n end",
"def input_to_bitstring( value )\r\n value\r\n end",
"def initialize val\n return super(val) if val.nil?\n last_top = bins.first\n bins.each_with_index do |bin_top, idx|\n return super(idx) if val <= bin_top\n end\n return super(bins.length)\n end",
"def int\n Util.from_bytes :int, value\n end",
"def to_i\n @value.to_i\n end",
"def output_bins=(value)\n @output_bins = value\n end",
"def find(value)\n i = 1\n current_node = @head\n while current_node != nil do\n return i if current_node.data == value\n current_node = current_node.next\n i += 1\n end\n return nil\n end"
] |
[
"0.6910767",
"0.67883694",
"0.62572676",
"0.6224203",
"0.6101795",
"0.6090049",
"0.596754",
"0.5899062",
"0.5862317",
"0.5853283",
"0.584395",
"0.58358526",
"0.5833961",
"0.57845455",
"0.57845455",
"0.5701703",
"0.5691766",
"0.5652859",
"0.56436414",
"0.562319",
"0.559947",
"0.5570581",
"0.55529124",
"0.55500656",
"0.5521875",
"0.5513195",
"0.5509607",
"0.54981035",
"0.5447578",
"0.5436078",
"0.541446",
"0.5411698",
"0.5411089",
"0.5404039",
"0.5376401",
"0.537013",
"0.5363786",
"0.53565073",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.5338384",
"0.53347963",
"0.5334586",
"0.5320318",
"0.53057915",
"0.5291259",
"0.5291194",
"0.52873117",
"0.5285913",
"0.52811325",
"0.5277257",
"0.52708465",
"0.527064",
"0.527064",
"0.5243281",
"0.5238992",
"0.52004015",
"0.5183211",
"0.5175928",
"0.51713973",
"0.51713973",
"0.51606876",
"0.51539767",
"0.5139398",
"0.5135184",
"0.5135184",
"0.5134813",
"0.5125031",
"0.51179653",
"0.5115222",
"0.5114145",
"0.5109064",
"0.51086617",
"0.51049536",
"0.51017416",
"0.50956196",
"0.50771147",
"0.50679886",
"0.50670224",
"0.50642586",
"0.50620615",
"0.5054397",
"0.5046465",
"0.5027533",
"0.50211495",
"0.5017389",
"0.5003783",
"0.49973127"
] |
0.8275749
|
0
|
Returns the mean value of bin _bin_index_.
|
def value(bin_index)
@range_min + (bin_index + 0.5)*(@range_max - @range_min)/@num_bins.to_f
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mean\n return 0.0 if @count.zero?\n return @sum / @count\n end",
"def mean\n @sum / @count\n end",
"def mean\n stats.mean\n end",
"def mean\n sum / count.to_f\n end",
"def mean\n @cleaned_data.map(&:to_f).sum / n.to_f\n end",
"def mean\n get_mean\n end",
"def mean\n\t\t\t(self.size > 0) ? (self.sum.to_f / self.size) : 0\n\t\tend",
"def average()\n if(@countN > 0) then\n return @sum / @countN ;\n else\n return 0.0 ;\n end\n end",
"def mean(attr)\n n = count(attr)\n if n.zero?\n 0\n else\n sum(attr) / n\n end\n end",
"def mean (meanin)\n return meanin.inject(0){|sum,x| sum + x } / meanin.length.to_f\n end",
"def mean\n return @mean if @mean\n @mean = 0\n @thresholds.each { |t| @mean += t }\n @mean /= @t\n end",
"def mean\n @mean ||= x.inject(:+) / n\n end",
"def mean(dimen=0)\n reduce_dtype = nil\n if integer_dtype? then\n reduce_dtype = :float64\n end\n inject_rank(dimen, 0.0, reduce_dtype) do |mean, sub_mat|\n mean + sub_mat\n end / shape[dimen]\n end",
"def mean\n\n end",
"def mean_value(symbol)\n mean = Analysis.metric([@keystrokes])\n mean_val = 0 \n mean.each_pair do |idx, keystroke|\n mean_val += keystroke[symbol].to_i\n end\n if mean.size.to_i != 0\n return (mean_val / mean.size.to_i).to_i\n else\n return 0\n end\n end",
"def mean\r\n sum / size\r\n end",
"def mean()\n sum = 0\n @difference.each do |item|\n sum += item\n end\n @mean = sum / @difference.length\n return @mean\n end",
"def mean\n @mean\n end",
"def mean\n Statistics.mean @data\n end",
"def mean(vector)\n vector.to_a.sum / vector.size.to_f\n end",
"def mean(data)\n return (sum(data) / count(data)).to_f\n end",
"def mean\n redis.hget(bucket_key, RedisBackend::MEAN_FIELD).to_f\n end",
"def avg \n\t\t# prevent divide by zero\n\t\tif (self[:at_bats] != 0)\n\t\t\t(self[:hits].to_i / self[:at_bats].to_f).round(3)\n\t\telse\n\t\t\t0\n\t\tend\n\tend",
"def mean\n variance =0\n count = 0.0\n @data.each do |line|\n true_rating = line[2]\n guess_rating = line[3]\n count = count + 1\n variance = (true_rating.to_i - guess_rating.to_i).abs + variance\n end\n return (variance/count.to_f)\n end",
"def mean\n\t\treturn false if !self.numeric?\n\t\treturn self.element_sum.to_f/self.length\n\tend",
"def mean(ary)\n\tsum=0.0\n\tary.each {|item| sum+=item}\n\tsum/ary.count\nend",
"def mean_hold\n mean_value(:mean_hold)\n end",
"def mean\n self.sum/self.length.to_f\n end",
"def mean\n if self.length == 0\n nil\n else\n self.total_sum / self.length\n end\n end",
"def mean(array)\n array.sum(0.0) / array.size\nend",
"def mean \n sum / size\n end",
"def mean_var\n mu = self.mean\n v = self.var(mu)\n return [mu, v]\n end",
"def get_mean\n end",
"def mean( array )\n sum( array ) / array.size\nend",
"def mean\n end",
"def mean array\n array.inject(:+).to_f / array.length.to_f\n end",
"def mean array\n length = array.length\n sum = 0 \n array.each do |x|\n sum += x\n end\n sum / length\nend",
"def mean\n a = flatten.compact\n (a.size > 0) ? a.sum.to_f / a.size : 0.0\n end",
"def calc_batting_avg\n avg = hits.to_f/bats.to_f\n self.avg = avg\n end",
"def ld_mean\n means = Array.new(@nc, 0)\n @cluster.each_with_index do |subc, i|\n means[i] = @feature.each_with_index.select { |f, j| subc.include? j }.map { |f_and_index| f_and_index[0] }.mean\n end\n return means\n end",
"def get_mean\n\t\tif @eleves.length == 0 \n\t\t\treturn -1\n\t\tend\n\t\tsomme = 0\n\t\t@eleves.each do |e|\n\t\t\tsomme += e.moyenne.to_i\n\t\tend\n\t\tsomme/=@eleves.length \n\tend",
"def mean(cluster)\n images = cluster.map{|image_index| @data[image_index]}\n mean_cluster = []\n image_length = images.first.size\n image_length.times do |i|\n mean_cluster << images.map{|row| row[i]}.sum / cluster.size.to_f\n end\n mean_cluster\n end",
"def calculate_avg_sample(samples, current_sample_index, sample_width)\n if sample_width > 1\n floats = samples[current_sample_index..(current_sample_index + sample_width - 1)].collect(&:to_f)\n #floats.inject(:+) / sample_width\n channel_rms(floats)\n else\n samples[current_sample_index]\n end\n end",
"def mean()\n\t\taverage = 0.0\n\t\t@results.each do |row|\n\t\t\taverage += (row[\"rating\"].to_f - row[\"predicted\"]).abs\n\t\tend\n\n\t\treturn average/results.length\n\tend",
"def batting_avg\r\n at_bats > 0 ? (hits.to_f / at_bats) : 0.0\r\n end",
"def mean(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal = total + x\n\tend\n\tmean = total.to_f / array.count\n\tputs mean\nend",
"def mean(arr)\n return 0 if arr.empty?\n sum = 0\n\n arr.each do |num|\n sum = sum + num\n end\n \n sum / arr.count\nend",
"def mean(cat)\n @categories[cat][:mean]\n end",
"def average\n\t\tif self.length > 0\n\t\t\t#\tsum defined in activesupport/lib/active_support/core_ext/enumerable.rb\n\t\t\tself.digitize.sum.to_f / self.length\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def mean(dim=0)\n reduce_along_dim(dim, 0.0) do |mean, sub_mat|\n mean + sub_mat/shape[dim]\n end\n end",
"def get_mean_cmn_mean(cmn_mean_array)\n begin\n if cmn_mean_array.size > 0\n means = (cmn_mean_array.collect do | s | s.split(\",\") end).collect do |a| a.collect do |ss| ss.to_f end end\n sum = [0.0] * means[0].size\n means = means.select do | mean | mean.size == sum.size end\n means.each do | mean |\n sum.each_with_index do |s,i|\n sum[i] += mean[i]\n end\n end\n return (sum.collect do |s| \"%.2f\" % (s / means.size) end).join(\",\")\n else\n return nil\n end\n rescue Exception => e\n logger.warn(\"Failed to calculate CMN mean over saved means:\" + e.message)\n return nil\n end\n end",
"def mean\n sum = 0\n @test.each do |value|\n sum += value[2] - value[3]\n end\n\n sum/@test.length.to_f\n end",
"def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end",
"def average\n check_numeric_array!\n a = numerify\n a.sum / length.to_f\n end",
"def mean\n\t\tsum = @error_list.inject{|sum, x| sum + x}\n\t\tsum / @predictions.size.to_f\n\tend",
"def get_mean \n return 0.5*(@lower + @upper)\n end",
"def get_mean()\n end",
"def mean\n inject(:+)/size.to_f\n end",
"def get_mean\n (@dof > 1) ? 0.0 : Float::NAN \n end",
"def visit_axiom_aggregate_mean(mean)\n unary_prefix_operation_sql(MEAN, mean)\n end",
"def mean_overall\n sum_overall / hits_overall\n end",
"def mean n\r\n\t\t\treturn n * ( 1.0 * @p / ( @p + @q ) )\r\n\t\tend",
"def square_mean\n @square_mean ||= x.map { |i| i**2 }.inject(:+) / n\n end",
"def average\n\t\treturn self.sum / self.length.to_f\n\tend",
"def mean(array)\n total = array.inject(0) {|sum, x| sum += x}\n # use to_f to avoid get integer result\n return total.to_f / array.length\nend",
"def compute_mean_values_of_cluster cluster\n mean_tuple = get_zero_tuple\n cluster.each do |tuple|\n\n for attribute_index in 0..mean_tuple.size - 1\n #if @workind_dataset.name_of_nominal_type == @working_dataset.get_type_of_attribute_by_index_of_attribute_of_tuple(attribute_index)\n if \"Nominal\" == @working_dataset.get_type_of_attribute_by_index_of_attribute_of_tuple(attribute_index)\n if mean_tuple[attribute_index].has_key?(tuple[attribute_index])\n mean_tuple[attribute_index][tuple[attribute_index]] = mean_tuple[attribute_index][tuple[attribute_index]] + 1\n else\n mean_tuple[attribute_index][tuple[attribute_index]] = 1\n end\n else\n mean_tuple[attribute_index] += tuple[attribute_index].to_i\n end\n end\n end\n\n mean_tuple = get_complete_mean_tuple mean_tuple, cluster.size\n return mean_tuple\n end",
"def mean(options = {})\n c = count(options)\n return nil if c.zero? # if the array is empty will be returned nil\n sum(options) / c\n end",
"def mean(array)\n total = 0.0\n array.each do |value|\n total += value\n end\n total / array.size\nend",
"def harmonic_mean\n size > 0 ? size / reverse_sum : 0\n end",
"def find_average \n result = array.sum(0.0)/array.size\n return result\n end",
"def calc_mean(ary)\n if !ary.is_a?(Array)\n 0\n elsif ary.empty?\n 0\n else\n # Your code goes here \n\n #add the numbers \n #divide by the amount of numbers in array\n temp = 0\n ary.each do |index|\n temp = temp + index\n\n end\n\n mean = temp / ary.size\n\n return mean\n end\nend",
"def mean_rate\n last_at, last_value = @samples.last\n if last_at == @start_time\n 0\n else\n last_value / (last_at - @start_time)\n end\n end",
"def mean(list_of_numbers)\n # Let's re-use the work we did above in the sum method\n calc_mean = sum(list_of_numbers)/(list_of_numbers.length)\n return calc_mean\n end",
"def mean() \n \treturn @error_list.inject{|s,n| s + n}/(@error_list.size * 1.0)\n end",
"def average poss\n '%.2f' % ( @stat_data.map{|n| n[poss].to_f}.reduce(:+) / @stat_data.length )\n end",
"def mean(array)\n array.inject(:+).to_f / array.size\nend",
"def mean(array)\n total = 0\n array.each { |i| total+= i.to_f }\n total / array.count\n puts total\nend",
"def get_average(hash)\n hash_max = hash.length\n hash_total = 0\n hash.each { |_, v| hash_total += v }\n hash_total / hash_max\n end",
"def average\n if self.length > 0\n return self.sum / (self.length * 1.0)\n else\n return nil\n end\n end",
"def mean\n\t\tsum = 0\n\t\tpred_list.each do |pred|\n\t\t\tsum += pred[:error]\n\t\tend\n\t\treturn sum / size\n\tend",
"def arithmetic_mean\n size > 0 ? sum.to_f / size : 0\n end",
"def avg(input_array)\n n = input_array.size \n sum = 0 \n n.times{|x|\n sum = sum + input_array[x]\n }\n return ((sum/n).to_f)\n end",
"def mean(ary)\n ary.inject(0) { |sum, i| sum += i }/ary.length.to_f \nend",
"def avg(sample)\n sample.inject{ |sum, trial| sum + trial }.to_f / sample.size \nend",
"def mean\n size==0 ? nil : sum.to_f / size\n end",
"def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end",
"def mean\n\t\tsummation = predictions.inject(0.0) {|sum, pred| sum + pred.error }\n\t\tsummation / predictions.size\t\n\tend",
"def average\n @data['average']\n end",
"def mean_samples(samples)\n samples[0].to_a.zip(*samples[1..-1].map(&:to_a)).map do |colors|\n colors.reduce(:+).to_f / colors.length\n end\n end",
"def mean() \n return error_list.inject{|s,n| s + n}/(error_list.size * 1.0)\n end",
"def get_mean(collection)\n collection_length = collection.length\n total = 0\n total = collection.inject( nil ) { |sum,x| sum ? sum+x : x }\n (total.to_f / collection_length.to_f)\n end",
"def mean()\n return self.sample( 0.5 )\n end",
"def mean\n get_errors\n sum = 0\n @errors.each {|e| sum += e}\n avg = sum / @total_predictions.to_f\n return avg\n end",
"def average (anArray)\n\n\t#if the array is empty...\n\tif anArray.empty?\n\t\treturn 0.0\n\n\t# otherwise, return the sum divided by the number of values\n\telse\n\t\treturn sum(anArray) / anArray.size\n\tend\nend",
"def mean(values)\n mu = values[0].to_f\n return mu if values.count == 1\n (2..values.count).each do |n|\n mu = ((n - 1).to_f / n) * (mu + values[n-1] / (n - 1) )\n end\n mu\nend",
"def show_bins\n bs = bin_size\n p bs\n\n mean = bs.inject(0.0) {|sum, (id,n)| sum + n} / N_BINS\n variance = bs.inject(0.0) {|sum_sqerr, (id,n)|\n sum_sqerr + (n - mean)**2} / (N_BINS-1)\n printf \"mean : %14d\\n\" % mean\n printf \"stdev: %14d\\n\" % Math.sqrt(variance)\n end",
"def average\n return self.sum / self.length.to_f\n end",
"def mean(indicies=[])\n remaining_indicies_cross_product =\n index_iterator(start=indicies.size)\n alldata = remaining_indicies_cross_product.map { |remaining| self[*(indicies + remaining)] }\n Kalibera.mean(alldata)\n end",
"def odb_avg\n \"avg(#{to_s})\"\n end",
"def mean_squared_error\n index_allocation = Index.m10.allocations.at(timestamp).take\n\n # FIXME: raise NotImplementedError if Index.count > 1\n raise MissingIndexAllocationError if index_allocation.nil?\n\n squared_error_sum =\n index_allocation.to_h.reduce(0) { |sum, (symbol, component_weight)|\n constituent_weight = constituent_weights[symbol] || 0\n\n absolute_error = constituent_weight - component_weight\n relative_error = absolute_error / component_weight\n\n sum + relative_error**2\n }\n\n squared_error_sum / constituent_weights.size\n end"
] |
[
"0.645113",
"0.62902164",
"0.6277264",
"0.6002737",
"0.59984004",
"0.59034187",
"0.58576417",
"0.5840206",
"0.5817501",
"0.5807346",
"0.57853055",
"0.5761594",
"0.5751396",
"0.57219946",
"0.5708449",
"0.5659274",
"0.56562865",
"0.5637644",
"0.56335825",
"0.56172955",
"0.55988884",
"0.5588993",
"0.5543781",
"0.5541644",
"0.5473823",
"0.54613394",
"0.5424409",
"0.54166967",
"0.5413302",
"0.53851557",
"0.5366576",
"0.5360271",
"0.5358833",
"0.53511775",
"0.5314684",
"0.5309684",
"0.5268572",
"0.52654696",
"0.52577204",
"0.52506566",
"0.52504903",
"0.5247801",
"0.5247383",
"0.52240115",
"0.5218292",
"0.5215478",
"0.5213347",
"0.51962316",
"0.51838917",
"0.5168324",
"0.5162444",
"0.5146324",
"0.5125837",
"0.51200205",
"0.51174545",
"0.51023656",
"0.5102022",
"0.5100997",
"0.50978816",
"0.5097156",
"0.50871855",
"0.5086487",
"0.5083884",
"0.5082135",
"0.50803274",
"0.5078834",
"0.5072328",
"0.50713617",
"0.50664824",
"0.5062642",
"0.50401604",
"0.50332",
"0.50210875",
"0.5020863",
"0.5012139",
"0.50090563",
"0.50037813",
"0.5002646",
"0.49889466",
"0.49832255",
"0.49765062",
"0.49706635",
"0.4966337",
"0.4958928",
"0.49578303",
"0.49573755",
"0.495551",
"0.495037",
"0.49434188",
"0.4931782",
"0.49252105",
"0.49235362",
"0.49220946",
"0.49217325",
"0.49215677",
"0.49075302",
"0.49046773",
"0.49027312",
"0.48957497",
"0.48916203"
] |
0.6714202
|
0
|
Initialize from an XML file.
|
def initialize(xml_file_name)
@xml_file_name = xml_file_name
@kinvars = Array.new
doc = REXML::Document.new(File.new(xml_file_name))
kv_elem = doc.elements['kinematic-variables']
kv_elem.elements.each('kinvar'){|kv| @kinvars.push Kinvar.new(kv)}
@data_file = kv_elem.elements['dat-file'].attributes['file']
@file = File.new(@data_file,'rb')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(path)\n @filename = path\n file = nil\n file = open(path)\n @errors = [] \n \n @document = Nokogiri::XML(file)\n @document.remove_namespaces!\n @node = @document.root\n unless self.valid?\n self.errors << {:xml => 'invalid xml passed in'}\n #raise \"Unable to load file. Is it in the correct format?\"\n end\n end",
"def initialize(xml)\n @source = isxml?(xml) ? xml : File.read(xml)\n @doc_stream = AltoDocStream.new\n parser = Nokogiri::XML::SAX::Parser.new(doc_stream)\n parser.parse(@source)\n end",
"def initialize(file_content)\n # Open XML file\n self.fichero = file_content\n # Initialize XML Document\n @doc = Document.new self.fichero\n # Initialize attribute default values\n self.lista_devoluciones = []\n end",
"def from_xml(xml)\n\t\tend",
"def initialize(run, xml)\n @run = run\n\n parse_xml(xml)\n end",
"def initialize(*args)\n\t\t\t@elements = []\n\t\t\tload_xml(args[0]) if args[0].kind_of? REXML::Element\n\t\tend",
"def from_file(file_path)\n from_xml(File.read(file_path))\n end",
"def initialize(file)\n\t\t@file = file\n\t\t@doc = Hpricot.XML(file)\n\tend",
"def initialize(xml_elem, xrc_file)\n @xml_src = xml_elem\n @file_name = xrc_file\n\n @base_id = xml_elem.attributes['name']\n @wx_class = xml_elem.attributes['class']\n @sub_class = xml_elem.attributes['subclass']\n @controls = []\n read_controls\n end",
"def parse_xml(filename)\n @parser = Parser.new :pregenerated => filename\n @parser.parse\n end",
"def init_from_xml(xmlDoc)\r\n @type = xmlDoc.expanded_name\r\n xmlDoc.each_element(\"ID\") { |e| @procID = e.text }\r\n xmlDoc.each_element(\"GROUP\") { |e| @group = e.text }\r\n xmlDoc.each_element(\"PATH\") { |e| @path = e.text }\r\n xmlDoc.each_element(\"ARGSLINE\") { |e| @cmdLineArgs = e.text }\r\n xmlDoc.each_element(\"ENV\") { |e| @env = e.text }\r\n # Dump the XML description of the OML configuration into a file\r\n xmlDoc.each_element(\"OML_CONFIG\") { |config|\r\n configPath = nil\r\n config.each_element(\"omlc\") { |omlc|\r\n configPath = \"/tmp/#{omlc.attributes['exp_id']}-#{@procID}.xml\"\r\n }\r\n f = File.new(configPath, \"w+\")\r\n config.each_element {|el|\r\n f << el.to_s\r\n }\r\n f.close\r\n # Set the OML_CONFIG environment with the path to the XML file\r\n @env << \" OML_CONFIG=#{configPath} \"\r\n }\r\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def parse_xml(xml)\n new from_xml(xml)\n end",
"def initialize(xml_path, namespace='vmw')\n @xml_path = xml_path\n load\n @xml.root.add_namespace namespace, NameSpaces[namespace]\n @namespace = namespace\n end",
"def initialize(itunes_xml_file_name) \n @lib = ItunesParser::Library.new \n @lib.parse(File.read(itunes_xml_file_name))\n end",
"def init\n f = File.open(@pref_file)\n @doc = Nokogiri::XML(f)\n f.close\n @doc.remove_namespaces! \n end",
"def from_xml(xml)\n @xml = xml\n self.before_from_xml if defined?(before_from_xml)\n from_xml_via_map(@xml)\n end",
"def initialize(run, xml)\n super(run, xml)\n\n @error = false\n @structure = parse_data(xml_first_child(xml))\n\n # cached outputs\n @values = nil\n @refs = nil\n @types = nil\n @sizes = nil\n @total_size = nil\n end",
"def initialize(xml_file)\n doc_taxonomies = LonelyPlanet::Doc.load xml_file\n taxonomies_fragement = doc_taxonomies.css 'taxonomy > node'\n @continents = []\n set_continents(taxonomies_fragement)\n end",
"def load_xml(str)\r\n @xml = REXML::Document.new(str.to_s)\r\n xml_to_instance\r\n self\r\n end",
"def initialize(filename)\n @reader = GedReader.new(filename)\n @builder = Builder::XmlMarkup.new(:indent=>2)\n @builder.gencom { parse }\n @xml = @builder.target!\n end",
"def initialize( xml_file, *options )\n @node_name = \"00000\"\n\t @show_text = true\n\t @show_attributes = true\n\n if options and options[0]\n options[0].each do |xKey, xValue|\n case xKey.to_s\n when \"text\"\n @show_text = xValue\n\t\t options[0].delete( xKey )\n when \"attrs\"\n @show_attributes = xValue\n\t\t options[0].delete( xKey )\n end\n end\n end\n\n @rexml_document = REXML::Document::new( File::new( xml_file ) )\n @graph = GraphViz::new( \"XML\", *options )\n parse_xml_node( @rexml_document.root() )\n end",
"def load_XML(file)\n begin\n xml_file = File.open(file)\n xml_obj = Document.new(xml_file)\n xml_file.close\n rescue => e\n puts \"ERROR: Unable to create XML object from file: #{file}\"\n puts e.message\n puts e.backtrace\n exit 1\n end\n return xml_obj\nend",
"def initialize(stats_xml)\n\t\t\t@hash = Hash.new\n\t\t\tfile = File.new(stats_xml)\n\t\t\tdoc = Document.new file\n\t\t\tprocess_xml(doc)\n\t\tend",
"def initialize(xml, fileName, pa, responseDir)\r\n @responseDir = responseDir\r\n @xml = REXML::Document.new(xml) \r\n @fileName = fileName\r\n @nps = []\r\n @seed = 0\r\n\r\n \tif pa == nil\r\n\t \t@parseAdapter = ParseAdapter.new\r\n\t else\r\n\t \t@parseAdapter = pa\r\n \tend\r\n end",
"def from_xml(*args, &block)\n create_represented(*args, &block).from_xml(*args)\n end",
"def load_from_xml(xml_text)\n item = parse_xml(xml_text)\n if block_given? then self.create(item) { |i| yield(i) }\n else self.create(item)\n end\n end",
"def initialize(xFile)\n @xNodeName = \"00000\"\n\t @bShowText = true\n\t @bShowAttrs = true\n \n @oReXML = REXML::Document::new( File::new( xFile ) )\n @oGraph = \"digraph XML {\\n\"\n _init( @oReXML.root() )\n @oGraph << \"}\\n\"\n end",
"def initialize(configuration_file_location)\t\t\r\n\t\tfile = File.new( configuration_file_location )\r\n\t\tdoc = REXML::Document.new file\r\n\t\t\r\n\t\t@visitor = doc.elements[\"honeyCConfiguration/visitor\"].text\r\n\t\t@queuer = doc.elements[\"honeyCConfiguration/queuer\"].text\r\n\t\t@analysis_engine = doc.elements[\"honeyCConfiguration/analysisEngine\"].text\r\n\tend",
"def initialize(xml)\n #puts \"________________________________________\"\n #puts xml\n #puts \"________________________________________\"\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def initialize(nokogiri_xml, client)\n @xml = nokogiri_xml.to_xml\n @client = client\n @attributes = Vebra.parse(nokogiri_xml)\n end",
"def DataLoadFromFile(filename)\n file = File.new(filename)\n \n @xml_data = file\n self.ScrapAnalyse()\n end",
"def initialize(xml)\n @xml = xml.to_s\n @id = xml.at('id').inner_html\n @updated = DateTime.parse(xml.at('updated').inner_html)\n @title = xml.at('title').inner_html\n @dimensions = xml.search('dxp:dimension').collect do |dimension|\n { dimension.attributes['name'].split(':').last.to_sym => dimension.attributes['value'].split(':', 1).last }\n end\n @metrics = xml.search('dxp:metric').collect do |metric|\n { metric.attributes['name'].split(':').last.to_sym => metric.attributes['value'].split(':', 1).last.to_i }\n end\n end",
"def load_xml(file_path)\n # Read the source XML file.\n puts \"file_path: #{file_path}\"\n raw_xml = File.read(file_path)\n\n # Parse raw_xml using Nokogiri.\n parsed_doc = Nokogiri.XML(raw_xml)\nend",
"def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def initialize(xmldata=\"\")\n setPerson(xmldata)\n end",
"def load_xml file\n f = File.open file\n doc = Nokogiri::XML f\n f.close\n doc\n end",
"def initialize(file_path)\n @document = nokogiri_xml(file_path)\n @root_node = TaxGenerator::TaxonomyNode.new('ROOT', 'ROOT')\n @taxonomies = []\n find_taxonomies\n end",
"def initialize(xml_elem)\n @name = xml_elem.attributes['name']\n @num_bins = xml_elem.attributes['num-bins'].to_i\n @range_min = xml_elem.attributes['min'].to_f\n @range_max = xml_elem.attributes['max'].to_f\n @title = xml_elem.attributes['title']\n end",
"def initialize(sopm_file)\n\n @sopm_file = sopm_file\n\n sopm_read_handle = File.open(@sopm_file)\n @sopm = Nokogiri::XML(sopm_read_handle)\n sopm_read_handle.close\n\n parse\n end",
"def initialize_xml(xml, root_element)\n @xml = XMLElement.build_xml(xml, root_element)\n\n if OpenNebula.is_error?(@xml)\n @xml = nil\n else\n if NOKOGIRI\n if @xml.size == 0\n @xml = nil\n end\n else\n if @xml.name != root_element\n @xml = nil\n end\n end\n end\n @xml\n end",
"def xml_parser(directory_name, filename)\n @doc = Document.new File.new(directory_name + filename)\n get_dataset_name(filename)\n set_topics\n set_dataset_rel_and_attr\n get_footnotes\n record_attributes\n @dataset.save\n end",
"def initialize(file)\n @file = parse(file)\n end",
"def initialize(data, changeset)\n @reader = XML::Reader.string(data)\n @changeset = changeset\n # document that's (re-)used to handle elements expanded out of the\n # diff processing stream.\n @doc = XML::Document.new\n @doc.root = XML::Node.new(\"osm\")\n end",
"def initialize(file = \"../data/iTunes\\ Music\\ Library.xml\")\n @tracks, @playlists = [], []\n self.parse(file)\n end",
"def initialize(filename)\n @filename = filename\n Powirb.log.debug(\"Retrieving workitem from #{@filename}\")\n begin\n\t @doc = Nokogiri::XML(open(@filename))\n\trescue Exception => e\n\t Powirb.log.error(e)\n\tend\t\n end",
"def initialize(run, xml)\n super(run, xml)\n\n @value = nil\n @file = nil\n @remote_file = false\n end",
"def initialize(filepath, binary_filepath = nil)\n\n sax = ImzML::Sax.new\n\n # If no external file were specified, behave like the file has the same name\n # as the metadata\n if binary_filepath.nil?\n name = filepath.split(\".\")[0..-2].join(\".\")\n binary_filepath = [name, \"ibd\"].join(\".\")\n end\n sax.binary_filepath = binary_filepath\n\n # parse the XML\n Ox.sax_parse(sax, File.open(filepath))\n @metadata = sax.metadata\n\n end",
"def load_xml_document file_name\n xml_file = File.new file_name, \"r\"\n return Document.new xml_file\n end",
"def initialize(ead_file)\n @xml = Nokogiri::XML(open(ead_file))\n @doc = {}\n self.getID\n self.getFormatFacet\n self.getTitle\n self.getSubjects\n self.getGeographicSubjects\n self.getPublisherFacet\n self.getGenreFormatFacet\n self.getLanguageFacet\n self.getAbstract\n self.getBiogHist\n #self.getEAD\n end",
"def from_xml(xml)\n b = xml.at(\"//xmlns:bibitem|//xmlns:bibdata\")\n r = mn2relaton_parser(xml.root.name)\n r.from_xml(b.to_xml)\n end",
"def load_xml(xml)\n @mmdoc = REXML::Document.new(xml)\n end",
"def load!(xml)\n root = Nokogiri::XML(xml).root\n try(root.xpath(\"//network\")) do |network|\n try(network.xpath(\"name\")) { |result| self.name = result.text }\n try(network.xpath(\"uuid\")) { |result| self.uuid = result.text }\n try(network.xpath(\"bridge\")) { |result| self.bridge = Bridge.new(result) }\n try(network.xpath(\"ip\")) { |result| self.ip = IP.new(result) }\n end\n end",
"def init\n super\n @parser = Nokogiri::XML::SAX::Parser.new(self)\n end",
"def initialize(template_filename)\n unless File.exists? template_filename\n raise ArgumentError, \"Template file provided doesn't exist: #{template_filename}\"\n end\n @filename = template_filename\n @code = File.basename @filename, '.xml'\n @product = @code.split('_')[0]\n @xml_doc = nil\n end",
"def initialize (file_name, doc)\n begin\n @arch = doc.root.elements[\"diffnode/arch\"].text\n @sys = doc.root.elements[\"diffnode/sys\"].text\n @os = doc.root.elements[\"diffnode/os\"].text\n @osver = doc.root.elements[\"diffnode/osver\"].text\n @user = doc.root.elements[\"diffnode/user\"].text\n @time = doc.root.elements[\"diffnode/time\"].text\n rescue\n Wired::Dataset::format_error(file_name, __LINE__)\n end\n end",
"def load_xml(source)\n #begin\n if source.is_a? Nokogiri::XML::Document\n @document = source\n else\n #source =~ /\\<DIF\\>/\n if source.size < 255 and File.exists? source\n source = File.read source\n end\n @document = Nokogiri::XML::Document.parse( source, nil, nil ) #, Nokogiri::XML::ParseOptions::NOBLANKS\n end\n # Sets all properties like Entry_ID for this instance\n load_hash(document_to_hash)\n \n #rescue => e\n #puts e.backtrace\n #raise ArgumentError, \"Cannot load DIF XML: \" + e.message[0..255]\n #end\n end",
"def from_file(filename, encoding = nil, options = Nokogiri::XML::ParseOptions::DEFAULT_XML)\n file = File.open(filename)\n @mods_ng_xml = Nokogiri::XML(file)\n file.close\n normalize_mods\n end",
"def initialize(file)\n if file.is_a?(File)\n @gpx=Nokogiri::XML(File.open(file))\n else\n @gpx=Nokogiri::XML(file)\n end\n @creator = @gpx.at_css(\"gpx\")[\"creator\"] rescue nil\n @time = Time.parse(@gpx.at_css(\"metadata time\").text) rescue nil\n @tracks = []\n @gpx.css(\"trk\").each do |trk|\n trk = Track.new(trk)\n @tracks << trk\n end\n # get name spaces\n ns = @gpx.collect_namespaces\n # Strip the leading xmlns: from each namespace key, and store in a new hash\n @namespaces= {}\n ns.each_pair do |key, value|\n @namespaces[key.sub(/^xmlns:/, '')] = value\n end\n end",
"def load_xml(file_name = @file_name)\n\t\tputs \"loading xml...\"+file_name\n\t\ttweet_loader = TweetLoader.new(file_name)\n\t\ttweet_loader.load_tweets\n\t\t@tweets = tweet_loader.get_tweets\n\tend",
"def initialize(xml = nil, edge = nil)\n scanXml(xml, edge) if(!xml.nil?) ;\n end",
"def initialize(file_path = nil)\n if file_path\n @file_path = file_path\n @doc = File.open(file_path, 'r') do |f|\n REXML::Document.new(f)\n end\n @doc.context[:attribute_quote] = :quote\n\n @scheme = @doc.elements['Scheme']\n else\n @doc = REXML::Document.new\n @doc.context[:attribute_quote] = :quote\n @doc << REXML::XMLDecl.new(REXML::XMLDecl::DEFAULT_VERSION, 'UTF-8')\n\n @scheme = @doc.add_element 'Scheme'\n @scheme.attributes['LastUpgradeVersion'] = Constants::LAST_UPGRADE_CHECK\n @scheme.attributes['version'] = Xcodeproj::Constants::XCSCHEME_FORMAT_VERSION\n\n self.build_action = BuildAction.new\n self.test_action = TestAction.new\n self.launch_action = LaunchAction.new\n self.profile_action = ProfileAction.new\n self.analyze_action = AnalyzeAction.new\n self.archive_action = ArchiveAction.new\n end\n end",
"def initialize(f) # f can be pathname or string\n @doc = Nokogiri::XML::Document.parse(f, &:noblanks) # Nokogiri handles both\n @top = @doc.search(\"body\").first\n self.firstSummit()\n end",
"def load_xml_doc( filename )\n File.open( filename, 'r') do |file|\n return Oga.parse_xml( file )\n end\n\n puts \"ERROR: loading #{filename}\"\n return nil\n end",
"def initialize(filename)\n @filename = filename\n parse()\n end",
"def initialize(xml=nil, target=nil, options={}, &block)\n \n @read_at = Time.new\n @noko = nil\n @source_xml = nil\n \n ## Use XML to build object\n from_xml(xml) if xml\n \n ## Use block for further configuration or manual creation\n self.instance_eval(&block) if block\n\n end",
"def from_xml(xml, opts=OPTS)\n from_xml_node(Nokogiri::XML(xml).children.first, opts)\n end",
"def initialize(test, file_path)\n # Needs the test object for accessing assertions.\n self.test = test\n self.file_path = file_path\n # Clean up after.\n ObjectSpace.define_finalizer(self, method(:finalize))\n File.open(file_path, 'r') do |file|\n self.root = REXML::Document.new(file).root\n end\n nil\n end",
"def load_from_xml(node)\n # Get all information from the root's children nodes\n node.children.each do |child|\n case child.name.to_s\n when 'id'\n @id = child.content.to_i\n when 'title'\n @title = child.content\n when 'image'\n check_image_node(child)\n when 'date'\n @date = Time.parse(child.content)\n when 'streamable'\n check_streamable_node(child)\n when 'size'\n @size = child.content.to_i\n when 'description'\n @description = child.content\n when 'duration'\n @duration = child.content.to_i\n when 'creator'\n @creator = child.content\n when 'url'\n @url = child.content\n when 'text'\n # ignore, these are only blanks\n when '#text'\n # libxml-jruby version of blanks\n else\n raise NotImplementedError, \"Field '#{child.name}' not known (#{child.content})\"\n end #^ case\n end #^ do |child|\n end",
"def from_xml(xml)\n hash = Hash.from_xml(xml).values.first\n self.all_attributes = hash\n end",
"def initialize(xml_data)\n initialize_data(Sequel.postgres('roadworks'), xml_data)\n end",
"def initialize(xml_str, spec_yaml_str=nil)\n # Flag for the time string format\n @show_seconds = false\n\n raise ArgumentError.new('Parser initiation requires XML String argument') if xml_str.nil? or xml_str.empty?\n if spec_yaml_str.nil? or spec_yaml_str.empty?\n @@spec = YAML::load(File.read(File.expand_path('../../../conf/nemsis_spec.yml', __FILE__)))\n else\n @@spec = YAML::load(spec_yaml_str)\n end\n self.xml_str = xml_str\n self.xml_doc = Nokogiri::XML(xml_str)\n xml_doc.remove_namespaces!\n end",
"def initialize(configuration_file_location)\n\t\t@rules_location = \"\"\n\t\t\n\t\tfile = File.new( configuration_file_location )\n\t\tdoc = REXML::Document.new file\n\t\t\n\t\t@rules_location = doc.elements[\"snortRulesAnalysisEngineConfiguration/rulesLocation\"].text \n\tend",
"def initialize()\n @models = {}\n @path = Settings.get[\"trxml\"][\"path\"]\n @xmls = Settings.get[\"trxml\"][\"xmls\"]\n\n create_models\n end",
"def load_from_xml(node)\n # Get all information from the root's children nodes\n node.children.each do |child|\n case child.name.to_s\n when 'id'\n @id = child.content.to_i\n when 'title'\n @title = child.content.to_s\n when 'artists'\n @artists = [] if @artists.nil?\n child.children.each do |artist|\n @artists << Artist.new(:name => artist.content) if artist.name == 'artist'\n @headliner = Artist.new(:name => artist.content) if artist.name == 'headliner'\n end\n @artists << @headliner unless @headliner.nil? || headliner_alrady_listed_in_artist_list?\n when 'image'\n check_image_node(child)\n when 'url'\n @url = child.content\n when 'description'\n @description = child.content\n when 'attendance'\n @attendance = child.content.to_i\n when 'reviews'\n @reviews = child.content.to_i\n when 'tag'\n @tag = child.content\n when 'startDate'\n @start_date = Time.parse(child.content)\n when 'startTime'\n @start_time = child.content\n when 'endDate'\n @end_date = Time.parse(child.content)\n when 'tickets'\n # @todo Handle tickets\n when 'venue'\n @venue = Venue.new_from_xml(child)\n when 'website'\n @website = child.content.to_s\n when 'text'\n # ignore, these are only blanks\n when '#text'\n # libxml-jruby version of blanks\n else\n raise NotImplementedError, \"Field '#{child.name}' not known (#{child.content})\"\n end #^ case\n end #^ do |child|\n @artists.uniq!\n end",
"def initialize(xrc_file)\n @xrc_file = xrc_file\n xml_content = File.read(xrc_file)\n # workaround for an ?bug in recent REXML, which fails to match\n # certain XPath expressions when xmlns is declared\n xml_content.sub!(/xmlns=\"[^\"]+\"/, '')\n @xml_doc = REXML::Document.new(xml_content)\n @classes = []\n REXML::XPath.each(@xml_doc.root, \"/resource/object\") do | elem |\n if xml_klass = XRCClass.extract(elem, @xrc_file)\n @classes << xml_klass\n end\n end\n end",
"def initialize(xml)\r\n @title = xml.split(/<\\/?title>/)[1] # delim stroku po tegam <title> i </title>\r\n\t@link = xml.split(/<\\/?link>/)[1]\r\n\t@description = xml.split(/<\\/?description>/)[1]\r\n\t@language = xml.split(/<\\/?language>/)[1]\r\n\t@pubDate = xml.split(/<\\/?pubDate>/)[1]\r\n\t\r\n\t# polu4aem rezultat ot delenija po tegam <item> i </item>\r\n\t# i raspechatyvaem\r\n\t@items = Array.new\r\n\txml.split(/<\\/?item>/).each do |item|\r\n\t # sozdaem novyj objekt klassa Item esli \r\n\t # v peremennoj item est' teg <title>\r\n\t @items << Item.new(item) if item.include?(\"<title>\")\r\n\tend\r\n end",
"def initialize(docx_file_path)\n # Use the private getter to access @doc within this class.\n @doc = Docx::Document.open(docx_file_path)\n end",
"def initialize(xml=nil)\n @bridge = Bridge.new\n @ip = IP.new\n\n load!(xml) if xml\n end",
"def initialize(xml, client)\n @tags ||= Hash.new\n @metrics ||= Hash.new\n @doc ||= Nokogiri::XML(xml)\n @client = client\n\n init_tags\n init_metrics\n init_custom_metrics\n end",
"def initialize (file_name, doc)\n begin\n @name = doc.root.elements[\"delta/file/name\"].text\n @sha = doc.root.elements[\"delta/file/sha\"].text\n @app = doc.root.elements[\"delta/app/name\"].text\n @nsrl = doc.root.elements[\"delta/app/nsrl\"].text\n @action = doc.root.elements[\"delta/app/action\"].text\n rescue\n Wired::Dataset::format_error(file_name, __LINE__)\n end\n end",
"def initialize(xmldoc)\n @xmldoc = xmldoc\n @output = {}\n end",
"def xml_load(file_path)\n result = MultiXml.parse(File.read(file_path)).to_smash[:configuration]\n xml_format(result)\n end",
"def initialize(xml_node, instance: nil)\n @xml_node = xml_node\n @instance = instance\n end",
"def from_xml_node(parent, opts=OPTS)\n new.from_xml_node(parent, opts)\n end",
"def from_xml(data, *args)\n xml = Nokogiri::XML::Node.from(data)\n\n create_from_xml(*args).tap do |inst|\n refs = representable_attrs.map {|attr| XML.binding_for_definition(attr) }\n \n refs.each do |ref|\n value = ref.value_in(xml)\n \n inst.send(ref.definition.setter, value)\n end\n end\n end",
"def initialize\n bootstrap unless File.exist?(file)\n load_attributes\n end",
"def initialize\n @macbeth = Nokogiri::XML(open(\"http://www.ibiblio.org/xml/examples/shakespeare/macbeth.xml\"))\n end",
"def initialize(file)\n @file = File.expand_path(file)\n fail \"Can't find file #{@file}\" unless File.exist?(@file)\n @dir = File.dirname(@file)\n IO.readlines(@file).each { |line| initialize_data line }\n @configuration = Configuration.new(self)\n @semver = Versioning.find(@dir)\n end",
"def initialize(filename=nil)\n self.load(filename) if filename\n @schema = nil\n end",
"def initialize(pid, name, xml_document)\n feed = feed\n @pid = pid\n @name = name\n @xml_document = xml_document\n end",
"def read_xml(xml)\n REXML::Document.new(File.read(xml)).root\nend",
"def parse_xml\n\n raise \"parse_xml method has not been implemented in this class\"\n \n end",
"def load_from_xml(f)\n case f\n when Array\n f.each { |filename| load_from_xml(filename) }\n when String\n load_from_xml(File.open(f))\n when IO\n tf = PROIELXML::Reader.parse_io(f)\n\n tf.proiel.sources.each do |s|\n @sources << Source.new(self, s.id, tf.proiel.export_time, s.language, s.dialect,\n bundle_metadata(s), s.alignment_id) do |source|\n build_divs(s, source)\n end\n\n index_source_objects!(@sources.last)\n end\n\n tf.proiel.dictionaries.each do |s|\n @dictionaries << Dictionary.new(self, tf.proiel.export_time, s.language, s.dialect, s)\n\n index_dictionary_objects!(@dictionaries.last)\n end\n\n annotation_schema = AnnotationSchema.new(tf.proiel.annotation)\n schema_version = tf.proiel.schema_version\n\n @annotation_schema ||= annotation_schema\n @schema_version ||= schema_version\n\n if @annotation_schema == annotation_schema and @schema_version == schema_version\n # FIXME: consolidate export times? This is a design flaw in PROIEL XML\n # 2.0: export time ought to be per source not per PROIEL XML file, so\n # not clear what to do here. Pass it down to the source object?\n # @export_time = tf.proiel.export_time\n else\n raise SchemaMismatch\n end\n else\n raise ArgumentError, 'expected filename, IO or array of these'\n end\n\n self\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end"
] |
[
"0.75647366",
"0.75392306",
"0.74263066",
"0.735098",
"0.73483664",
"0.7246494",
"0.7193181",
"0.7160576",
"0.7109422",
"0.7074879",
"0.7071975",
"0.70292604",
"0.70292604",
"0.70292604",
"0.69244003",
"0.6913879",
"0.6911274",
"0.68244284",
"0.6816221",
"0.6794409",
"0.6790218",
"0.67826223",
"0.67273575",
"0.66870606",
"0.668069",
"0.6621295",
"0.6607551",
"0.6600859",
"0.6580102",
"0.65772766",
"0.6561396",
"0.6559156",
"0.6556704",
"0.6539795",
"0.65316856",
"0.6514847",
"0.6510669",
"0.6510669",
"0.6508748",
"0.65062773",
"0.64949393",
"0.646555",
"0.6458548",
"0.64412695",
"0.64265805",
"0.6418624",
"0.64184946",
"0.64184916",
"0.6415278",
"0.6409607",
"0.6371812",
"0.6345153",
"0.63123894",
"0.6311242",
"0.6305991",
"0.6301273",
"0.6300649",
"0.6294268",
"0.62903106",
"0.6288948",
"0.6254921",
"0.62510973",
"0.62474155",
"0.62395984",
"0.62311625",
"0.6220613",
"0.62126845",
"0.6211248",
"0.6190149",
"0.6188939",
"0.61869913",
"0.61854434",
"0.61813223",
"0.6153356",
"0.6151164",
"0.61294764",
"0.60857445",
"0.6085737",
"0.6081391",
"0.6054884",
"0.601017",
"0.60063434",
"0.6004828",
"0.5983736",
"0.5974855",
"0.5970121",
"0.59638524",
"0.5962933",
"0.59616673",
"0.59599817",
"0.59521407",
"0.5933708",
"0.5933707",
"0.5927491",
"0.5912699",
"0.5902659",
"0.5891628",
"0.5875756",
"0.5875756",
"0.5875756"
] |
0.72503155
|
5
|
Returns the Kinvar object w/ name _kinvar_
|
def [](kinvar)
@kinvars.each{|kv| return kv if(kv.name == kinvar)}; nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_variable(name)\n NetCDF::Variable.new(@netcdf_elmt.findVariable(name))\n end",
"def variable(name)\n var = nc.var(name) # NetCDFVar\n get(var)\n end",
"def to_nvar(name)\n self.class.to_nvar(name)\n end",
"def ivg(o,vn)\n o.instance_variable_get(vn.to_s)\nend",
"def get_var(key)\n @varset.get_var(key)\n end",
"def variable_by_name(name)\n @var_set[name]\n end",
"def conv_ruby_var\n return @name\n end",
"def set_kinodom\n @kinodom = Kinodom.find(params[:id])\n end",
"def varName\n \"#{entity.name}_#{name}\"\n end",
"def instance_variable_ged name\n var = get_instance_variable name.to_s[1 .. -1].to_sym\n #puts \"getting #{name} #{var}\"\n var\n end",
"def varietal_name\n if varietal.nil? || varietal.name.nil?\n return nil\n else\n varietal.name\n end\n end",
"def set_kindergarten\n @kindergarten = Kindergarten.find(params[:id])\n end",
"def getVar( name )\n\t\t\t\tArgTest::type( \"name\", name, String )\n\t\t\t\tname.strip!()\n\t\t\t\tArgTest::stringLength( \"name\", name, 1 )\n\t\t\t\treturn @vars[ name ]\n\t\t\tend",
"def get_var\n # I will nillify obj if they are blank\n @var = nil if @var.blank?\n @config.delete(:var) if @config[:var].blank?\n\n # Return a correct var\n current_var = (@var || @config[:var] || build_var)\n @prefix.to_s + current_var.to_s\n end",
"def get_variable(var_name)\n return nil unless @type_library\n self.classes.each do |class_name|\n found = self.constant_for(class_name.name).variables.find {|var| var.name == var_name}\n return found if found\n end\n end",
"def vin\n @vin ||= Vin.new(\n fetch(\n path: Vin::PATH.call(id)\n )\n ).vin\n end",
"def var name\n Symbolic.check_name name\n var = VarExpr.new(name)\n meta_def name do\n var\n end\n var\n end",
"def find_name(name)\n\t\tif @vartab[name]\n\t\t\treturn @vartab[name]\n\t\telse\n\t\t\treturn @parent.find_name(name) if @parent\n\t\tend\n\t\traise \"Variable '%s' not defined...\" % name\n\tend",
"def var_name()\n if self.id.start_with?(/\\Ah?l_/i)\n return self.id.downcase\n else\n return \"l_#{self.id.downcase}\"\n end\n end",
"def var_prefix\n # ugh, i was generating meta/qb.yml files that set 'var_prefix' to\n # `null`, but it would be nice to\n # \n meta_or 'var_prefix', namespaceless\n end",
"def [](key)\n @varset[key]\n end",
"def name\n self['VolumeName']\n end",
"def k_var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n\n\n type = K_VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 357:4: 'var'\n match( \"var\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n\n end",
"def variable_name; end",
"def variable_name; end",
"def to_nvar(name)\n name[0] == at ? name[1..-1].to_sym : name.to_sym\n end",
"def get_variable(name)\n @variables[name]\n end",
"def i_var\n to_i_var(@name)\n end",
"def [](key, name = nil)\n if name\n h = @var_map[key]\n h && h[name]\n else\n @var_map[key]\n end\n end",
"def set_kinofilm\n @kinofilm = Kinofilm.find(params[:id])\n end",
"def name\n @knob.name\n end",
"def read\n num_kv = @kinvars.length\n unpck = String.new\n num_kv.times{unpck += 'd'}\n vals = @file.read(num_kv*8).unpack(unpck)\n vals_hash = Hash.new\n num_kv.times{|kv| vals_hash[@kinvars[kv].name] = vals[kv]}\n vals_hash\n end",
"def get_variable( var_name)\n\t\tvar = Vim::evaluate(\n\t\t\t\"exists(\\\"#{var_name}\\\") ? #{var_name} : \\\"__NIL__\\\"\"\n\t\t)\n\n\t\tvar == '__NIL__' ? nil : var\n\tend",
"def getKelvin()\n if scale =~ /f/ then\n Temperature.new((@degrees-32)*(5.0/9)+273.15, \"k\")\n elsif scale =~ /c/ then\n Temperature.new(@degrees + 273.15, \"k\")\n else\n Temperature.new(@degrees, @scale) \n end\n end",
"def ivar_get(name)\n instance_variable_get(\"@#{name}\")\n end",
"def _get_var(name)\n\t\treturn @replace_vars[name]\n\tend",
"def var\n\t\t@var ||= \"aljfhnkjlngdkjfj\" #ekvivalen na konstruktor po podrazbirane\n\tend",
"def vm_instance(name)\n @conn.vminstances.get(name)\n end",
"def ivar(name)\n var_name = \"@_#{name}\"\n if instance_variable_defined?(var_name)\n return instance_variable_get(var_name)\n else\n false\n end\n end",
"def name\n object[\"name\"]\n end",
"def set_kokuin\n @kokuin = Kokuin.find(params[:id])\n end",
"def var\n @_var ||= MXNet::Symbol.var(@name, shape: shape, dtype: dtype,\n lr_mult: lr_mult, wd_mult: wd_mult,\n init: @init) # FIXME: init -> initializer\n end",
"def simpkv\n @simpkv\nend",
"def name\n @this_dogs_name\n #here we defined a instance variable \n #instance variabler means is that the scope of the variable is to the instace itself\n #Instance variables live in, and are visible everywhere in the object’s scope\n end",
"def vars\n @vars ||= soln.keys\n @vars\n end",
"def variable_get(name)\n assert_type name, :String, :name\n environment.caller.var(name.value)\n end",
"def marketDataVar(var)\n if var.kind_of? Hash\n raise 'Mal formed var ' + var.inspect.to_s if (var.keys.size != 1 || var.values.size != 1)\n return var.keys[0]\n else\n return var\n end \n end",
"def getposname()\r\n return getvalue(SVTags::POS_NAME)\r\n end",
"def return_value\n var_name\n end",
"def value_get name\n instance_variable_get(:\"@#{name}\")\n end",
"def Noun(word)\n Noun[word]\n end",
"def kid_id\n Kid.all.find_by(name:$kid_name)\n end",
"def get named\n raise VariableError, \"Used variable '#{named}' without setting it to something first\" unless @vars.key? named\n refurbish(named)\n end",
"def getInK()\n if @myScale == 'K' or @myScale == 'k'\n return self\n else\n degreeK = 0.0\n if @myScale == 'F' or @myScale == 'f'\n degreeK = (5.0/9.0) * (@myDegree + 459.67);\n else\n degreeK = @myDegree + 273.15;\n end\n myTemp = Temperature.new(degreeK, 'K')\n return myTemp\n end\n end",
"def has_vuln?(name)\n\t\tVuln.find(:first, :conditions => [ \"name = ?\", name])\n\tend",
"def __aska_get_var(name)\n # attr_accessor?(name) ? aska(name) : \n (supported_method?(name) ? name.to_sym : name.to_f)\n end",
"def variable_from_ruby_object(name, value)\n var_ref = 0\n out_value = value.to_s\n\n if value.is_a?(Array)\n indexed_variables = value.count\n var_ref = value.object_id\n out_value = \"Array [#{indexed_variables} item/s]\"\n puppet_session_state.saved.variable_cache[var_ref] = value\n end\n\n if value.is_a?(Hash)\n named_variables = value.count\n var_ref = value.object_id\n out_value = \"Hash [#{named_variables} item/s]\"\n puppet_session_state.saved.variable_cache[var_ref] = value\n end\n\n DSP::Variable.new.from_h!(\n 'name' => name,\n 'value' => out_value,\n 'variablesReference' => var_ref\n )\n end",
"def instance_variable(key)\n instance_variable_get(\"@#{key}\")\n end",
"def lookupvar(name)\n puppet_scope.lookupvar name\n end",
"def name\n sku.name\n end",
"def lookup_variable (varname)\n\n env, var = lookup_environment(varname)\n env[var]\n end",
"def name\n 'vsphere'\n end",
"def instance_variable_name(name)\n \"@#{name.to_s}\".to_sym\n end",
"def v(identifier)\n @variable_names = {} unless @variable_names\n unless @variable_names[identifier]\n @@variable_name_counter += 1\n @variable_names[identifier] = \"v_#{@@variable_name_counter}\"\n end\n @variable_names[identifier]\n end",
"def name ; self[:name].downcase end",
"def vet_name\n self.veterinarian.name\n end",
"def name\n BadASS::BAD_DRAGON_SKUS[@sku]\n end",
"def name\n vcloud_attributes[:name]\n end",
"def instance_variable_name; end",
"def has_vuln?(name)\n\t\tVuln.find_by_name(name)\n\tend",
"def name; termid;end",
"def variable(project, key)\n get(\"/projects/#{url_encode project}/variables/#{key}\")\n end",
"def vocabulary_key\n return @children['vocabulary-key'][:value]\n end",
"def vm_field name\n VMS_DICT.fetch(\"vms\").fetch(@id).fetch(name)\n end",
"def instance_var_sym(key)\n \"@#{key}\".to_sym\n end",
"def get(key)\n @variables[key.to_sym]\n end",
"def get k\n\t\tJS::Object.get(\"Ruby.JsObj.get_property\").call(@object,k)\n\t end",
"def set_varience\n @varience = Varience.find(params[:id])\n end",
"def makeCensoredVarname( varname )\n varname = basicCensor( varname )\n if( KEYWORD_TRANSLATIONS.has_key?( varname ))then\n varname = KEYWORD_TRANSLATIONS[ varname ];\n end\n return varname\nend",
"def [](var_name)\n run(:true)[var_name]\n end",
"def variable_names()\n @var_set.keys\n end",
"def friendly_model_ivar(name_or_klass)\n name_or_klass = friendly_model_name(name_or_klass) if name_or_klass.is_a?(Class)\n :\"@#{name_or_klass}_ivar\"\n end",
"def class_variable_get(sym) end",
"def is_namevar?\n @is_namevar\n end",
"def variable\n @variable ||= \"@#{@name}\"\n end",
"def export(k, v) make_var(k, v, true) end",
"def [](ivar_name)\n instance_variable_get :\"@#{ivar_name}\"\n end",
"def [](variable_name)\n variables.find { |c| c.name == variable_name }\n end",
"def la_variable(id)\n Vocab::Variable + \" \" + variable_name(id)\n end",
"def lookup_silo_name\n return \"#{self.name.gsub('::', '__')}_dict\"\n end",
"def namespace_key(name)\n namespaces[name][:key]\n end",
"def prefix\n @obj['prefix']\n end",
"def vin; end",
"def find_variable_by_name(name)\n v = @variables.find { |v| v[:argument][:name] == name }\n\n v\n end",
"def variance(level = @skl_level)\n return @skl_levelcache[level][:variance]\n end",
"def to_ivar(name)\n self.class.to_ivar(name)\n end",
"def pe_variable(pe)\n pe.name.squish.downcase.tr(\" \",\"_\").to_sym\n end",
"def name # this 'gets' a property\n @this_dogs_name\n end",
"def name\n self.species\n end",
"def initialize variable_name, push_to_searchisko = true\n @variable = variable_name\n @push_to_searchisko = push_to_searchisko\n end"
] |
[
"0.5574428",
"0.555881",
"0.54744893",
"0.53321457",
"0.52964014",
"0.528263",
"0.5251821",
"0.5219873",
"0.519401",
"0.5190307",
"0.5189282",
"0.5126412",
"0.5079791",
"0.50745654",
"0.50486016",
"0.50392187",
"0.5038823",
"0.5004229",
"0.49497256",
"0.4946956",
"0.4941458",
"0.49357572",
"0.49079812",
"0.48875576",
"0.48875576",
"0.48863146",
"0.48556075",
"0.48483533",
"0.48318386",
"0.48283756",
"0.48249847",
"0.4794902",
"0.4785074",
"0.4782943",
"0.47784567",
"0.47733125",
"0.47685874",
"0.47469848",
"0.47255215",
"0.47171152",
"0.47117606",
"0.4705442",
"0.47048372",
"0.4695905",
"0.4695776",
"0.4682063",
"0.46805924",
"0.4676391",
"0.46735826",
"0.46662435",
"0.4665461",
"0.46598613",
"0.46580094",
"0.4656053",
"0.46449605",
"0.46432585",
"0.46372807",
"0.46206698",
"0.46158582",
"0.4612484",
"0.46116346",
"0.4594194",
"0.4592017",
"0.458925",
"0.45845953",
"0.45670813",
"0.4556897",
"0.45558572",
"0.45536947",
"0.45435888",
"0.45410967",
"0.4532006",
"0.45295593",
"0.45226538",
"0.4498105",
"0.44940245",
"0.44921124",
"0.44902414",
"0.4487639",
"0.44865566",
"0.44830415",
"0.4472257",
"0.44636974",
"0.44592458",
"0.4450628",
"0.44366747",
"0.44347984",
"0.44297493",
"0.4426288",
"0.4425562",
"0.44235942",
"0.4416821",
"0.4414119",
"0.44076446",
"0.4404428",
"0.44031036",
"0.4395616",
"0.4383291",
"0.43823603",
"0.437161"
] |
0.73486245
|
0
|
Have we reached the end of the file?
|
def eof; @file.eof; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @read >= @size\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\r\n false\r\n end",
"def eof_found?\n @eof_found\n end",
"def at_end?\n peek.type == :eof\n end",
"def eof?\n io.eof?\n end",
"def track_eof?\n true if track_eof\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @position >= @size\n end",
"def eof?\n @pos == @data.bytesize\n end",
"def eof?()\n #This is a stub, used for indexing\n end",
"def eof?\n @stream.eof?\n end",
"def eof?() end",
"def eof?() end",
"def eof?() end",
"def eof?\n wait_for_chars(1)\n @cursor == @buffer.length && @eof_found\n end",
"def eof?\n return @stream.eof?\n end",
"def eof?\n end",
"def end_of_stream?\n @next_chunk.nil?\n end",
"def eof?\n raise IOError, 'not opened for reading' if closed?\n @total == @size && @buffer.empty?\n end",
"def eof?\n not busy?\n end",
"def eof?\n if @buffer.size > 0\n false\n else\n @io.eof?\n end\n end",
"def eof?\n @io.closed? || @io.eof?\n end",
"def eof?\n @input.eof?\n end",
"def eof?\n\t\t\t\tfill_read_buffer if !@eof && @read_buffer.empty?\n\t\t\t\t\n\t\t\t\treturn @eof && @read_buffer.empty?\n\t\t\tend",
"def eof?\n ref_line.nil? && output_line.nil?\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def prim_eof?\n false\n end",
"def eof?\n ready_token\n if @buffer\n @buffer.empty? && @io.eof?\n else\n @io.eof?\n end\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def eof?\n @stmt.done?\n end",
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n false\n end",
"def eof?\n fill_rbuff if !@eof && @rbuffer.empty?\n @eof && @rbuffer.empty?\n end",
"def eof?; @io.size == @rio end",
"def handle_eof\n # do this check again for thread safety\n if @state.eof_reached?\n STDOUT.flush\n @callback[:end_of_file].call\n @state.handle_eof\n end\n true\n end",
"def eof?\n\t\tnot peak\n\tend",
"def eof?\n stream = @_st_stream\n stream and stream.eof?\n end",
"def eof_flag\n @eof_flag\n end",
"def eof?\n @state.eof_reached? && get_player_output.size < 1\n end",
"def end?\r\n\t\tif(@allLines.empty?)\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend\r\n\tend",
"def eof?\n code == FX_EOF\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?; end",
"def eof?; end",
"def eof!; end",
"def eof\n if @sio_closed_read ; __require_readable ; end\n @sio_pos >= @sio_string.length\n end",
"def eof\n end",
"def eof() end",
"def eof() end",
"def eof() end",
"def eof\n @pushback.nil? and (@input.nil? or @input.eof)\n end",
"def do_eof; end",
"def end_of_file(arg)\n @offenses << error('At the end of file: Final newline missing') unless arg.readlines.last.match(/\\n/)\n end",
"def eof?\n peek_lit(nil).nil?\n end",
"def check_eof( row )\n @eof = !row.has_key?( :row )\n end",
"def eof?\n if @stdin.wait_readable(0.00001)\n c = @stdin.getc\n result = c.nil? ? true : false\n @stdin.ungetc(c) unless c.nil?\n result\n else # buffer is empty\n false\n end\n end",
"def finished?\n @buffer.size == @size\n end",
"def end?()\n END_MARKER.equal? _next_element\n end",
"def stream_is_done?\n @stream.nil? || @stream.closed? || @stream.eof?\n end",
"def eof?\n $stdin.closed?\n end",
"def end?\n @status == :end\n end",
"def eof?\n @sock.closed?\n end",
"def haspdueof?; return !@pdus[\"EOF\"].nil? end",
"def is_partition_eof?\n code == :partition_eof\n end",
"def end_of_meta_data\n cur = tell\n\n seek 0\n line = _gets\n return unless META_SEP =~ line\n\n while line = _gets\n break if META_SEP =~ line\n end\n return if line.nil?\n tell\n\n ensure\n seek cur\n end",
"def fin; false; end",
"def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end",
"def closed?\n @file.closed?\n end",
"def end?\n @cursor == @text.length\n end",
"def end?\n @cursor == @text.length\n end",
"def add_end_of_file_callback(&block)\n @callback[:end_of_file] = block\n true\n end",
"def empty?\n @stream.eof and @tokens.empty?\n end",
"def eos?\n @pos >= @string.size\n end",
"def buffer_empty?\n @line_no.zero? || @pos > @line.length - 1\n end",
"def frozen?(file)\n file.words.at(file.content_offset + offset + size - 1) == end_marker\n end",
"def has_more?\n !@done || !@row_buffer.empty?\n end",
"def new_file?\n\t\t@filelineno == 1\n\tend",
"def complete?\n @bytes == [[0, @length - 1, true]]\n end",
"def complete?\n buff.length < @maxlen\n end",
"def on_eof(&block); end",
"def end_of_tie?\n true\n end",
"def eos?; end"
] |
[
"0.79996926",
"0.79996926",
"0.79996926",
"0.79753065",
"0.79573554",
"0.79573554",
"0.79573554",
"0.793477",
"0.7917818",
"0.7914348",
"0.7839148",
"0.7798828",
"0.7794142",
"0.7794142",
"0.7794142",
"0.77890694",
"0.77488196",
"0.7737597",
"0.77373433",
"0.7709795",
"0.7709795",
"0.7709795",
"0.76955056",
"0.7682308",
"0.7675251",
"0.76732785",
"0.7648853",
"0.7640685",
"0.76403606",
"0.74544513",
"0.7425003",
"0.74156916",
"0.7413202",
"0.7404178",
"0.7404178",
"0.7404178",
"0.7394316",
"0.7394316",
"0.7394316",
"0.7394316",
"0.7394316",
"0.7361527",
"0.730201",
"0.72678554",
"0.72678554",
"0.7261619",
"0.7260621",
"0.7260621",
"0.72111547",
"0.7194942",
"0.7190559",
"0.71852785",
"0.71654826",
"0.7148958",
"0.70939374",
"0.7072726",
"0.7059743",
"0.7034508",
"0.7034508",
"0.7034508",
"0.69999003",
"0.69999003",
"0.69667685",
"0.6937228",
"0.69237286",
"0.6900434",
"0.6900434",
"0.6900434",
"0.6848139",
"0.6843357",
"0.6842974",
"0.68363917",
"0.6753061",
"0.6716719",
"0.66916335",
"0.66911215",
"0.6675204",
"0.66365004",
"0.6554233",
"0.65396786",
"0.64605975",
"0.6455745",
"0.6450949",
"0.64362794",
"0.640211",
"0.63586456",
"0.6314174",
"0.6314174",
"0.6294162",
"0.62862456",
"0.6249118",
"0.62349766",
"0.6230399",
"0.6215737",
"0.6213502",
"0.6212243",
"0.61868143",
"0.6169388",
"0.61541754",
"0.61372584"
] |
0.7688012
|
23
|
Read the next event's kinematic variables (returns their values via Hash)
|
def read
num_kv = @kinvars.length
unpck = String.new
num_kv.times{unpck += 'd'}
vals = @file.read(num_kv*8).unpack(unpck)
vals_hash = Hash.new
num_kv.times{|kv| vals_hash[@kinvars[kv].name] = vals[kv]}
vals_hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vars\n @vars ||= soln.keys\n @vars\n end",
"def data\r\n @obj.read_var(@name)\r\n end",
"def values\n @values ||= keys.map do |key|\n request_context.params[\"ks_prev_#{key}\".to_sym]\n end\n end",
"def read_player_info_block\n keys, ret = [], []\n\n key_count = read_word.to_i\n key_count.times { keys << read_word}\n\n value_count = read_word.to_i\n\n value_count.times do\n current_player = {}\n key_count.times do |idx|\n current_player[keys[idx]] = read_word\n end\n\n ret << current_player\n end\n\n ret\n end",
"def read_track\n\tc = c1 = type = needed = 0\n\tsysex_continue = false\t# True if last msg was unfinished\n\trunning = false\t\t# True when running status used\n\tstatus = 0\t\t# (Possibly running) status byte\n\n\t@bytes_to_be_read = 0\n\tread_mt_header_string(MTrk_BYTE_ARRAY, false)\n\n\t@bytes_to_be_read = read32()\n\t@curr_ticks = @ticks_so_far = 0\n\n\tstart_track()\n\n\twhile @bytes_to_be_read > 0\n @curr_ticks = read_var_len() # Delta time\n @ticks_so_far += @curr_ticks\n\n # Copy raw var num data into raw time stamp data\n @raw_time_stamp_data = @raw_var_num_data.dup()\n\n c = getc()\t\t# Read first byte\n\n if sysex_continue && c != EOX\n error(\"didn't find expected continuation of a sysex\")\n end\n\n if (c & 0x80).zero? # Running status?\n error('unexpected running status') if status.zero?\n running = true\n else\n status = c\n running = false\n end\n\n needed = NUM_DATA_BYTES[(status >> 4) & 0x0f]\n\n if needed.nonzero?\t# i.e., is it a channel message?\n c1 = running ? c : (getc() & 0x7f)\n\n # The \"& 0x7f\" here may seem unnecessary, but I've seen\n # \"bad\" MIDI files that had, for example, volume bytes\n # with the upper bit set. This code should not harm\n # proper data.\n chan_message(running, status, c1,\n (needed > 1) ? (getc() & 0x7f) : 0)\n next\n end\n\n case c\n when META_EVENT\t# Meta event\n type = getc()\n msg_init()\n msg_read(read_var_len())\n meta_event(type)\n when SYSEX\t\t# Start of system exclusive\n msg_init()\n msg_add(SYSEX)\n c = msg_read(read_var_len())\n\n if c == EOX || !@no_merge\n handle_sysex(msg())\n else\n sysex_continue = true\n end\n when EOX\t\t# Sysex continuation or arbitrary stuff\n msg_init() if !sysex_continue\n c = msg_read(read_var_len())\n\n if !sysex_continue\n handle_arbitrary(msg())\n elsif c == EOX\n handle_sysex(msg())\n sysex_continue = false\n end\n else\n bad_byte(c)\n end\n\tend\n\tend_track()\n end",
"def read_metadata\n { :variable_set => nil }\n end",
"def read_metadata\n metadata = { :variable_set => read_variable_set }\n set_key_map metadata[:variable_set]\n\n metadata\n end",
"def getKeyState(key)\r\n MSketchyPhysics3.getKeyState(key)\r\nend",
"def getKeyState(key)\n MSketchyPhysics3.getKeyState(key)\nend",
"def variables\n response = self.class.get_raw \"process-instance/#{id}/variables\"\n deserialize_variables response[:parsed_data][:data]\n end",
"def temp\n return $game_variables[VAR_TEMP]\nend",
"def load_param_values_non_arduino\n\n p = get_param_by_name('MOVEMENT_STEPS_PER_UNIT_X')\n @axis_x_steps_per_unit = p['value_db']\n\n p = get_param_by_name('MOVEMENT_STEPS_PER_UNIT_Y')\n @axis_y_steps_per_unit = p['value_db']\n\n p = get_param_by_name('MOVEMENT_STEPS_PER_UNIT_Z')\n @axis_z_steps_per_unit = p['value_db']\n\n end",
"def load_param_values_non_arduino\n\n p = get_param_by_name('MOVEMENT_STEPS_PER_UNIT_X')\n @axis_x_steps_per_unit = p['value_db']\n\n p = get_param_by_name('MOVEMENT_STEPS_PER_UNIT_Y')\n @axis_y_steps_per_unit = p['value_db']\n\n p = get_param_by_name('MOVEMENT_STEPS_PER_UNIT_Z')\n @axis_z_steps_per_unit = p['value_db']\n\n end",
"def get_data\n\t\tdata = {}\n\n\t\treads = 0\n\t\terrors = 0\n\t\twhile true do\n\t\t\t\n\t\t\tbegin\n\t\t\t\tread()\n\t\t\t\n\t\t\t\t# Have we gathered enough data yet\n\t\t\t\tif @collected.include?(\"GGA\") && @collected.include?(\"RMC\") && reads > 5\n\t\t\t\t\tbreak\n\t\t\t\telsif reads > 25\n\t\t\t\t\traise \"Could not gather enough data from the GPS. Perhaps the NMEA data is corrupt. Did you specifiy the correct serial device?\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treads += 1\n\t\t\t\terrors = 0\n\t\t\trescue\n\t\t\t\terrors += 1\n\t\t\t\tif errors > 5\n\t\t\t\t\traise $!\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\tend\n\n\t\treturn @data\n\tend",
"def variables\n {\n 'input' => {\n 'customId' => @workflow.id.try(:to_s),\n 'environmentName' => @app_env,\n 'intentId' => intent_id,\n 'programmingLanguage' => 'RUBY',\n 'name' => workflow_name,\n 'canonicalName' => @workflow.class.name,\n 'data' => @serializer.encode(@properties.from(@workflow))\n }\n }\n end",
"def next\r\n var = EMULATOR_CONFIG::VARS[@rnd.rand(EMULATOR_CONFIG::VARS.length)]\r\n @vals[var].next\r\n\r\n [var, @vals[var].val]\r\n end",
"def vars\n variables.values\n end",
"def vars\n variables.values\n end",
"def read_intro\n rd=@stdin.gets.strip\n warn \"unexpected: #{rd}\" unless rd=='turn 0'\n\n until((rd=@stdin.gets.strip)=='ready')\n _, name, value = *rd.match(/\\A([a-z0-9_]+) (-?\\d+)\\Z/)\n\n case name\n when 'loadtime'; @loadtime=value.to_i\n when 'turntime'; @turntime=value.to_i\n when 'rows'; @rows=value.to_i\n when 'cols'; @cols=value.to_i\n when 'turns'; @turns=value.to_i\n when 'viewradius2'; @viewradius2=value.to_i\n when 'attackradius2'; @attackradius2=value.to_i\n when 'spawnradius2'; @spawnradius2=value.to_i\n when 'player_seed'; @seed=value.to_i; srand(@seed);\n else\n warn \"unexpected: #{rd}\"\n end\n end\n\n ##log \"loadtime: #{@loadtime}\"\n ##log \"rows: #{@rows}\"\n ##log \"cols: #{@cols}\"\n\n @viewradius=Math.sqrt @viewradius2\n @attackradius=Math.sqrt @attackradius2\n @spawnradius=Math.sqrt @spawnradius2\n end",
"def get_kaduki_pose_direction\n #read pose information from module\n #using pose as key, access direction info that relates to current _suffix image\n \n #..It may be that I want to actually store this in the battler class and just\n #read it, as it will have already had to do this to get the image _suffix name\n #for the corresponding pose. Slightly more effective use of CPU time????\n msgbox \"Kaduki Type battlers are not currently supported!\"\n return get_direction; \n end",
"def get(key)\n @variables[key.to_sym]\n end",
"def parse_hash\n \thash = {}\n \t# Remove the first five lines of the file\n \ttemp_array = @readin[5, @readin.length]\n \t# Split the input at the semicolon: the left hand side is a timestamp and the right hand side\n \t# is the value (either power in W, or energy in Wh depending on the file type).\n \t# This is committed to a hash with time as the key and the W/Wh as the value.\n \ttemp_array.each do |s|\n \t\tk,v = s.split(/;/)\n \t\t# the Aurora reports time as seconds since 1/1/0000 and Ruby reports time utilizing an epoch\n \t\t# that began on 1/1/1970. The time stamp is adjusted for the time in seconds between these\n \t\t# two dates.\n \t\thash[Time.at(k.to_i - 62167104000)] = v.to_f\n \tend\n \treturn hash\n end",
"def get(variable_name)\n @state.get(variable_name)\n end",
"def [](key)\n local_fiber_variables[key]\n end",
"def variables; end",
"def variables; end",
"def evaluateReading(reading)\n if reading.class != FluksoReading\n raise \"Must provide a FluksoReading instance.\"\n end\n if reading.watts < $CONFIG[:LOW_MEDIUM_BARRIER]\n @fsm.low_reading;\n elsif reading.watts < $CONFIG[:MEDIUM_HIGH_BARRIER]\n @fsm.medium_reading;\n else\n @fsm.high_reading;\n end\n @lastReadingTimestamp=reading.time\n end",
"def read\n prev_hash = nil\n\n CSV.open(nmea_file, 'r').each do |row|\n timestamp = Time.strptime(\"#{row[9]} #{row[1]}\", '%d%m%y %H%M%S.%L')\n next if timestamp.year < 1990\n\n speed = (row[7].to_f * 1.852).round(2)\n bb = row[8].to_f\n\n lat, lon = geo_convert(\n lat_source: row[3],\n lon_source: row[5],\n sw: row[4],\n ww: row[6]\n )\n\n hash = {\n timestamp: timestamp.strftime(TIME_FORMAT),\n bb: bb,\n speed: speed,\n lat: lat,\n lon: lon\n }\n\n if prev_hash.nil? || hash != prev_hash\n check_bounds lat, lon if lat && lon\n yield hash\n end\n\n prev_hash = hash\n end\n end",
"def readSource\n if @source_in.nil?\n @source_in = open @dir+Pathname.new(@source)\n # fields titles\n head=@source_in.readline.strip\n @heads=head.split(/\\s*,\\s*/)\n @hoplang_cols_order = @heads.join ','\n end\n\n begin\n line=@source_in.readline.strip\n datas=line.split(/\\s*,\\s*/)\n\n i=0\n value={}\n @heads.each {|h|\n value[h]=datas[i]\n i+=1\n }\n value['__hoplang_cols_order'] = @hoplang_cols_order\n # now store variable!\n #varStore.set(@current_var, value)\n return value\n rescue EOFError\n hop_warn \"EOF.....\\n\"\n #varStore.set(@current_var, nil)\n return nil\n end\n line\n end",
"def process_event(event_text)\n @prev_event = @current_event\n @current_event = MyoEvent.new(event_text)\n\n # set pose time\n if(@prev_event != nil and @current_event != nil)\n if(@prev_event.pose == @current_event.pose)\n @pose_time += @current_event.timeStamp.to_i - @prev_event.timeStamp.to_i\n puts @pose_time.to_s\n else\n @pose_time = 0\n end\n end\n\n # handle long poses\n if(@pose_time > @long_hold)\n case @current_event.pose\n when \"fist\"\n puts \"long #{@current_event.pose} detected\"\n all_off\n when \"twistIn\"\n @locked = not(@locked)\n if(@locked)\n puts \"Locked!\"\n else\n puts \"Unlocked!\"\n end\n else\n puts \"long #{@current_event.pose} detected\"\n end\n end\n\n if(@locked)\n return\n end\n \n case @current_event.pose\n when \"fingersSpread\"\n val1 = remap(@current_event.diffData[0].to_f, 0, 1, 0, 127)\n val1 = remap(@current_event.diffData[1].to_f, 0, 1, 0, 127)\n cc(41, val1)\n cc(42, val2)\n end\n\n #puts @current_event.inspect\n end",
"def read_state\n end",
"def extrac_actual\n if(@actual!= nil)\n aux = @actual\n @actual = @actual[:prev]\n @Max-= 1\n var = aux[:value]\n else\n var = nil\n end\n var\n end",
"def local_variable_reads(node); end",
"def simulation_params\n if @names.nil?\n puts \"...\"\n else\n @sc.get_component_name\n @hm.get_component_name\n @ls.get_component_name\n pp \"time_tick = \", @time_tick\n pp \"os_volume = \", @os_volume\n end\n end",
"def get_Next()\n \t return @outputs[\"Next\"]\n \tend",
"def get_Next()\n \t return @outputs[\"Next\"]\n \tend",
"def get_Next()\n \t return @outputs[\"Next\"]\n \tend",
"def get_Next()\n \t return @outputs[\"Next\"]\n \tend",
"def get_Next()\n \t return @outputs[\"Next\"]\n \tend",
"def get_Next()\n \t return @outputs[\"Next\"]\n \tend",
"def completed_quests; $game_variables[17]; end",
"def getBoundaryNodeFlowIn(solutionfile)\n\tflow_in = {}\n\tFile.readlines(solutionfile).each do |line|\n\t\tdata = line.match(/var_node_Qo_in\\$([^\\s]*)\\s*([^\\s]*)/)\n\t\tif !data.nil?\n\t\t\tflow_in[data[1]] = data[2].to_f.round(3).to_s\n\t\tend\n\tend\n\tflow_in\nend",
"def reset_variables\n @variables = Hash.new(0)\n\n # Initialise pi and e\n\n @variables['PI'] = Math::PI\n @variables['E'] = Math::E\n end",
"def getVariable(name)\n index = -1\n\n # Find the internal database index of the column we are looking for.\n $db.get_col_order_vector.each do |col_index|\n if name == $db.get_data_column(col_index).get_name\n index = col_index\n end\n end\n\n #puts \"Got column index.\"\n #puts index\n\n\n dc = $db.get_data_column(index)\n mve = $db.get_matrix_ve(dc.get_its_mve_id)\n\n # Convert each cell into an array and store in an array of arrays\n cells = Array.new\n arg_names = Array.new\n\n if dc.get_its_mve_type == MatrixVocabElement::MatrixType::MATRIX\n for i in (0 .. (mve.get_num_formal_args - 1))\n fa = mve.get_formal_arg_copy(i)\n arg_names << fa.get_farg_name\n end\n end\n\n for i in (1 .. dc.get_num_cells)\n cell = dc.get_db.get_cell(dc.get_id, i)\n c = Array.new\n c << cell.get_onset.get_time\n c << cell.get_offset.get_time\n c << cell.get_val.to_escaped_string.tr_s(\"(\", \"\").tr_s(\")\", \"\").split(\",\")\n c << i\n cells << c\n end\n\n\n v = Variable.new\n v.name = name\n v.old_args = arg_names\n #v.type = dc.get_its_mve_type\n v.set_cells(cells, arg_names)\n\n\n return v\nend",
"def fetch_sensor_state\n \"#{entry_on}#{inside_on}#{exit_on}#{@beam_broken}\".to_i(2)\n end",
"def kettle_data\n vals = {}\n text = read_text\n match = Regexp.new('Wood: ([0-9]+)').match(text)\n vals[:wood] = match[1].to_i if match\n match = Regexp.new('Water: ([0-9]+)').match(text)\n vals[:water] = match[1].to_i if match\n vals[:done] = (text =~ /The recipe is complete/)\n \n vals\n end",
"def y\n @data[:y]\n end",
"def variables\n {\n 'input' => {\n 'intentId' => intent_id,\n 'environmentName' => @app_env,\n 'cron' => @cron,\n 'taskName' => @task.class.name,\n 'programmingLanguage' => 'RUBY',\n 'properties' => @serializer.encode(@properties.from(@task))\n }\n }\n end",
"def [](key)\n $game_variables[key]\n end",
"def get_data(n)\n res, @data = @data.unpack(\"a#{n}x#{n.osc_alignment}a*\")\n self.underrun! unless res\n res\n end",
"def variables\n return @variables unless @variables.nil?\n vars = []\n dict = @instance.getDictionary\n dict.getVariables.each do |var|\n vars << {\n :name => var.getName,\n :qual => var.getQualification.toString.downcase.to_sym,\n :type => var.getType.toString.downcase.to_sym,\n :formula => var.getFormula.getValue,\n :variable => var,\n }\n end\n @variables = vars\n end",
"def variables\n {\n 'input' => {\n 'environmentName' => @app_env,\n 'intentId' => intent_id,\n 'name' => @task.class.name,\n 'maxProcessingTime' => @task.try(:max_processing_time),\n 'programmingLanguage' => 'RUBY',\n 'data' => @serializer.encode(@properties.from(@task))\n }\n }\n end",
"def read_next_move\n\t\t\t\tms = read_acpc_matchstate\n\t\t\t\treturn ms[:last_action]\n\t\t\tend",
"def get_vars(instruction)\n dictionary = {\n 'definition' => ['os_type_id','iso_file','boot_cmd_sequence','postinstall_files'],\n 'kickstart' => ['reponame','pkgs'],\n 'preseed' => ['suite','pkgs'],\n 'autoinst' => ['pkgs']\n }\n # 'kickstart_file' option in definition.rb is deprecated\n # erb_vars = ['os_type_id','iso_file','boot_cmd_sequence','kickstart_file','postinstall_files']\n return dictionary[instruction]\n end",
"def read_events\n return unless @config.has_key?('events')\n\n @config['events'].each_pair do |event, actions|\n @events[event.to_sym] = Array(actions)\n end\n end",
"def read_data(file_object, data_group, time)\n # Convert to an object of class Tokfile::Ogyropsi if necessary\n file_object = file_object.internal_representation(time).to_ogyropsi unless file_object.kind_of? TokFile::Ogyropsi\n VARIABLES.each do |var|\n next unless in_data_group(data_group, var)\n varname = instance_varname(var)\n if data_group==\"all\"\n set(varname, file_object.send(varname)) if file_object.send(varname)\n else\n if file_object.send(varname)\n input = file_object.send(varname)\n case input\n when Integer, Float\n set(varname, input)\n when GSL::Vector\n case input.size\n when file_object.npsi\n #interp = GSL::Interp.alloc('cspline', file_object.npsi)\n #ep [file_object.psi.max, file_object.psi.min, @psi.max, @psi.min, 'end']\n #ep input\n #set(varname, interp.eval(file_object.psi, input, @psi))\n interp = GSL::ScatterInterp.alloc(:linear, [file_object.psi, input], false)\n set(varname, @psi.collect{|ps| interp.eval(ps)})\n end\n end\n end\n end\n\n end\n\n end",
"def load_tsbs\n @seq_key = TSBS::Default_SkillSequence\n @seq_key = TSBS::Default_ItemSequence if is_a?(RPG::Item)\n @prepare_key = \"\"\n @return_key = \"\"\n @reflect_anim = animation_id\n first_time = true\n note.split(/[\\r\\n]+/).each do |line|\n case line \n when TSBS::SequenceREGX\n if first_time\n @seq_key = [$1.to_s]\n first_time = false\n else\n @seq_key.push($1.to_s)\n end\n when TSBS::PrepareREGX\n @prepare_key = $1.to_s\n when TSBS::ReturnREGX\n @return_key = $1.to_s\n when TSBS::ReflectAnim\n @reflect_anim = $1.to_i\n end\n end\n end",
"def load_tsbs\n @seq_key = TSBS::Default_SkillSequence\n @seq_key = TSBS::Default_ItemSequence if is_a?(RPG::Item)\n @prepare_key = \"\"\n @return_key = \"\"\n @reflect_anim = animation_id\n first_time = true\n note.split(/[\\r\\n]+/).each do |line|\n case line \n when TSBS::SequenceREGX\n if first_time\n @seq_key = [$1.to_s]\n first_time = false\n else\n @seq_key.push($1.to_s)\n end\n when TSBS::PrepareREGX\n @prepare_key = $1.to_s\n when TSBS::ReturnREGX\n @return_key = $1.to_s\n when TSBS::ReflectAnim\n @reflect_anim = $1.to_i\n end\n end\n end",
"def variables\n {\n 'customId' => @custom_id,\n 'environmentName' => @app_env,\n 'programmingLanguage' => 'RUBY',\n 'workflowName' => @workflow_name\n }\n end",
"def read\n\t\t\n\t\t# Parse NMEA sentence until we find one we can use\n\t\twhile true do\n\t\t\tnmea = next_sentence\n\t\t\tdata = parse_NMEA(nmea)\n\t\t\t\n\t\t\t# Sentence parsed, now merge\n\t\t\tunless data[:last_nmea].nil?\n\t\t\t\t@collected << data[:last_nmea]\n\t\t\t\t@collected.uniq!\n\t\t\t\t@data.merge!(data)\t\n\t\t\t\t\n\t\t\t\tbreak\n\t\t\tend\n\t\t\t\n\t\tend\n\n\t\treturn @data\n\tend",
"def load_var(load_hash)\n @wrong_arr = load_hash['wrong_arr']\n @guess_arr = load_hash['guess_arr']\n @turn = load_hash['turn']\n @resolved_arr = load_hash['resolved_arr']\n @solution_arr = load_hash['solution_arr']\n end",
"def event_state\n FFILib::ReaderStateQuery.unpack_state self[:event_state]\n end",
"def _read\n # get position\n pos = @gps.position # [lat, lnt, hdop]\n return nil if pos.size < 3 || pos[0].nil? || pos[1].nil? || pos[2].nil?\n # get UTC\n utc = @gps.gga[:time]\n ary = [utc, pos[0], pos[1], pos[2]]\n puts \"GPSGGA#_read: #{ary.inspect}\"\n ary\n end",
"def previous_output\n @prev_out.reverse.unpack(\"H*\")[0]\n end",
"def variables\n root.variables_value\n end",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def read_key; end",
"def parse_event!\n raise Dyno::MalformedInputError unless @raw.has_section?('Header')\n\n @event = Dyno::Event.new( :game => @raw['Header']['Game'] )\n @event.time = Time.parse( @raw['Header']['TimeString'] )\n @event.game_version = @raw['Header']['Version']\n\n # Extract the track name from Race/Scene\n if @raw.has_section?('Race') && @raw['Race']['Scene']\n @event.track = @raw['Race']['Scene'].split( '\\\\' )[-2].gsub( /[_-]+/, ' ' )\n end\n end",
"def get key, what\n case key\n when :event\n @events[what.to_sym] || @events[what.to_s.gsub('!','').to_sym]\n when :state\n @states[what.to_sym] || @states[what.to_s.gsub('!','').to_sym]\n end\n end",
"def clk_read\n \n case @clk_state\n\n when 0\n @address = @mar.content.bin_to_dez\n\n when 1\n @value = @memory[@address]\n @value = Array.new @mdr.length, 0 if @value.nil?\n\n when 2\n @mdr.content = @value\n\n end\n\n @clk_state += 1\n @clk_state %= 3\n\n end",
"def next_value_for_sequence(sequence_name)\n %{#{sequence_name}.nextval}\n end",
"def variables()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = RunMetadataVariablesIter.new(Native.RunMetadata_variables(@handle.ptr))\n result\n end",
"def event_props_spin(event)\n {\n fiber: event[1],\n caller: event[2],\n source_fiber: Fiber.current\n }\n end",
"def next_event message\n return nil if !@events.has_key? message.next_sequence\n @events[message.next_sequence]\n end",
"def get_vars\n\t\tvars_hash = {}\n\n\t\tparsed_config = begin\n\t\t\tYAML.load(File.open(@path_to_var_yml))\n\t\trescue ArgumentError => e\n \t\t\tputs \"Could not parse YAML: #{e.message}\"\n\t\tend\n\n\t\tparsed_config['template_variables'].each do |n|\n\t\t\tvars_hash[n[0]] = n[1]\n\t\tend\n\n\t\tvars_hash\n\tend",
"def current_dialog_values\n values = {}\n @data_gets.each { |k, v| values[k] = v.call }\n values\n end",
"def get_next_mock_input\n @mock_input_index += 1\n @mock_input_tape[@mock_input_index-1]\n end",
"def prev\n fil_header[:prev]\n end",
"def next\r\n next_values[0]\r\n end",
"def x\n @data[:x]\n end",
"def next_var(v)\n return v.next \n end",
"def load_replay_values\n fname = observation_file_name + '.json'\n return unless File.exist?(fname) # Can't load if we don't have an existing obs file\n File.open(fname, 'r') do |f|\n observations = Utils.observation_from_json(f.read)\n last_args = nil\n observations.each do |obs|\n if obs.has_key?(:__record_args__)\n last_args = obs\n elsif obs.has_key?(:__replay_result__)\n add_replay_value(last_args, obs[:result])\n end\n end\n end\n end",
"def return_usc\n $mascots.keys[4]\nend",
"def read_models\n File.readlines(\"car-models.txt\").each do |line|\n @modles_hash[line[0,1]] = line.partition('=').last.chomp\n end\n # puts \"@modles_hash: #{@modles_hash.inspect}\"\n # return @modles_hash\n end",
"def phase_sequence\n hash = {\n :idle => method(:idle_key),\n :victory => method(:victory_key),\n :hurt => method(:hurt_key),\n :skill => method(:skill_key),\n :evade => method(:evade_key),\n :return => method(:return_key),\n :escape => method(:escape_key),\n :prepare => method(:prepare_key),\n :intro => method(:intro_key),\n :counter => method(:counter_key),\n :collapse => method(:collapse_key),\n :forced => method(:forced_act),\n :covered => method(:covered_key),\n }\n return hash\n end",
"def read_value(key)\n keys = key.split('.')\n result = @context\n keys.each do |k|\n return nil unless result\n result = result[k]\n end\n return result\n end",
"def next_scene(scene_name)\n\t\tval = @@scenes[scene_name]\n\t\treturn val\n\tend",
"def get_previous_input()\n if @jsession_store != nil\n\n for session in @jsession_store.get_sessions\n if session[:active_transaction] != nil\n if session[:active_transaction].pdt_screen_def.inputs['Input1'][:value].strip != \"\" || session[:active_transaction].pdt_screen_def.inputs['Input2'][:value].strip != \"\" ||session[:active_transaction].pdt_screen_def.inputs['Input3'][:value].strip != \"\"\n return session[:active_transaction].pdt_screen_def.inputs\n end\n end\n end\n end\n\n return nil\n end",
"def story_progress; $game_variables[72]; end",
"def get_variable(name)\n @variables[name]\n end",
"def mta\n {\n\t:line_N => [ \"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\" ],\n\t:line_L => [ \"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\" ],\n\t:line_6 => [ \"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\" ]\n }\nend",
"def init_gtbs_movement_vars\n @positions = {}\n @positions[:origin] = {}\n @positions[:origin][:x] = 0\n @positions[:origin][:y] = 0\n @positions[:origin][:time] = DEFAULT_MOVEMENT_TIME\n @positions[:target] = @positions[:origin].clone\n @positions[:current] = @positions[:origin].clone\n @positions[:jumppeak] = 0;\n end",
"def value_read; end",
"def next\n row = pg.execute \"SELECT * FROM events WHERE position = ? AND category = ?\", position, category\n\n position += 1\n\n event_data = Serialize::Read.(row, :postgresql, EventData)\n\n event_data\n end",
"def take_reading\n reading = `sudo Adafruit_DHT 22 4`\n log reading\n data = reading.match(/Temp = (.*) \\*C, Hum = (.*)%/)\n temp = data[1].to_f rescue nil\n humidity = data[2].to_f rescue nil\n\n {\n :temperature => temp,\n :humidity => humidity,\n :raw => data\n }\n end",
"def read_data\n sensor_data = DhtSensor.read(@pin, @sensor_model)\n @temperature = sensor_data.temp\n @humidity = sensor_data.humidity\n [@temperature, @humidity]\n end"
] |
[
"0.5379749",
"0.52060366",
"0.5157811",
"0.515696",
"0.5100735",
"0.5043836",
"0.50337374",
"0.5033514",
"0.5022739",
"0.4956222",
"0.4904913",
"0.48614565",
"0.48614565",
"0.48283133",
"0.4802302",
"0.4792526",
"0.47711322",
"0.47711322",
"0.4757023",
"0.47393623",
"0.47295195",
"0.471542",
"0.47153437",
"0.47150254",
"0.4686788",
"0.4686788",
"0.46811804",
"0.46796703",
"0.46794415",
"0.46684033",
"0.46675432",
"0.46661627",
"0.46585792",
"0.46359342",
"0.46354786",
"0.46354786",
"0.46354786",
"0.46354786",
"0.46354786",
"0.46354786",
"0.4632048",
"0.4631103",
"0.4626952",
"0.46242738",
"0.46241993",
"0.4619161",
"0.46015632",
"0.45901254",
"0.45886028",
"0.4568077",
"0.4567517",
"0.45575526",
"0.45557913",
"0.4543116",
"0.4528665",
"0.45276633",
"0.45261183",
"0.45261183",
"0.45202833",
"0.45175967",
"0.45152798",
"0.45127168",
"0.45095962",
"0.45041755",
"0.4499236",
"0.44887447",
"0.44887447",
"0.44887447",
"0.44887447",
"0.44887447",
"0.4479581",
"0.44698495",
"0.44696113",
"0.44609275",
"0.44537297",
"0.44521385",
"0.44445428",
"0.4444466",
"0.44378352",
"0.44350713",
"0.44310844",
"0.4429343",
"0.44253814",
"0.44249138",
"0.44172773",
"0.44143406",
"0.440702",
"0.44058836",
"0.44028255",
"0.43970633",
"0.43917653",
"0.43905297",
"0.43885767",
"0.4388279",
"0.43852696",
"0.4384246",
"0.4384215",
"0.43678784",
"0.43601868",
"0.43566743"
] |
0.5852097
|
0
|
Renders current grid state.
|
def render(reveal = false)
alphabet = ("A".."Z").to_a
print SQUARE_EMPTY
for x in 1..@grid.size
print " #{x} "
end
puts
for y in 0..@grid.size - 1
print " #{alphabet[y]} "
for x in 0..@grid.size - 1
coordinates = Game::Grid::Coordinates.new(x, y)
if reveal
if @grid.ship?(coordinates)
print SQUARE_HIT
else
print SQUARE_EMPTY
end
else
if @grid.ship?(coordinates)
@grid.ship_at(coordinates) { |ship|
segment = Utils::Calculator.ship_segment_from_coordinates(ship, coordinates)
if ship.hit?(segment)
print SQUARE_HIT
else
print SQUARE_UNKNOWN
end
}
else
if @missed.include? coordinates
print SQUARE_MISS
else
print SQUARE_UNKNOWN
end
end
end
end
puts
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render\n puts \"-------------------------------------\"\n @grid.each do |row| \n puts \"| \" + row.map(&:to_s).join(\" | \") + \" |\"\n puts \"-------------------------------------\"\n end\n end",
"def render\n #puts \"current state of the grid:\"\n grid.each do |row|\n row.map do |tile|\n print tile\n end\n puts\n end\n end",
"def render\n system(\"clear\")\n puts \" #{(0...size).to_a.join(\" \")}\"\n @grid.each_with_index do |row, i|\n puts \"#{i} #{row.join(\" \")}\"\n end\n end",
"def render\n @pressed.map do |idx, state|\n next unless state\n if on_grid?\n xx, yy = coords_for(idx: idx)\n change_grid(x: xx, y: yy, color: @colors.down)\n else\n change_command(position: @position, color: @colors.down)\n end\n end\n end",
"def draw\n @grid.draw\n show_info\n end",
"def render_grid(grid)\n grid.output_buffer.html_safe\n end",
"def endgame_render\n self.grid.flatten.each {|space| space.visible = true }\n render\n end",
"def render\r\n # puts \"\\e[H\\e[2J\"\r\n\r\n values = @grid\r\n puts \" 0 1 2 3 4 5 6 7 8\".light_black\r\n puts \" +---+---+---+---+---+---+---+---+---+\".light_black\r\n values.each_with_index do |row, idx|\r\n print \" #{idx} |\".light_black\r\n row.each_with_index do |value, idx|\r\n if idx >= 1\r\n print \"|\".light_black\r\n end\r\n # color coding output to cells\r\n if \" #{value} \".match?(/[0]/) # no values printed for open spaces\r\n print \" \"\r\n elsif value.is_a? String # values changed by player are printed in yellow\r\n print \" #{value} \".yellow\r\n else\r\n print \" #{value} \".light_blue # OG values are printed in blue\r\n end\r\n end\r\n print \"|\\n\".light_black\r\n puts \" +---+---+---+---+---+---+---+---+---+\".light_black\r\n end\r\n puts # adds newline at end of board\r\n end",
"def render\n print \" #{(1..9).to_a.join(\" \")}\".light_green.bold\n puts\n puts\n @grid.each.with_index do | row, row_indx |\n print \"#{row_indx + 1} \".light_green.bold\n row.each do | tile |\n if tile.revealed\n print \"#{VALUE_EMOJIS[tile.value]} \"\n elsif tile.flagged\n print \"#{FLAG} \"\n else \n print \"#{HIDDEN} \"\n end\n end\n puts\n puts\n end\n end",
"def grid\n state.grid\n end",
"def grid\n state.grid\n end",
"def render\n\t\tprint \"cl1 cl2 cl3 cl4 cl5 cl6 cl7 cl8 cl9 c10\\n\"\n\t\t(0..9).each do |row|\n\t\t\t(0..9).each do |col|\n\t\t\t\tif @grid[row][col].is_flagged\n\t\t\t\t\tprint \"FLG\"\n\t\t\t\telsif @grid[row][col].is_hidden\n\t\t\t\t\tprint \" \"\n\t\t\t\telsif @grid[row][col].surrounding_bombs > 0\n\t\t\t\t\tprint \" #{@grid[row][col].surrounding_bombs} \"\n\t\t\t\telsif @grid[row][col].has_bomb\n\t\t\t\t\tprint \"POW\"\t\t\t\t\t\n\t\t\t\telse print \"xxx\"\n\t\t\t\tend\n\t\t\t\tprint \"|\" unless col == 9\n\t\t\t\tprint \"row#{row + 1}\\n\" if col == 9\n\t\t\tend\n\t\tend\n\tend",
"def render\n puts \" #{(0..8).to_a.join(\" \")}\"\n grid.each_with_index do |row, i|\n arr = []\n row.each do |tile|\n if tile.revealed == true\n arr << tile.display_value\n elsif tile.flagged == true\n arr << \"F\"\n else\n arr << \"*\"\n end\n end\n\n puts \"#{i} #{arr.join(\" \")}\"\n end\n end",
"def render_state(state)\n @cell = self\n state = state.to_s\n self.state_name = state\n\n @state_return_value = dispatch_state(state)\n\n render_to_string(state)\n end",
"def drawAll\n\t\tif !@gridOn then return end\n\t\tself.drawXYGrid\n\t\tself.drawXZGrid\n\t\tself.drawYZGrid\n\tend",
"def render_grid\n\t\t@grid_w.times.with_index do |x|\n\t\t\t@grid_h.times.with_index do |y|\n\t\t\t\tif !@has_enviroment_rendered\n \t \t\trender_wall x, y if @grid[x][y]==1\n\t\t\t\tend\n\t\t \trender_player x, y if @grid[x][y]==2\n \tend\n end\n #each_cell do |x, y, v|\n # render_wall x, y if !@has_environment_rendered && v == 1 \n # render_player x, y if v == 2\n #end\n\t\t@has_enviroment_rendered = true\n\tend",
"def draw\n @grid.each do |row|\n puts row.map{|cell|\n cell.to_s\n }.join(\"\")\n end\n end",
"def render_state(state)\n content = dispatch_state(state)\n \n return content if content.kind_of? String\n \n \n ### DISCUSS: are these vars really needed in state views?\n @cell = self\n @state_name = state\n \n render_view_for(content, state)\n end",
"def render\n index\n grid.each_with_index do |row, i|\n join(row, i)\n end\n index\n end",
"def display\n grid.each { |line| p line }\n end",
"def draw\n\t\t#\n\t\t# Draw the \"top\" line.\n\t\t#\n\t\tputs \" \" + \"_\" * (@width * 2 - 1)\n\t\n\t\t#\t\n\t\t# Draw each of the rows.\n\t\t#\n\t\t@height.times do |y|\n\t\t\tprint \"|\"\n\t\t\t@width.times do |x|\n\t\t\t\t# render \"bottom\" using \"S\" switch\n\t\t\t\tprint( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\t\t\t\n\t\t\t\t# render \"side\" using \"E\" switch\t\n\t\t\t\tif @grid[y][x] & @@E != 0\n\t\t\t\t\tprint( ( ( @grid[y][x] | @grid[y][x+1] ) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t\t\telse\n\t\t\t\t\tprint \"|\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs\n\t\tend\n\n\t\t# \n\t\t# Output metadata\n\t\t#\n\t\tputs metadata\n\tend",
"def render_background\n render_unvisited\n render_grid_lines\n end",
"def render_background\n render_unvisited\n render_grid_lines\n render_labels\n end",
"def render\n render_to_string(:inline => '<%= render_grid(grid) %>', :locals => {:grid => self})\n end",
"def display_grid\n # variables for grid display\n @grid = \" A B C \\n\" \\\n \"1 #{@a1} | #{@b1} | #{@c1} \\n\" \\\n \" ---+---+--- \\n\" \\\n \"2 #{@a2} | #{@b2} | #{@c2} \\n\" \\\n \" ---+---+--- \\n\" \\\n \"3 #{@a3} | #{@b3} | #{@c3} \\n\"\n end",
"def render()\n # Display text \n puts \"Current Board: \"\n\n # array of blank strings, initialized before adding content\n render_rows = [\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]\n\n # Loop through to build the rows to render\n # Display number of rows corresponding to tower height\n # Display a column for each tower (split into rows for rendering)\n 0.upto(@no_of_discs) do |row|\n 1.upto(3) do |column|\n # Display a blank area for \"nil\" \"tower spots\"\n if @towers[column].tower_size <= row\n # Shovel a blank piece into the render row\n render_rows[row] << tower_piece(0,no_of_discs)\n else\n # Set piece size to the corresponding board value\n piece_size = @towers[column].tower[row].size\n # Shovel the corresponding piece into the render row\n render_rows[row] << tower_piece(piece_size,no_of_discs)\n end\n end\n end\n\n #Render in reverse order (top to bottom) so it appears correctly\n render_rows.reverse_each do |row|\n puts row\n end\n\n #Label line - Display a row with column labels on it under the towers\n puts \"[[[[[[[ 1 ]]]]]]][[[[[[[ 2 ]]]]]]][[[[[[[ 3 ]]]]]]]\"\n end",
"def draw\n\t\t@currentState.draw\n\tend",
"def display(i,j)\n \t print \"\\e[H\"\n\t puts \" \" + \"_\" * (@width * 2 - 1)\n\t \n\t @grid.each_with_index do |row,y|\n\t print \"|\"\n\t\t row.each_with_index do |cell,x|\n\t\t # \n\t\t\t # Color gray if empty, red if \"current\" cursor\n\t\t\t #\n\t\t\t if cell == 0\n\t\t\t print \"\\e[47m\" \n\t\t\t elsif x == i and y == j\n \t\t\t print \"\\e[41m\"\n\t\t\t end\n\n\t\t\t # render \"bottom\" using \"S\" switch\n\t\t\t print( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\t\t\t \n\t\t\t # render \"side\" using \"E\" switch\n\t\t\t if @grid[y][x] & @@E != 0\n\t\t\t print( ( ( @grid[y][x] | @grid[y][x+1] ) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t\t else\n\t\t\t print \"|\"\n\t\t\t end\n\n\t\t\t # \n\t\t\t # Stop coloring\n\t\t\t #\n\t\t\t if cell == 0 or ( x == i and y == j )\n\t\t\t print \"\\e[m\" \n\t\t\t end\n\t\t end\n\t\t puts\n\t end\n\tend",
"def display\n p \"#{@grid[0..2].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[3..5].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[6..8].join(\" | \")}\"\n\n end",
"def render\n render_background\n # render_heat_map\n render_walls\n # render_path\n # render_labels\n render_arrows\n render_star\n render_target\n unless grid.walls.has_key?(grid.target)\n render_trail\n end\n end",
"def render_state(state)\n @cell = self\n state = state.to_s\n self.state_name = state\n\n content = send(state)\n\n if content.class == String\n return content\n end\n\n return render_view_for_state(state)\n end",
"def render_state(state)\n @cell = self\n state = state.to_s\n self.state_name = state\n\n content = send(state)\n\n if content.class == String\n return Rails.cache.fetch([\"cells\",cell_name,state].join(\":\"),:force => @force_cache_update) do\n content\n end\n end\n\n return self.render_view_for_state(state)\n end",
"def drawBoard\n\t$firstRow.each do |i|\n\t\ti.printState\n\tend\n\tnewLine\n\t$secondRow.each do |i|\n\t\ti.printState\n\tend\n\tnewLine\n\t$thirdRow.each do |i|\n\t\ti.printState\n\tend\n\tnewLine\nend",
"def render\n puts \" #{(0..7).to_a.join(' ')}\"\n (0..7).each do |row|\n puts \"#{row} #{print_row(@board.grid[row] , row).join('|')}\"\n puts\n end\n end",
"def render_cell(name, state, *args, &block)\n ::Cell::Rails.render_cell_for(name, state, controller, *args, &block)\n end",
"def render\n @board.height.times do |x|\n @board.width.times do |y|\n cell = @board.read_cell(x, y)\n print @piece_renderer.render(cell)\n end\n puts\n end\n end",
"def render\n @board.grid.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n if all_even?(row_i, col_i) || all_odd?(row_i, col_i) # this condition is for white # the two cases where the board is white is when either both row and col are even or both are odd, amazing, quite elegant\n print_piece(col, row_i, col_i, piece_color(col), \"#9AB3C9\")\n else\n print_piece(col, row_i, col_i, piece_color(col), \"#4A7190\") # this is for black lol the hex colors don't make it as clear anymore lol\n end\n end\n puts # make a new line after each row\n end\n nil # so it doesn't return the whole board just a placeholder while you play with this thing\n end",
"def draw_grid\n print_cap\n (0...@vertical).each do |vert_index|\n (0..@v_size).each do |block_height|\n (0...@horizontal).each do |horizontal_index|\n if block_height == (@v_size/2)\n print \"|\" + \" \"*(@h_size/2)\n \"#{print @contents[horizontal_index][vert_index]}|\"\n print \" \"*(@h_size/2-1)\n else\n print \"|\"; print \" \"*@h_size\n end\n end\n print \"|\\n\" \n \n end\n print_cap\n end\n end",
"def render\n game_over = false\n game.grid.each do |row|\n row_output = []\n row.each do |el|\n if el.revealed\n if el.has_bomb\n el_output = \"X\"\n game_over = true\n else\n el_output = \"_\"\n el.total_num_neighbor_bombs\n #has to be changed\n #find positions of neighbors\n #ask each neighbor if has bomb\n #count total number of bombs\n #output that integer instead of flag, star, or _\n\n\n\n\n end\n else\n el_output = el.has_flag ? \"F\" : \"*\"\n end\n row_output << el_output\n end\n p row_output.join(\" \")\n end\n # call game_over method if game_over == true\n end",
"def render_cell(name, state, *args, &block)\n ::Cell::Rails.render_cell_for(name, state, self, *args, &block)\n end",
"def render_board\n\n\t\t# So, we'll rebuild the render target from scratch\n\t\t(0...@height).each do |row|\n\t\t\t(0...@width).each do |col|\n\n\t\t\t\t# Save myself some typing, and some math cycles...\n\t\t\t\tcell_idx = (row*@width)+col\n\n\t\t\t\t# Check to see if this cell is covered\n\t\t\t\tif @cell_status[cell_idx] == :status_covered\n\t\t\t\t\tcell = @cover_png\n\t\t\t\telsif @cell_status[cell_idx] == :status_gold\n\t\t\t\t\tcell = @gold_png\n\t\t\t\telse\n\t\t\t\t\tif @dragons[cell_idx] == DRAGON\n\t\t\t\t\t\tcell = @dragon_png\n\t\t\t\t\telse\n\t\t\t\t\t\tcell = @cell_png[@dragons[cell_idx]]\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# We know what to draw, so draw it\n\t\t\t\t$gtk.args.render_target( :board ).width = @board_w\n\t\t\t\t$gtk.args.render_target( :board ).height = @board_h\n\t\t\t\t$gtk.args.render_target( :board ).sprites << {\n\t\t\t\t\tx: (col*@cell_size), y: (row*@cell_size),\n\t\t\t\t\tw: @cell_size, h: @cell_size, path: cell,\n\t\t\t\t}\n\n\t\t\tend\n\n\t\tend\n\n\tend",
"def render\n (\"A\"..\"H\").each { |col| print \" #{col}\"}\n print \"\\n\\n\"\n\n (0...8).each do |row|\n # Start counting downwards - rows are upside down in ChessBoard\n row_idx = (7 - row) % @board.rows.count + 1\n print \"#{row_idx} \"\n\n (0...8).each do |col|\n pos = [row, col]\n render_piece(pos)\n end\n\n print \"\\n\\n\"\n end\n\n debug_info if @debug\n print_controls\n end",
"def render\n # Clear the console\n puts \"\\e[H\\e[2J\"\n (1..DEFAULT_WIDTH).each do |y|\n row = []\n\n (1..DEFAULT_WIDTH).each do |x|\n row << cell(x, y).render\n end\n puts row.join(\" \")\n puts \"\\n\"\n end\n end",
"def render\n @board_array.each_with_index do |row, row_index|\n row.each_with_index do |cell, col_index|\n if @position_hash[[row_index, col_index]].hidden\n print '______'\n else\n print cell.to_s\n end\n end\n print \"\\n\"\n end\n end",
"def render(promotion = false)\n @highlight = false if promotion\n system(\"clear\")\n puts \" #{build_piece_bank(:white)[0]}\"\n puts \" #{build_piece_bank(:white)[1]}\"\n build_grid.each { |row| puts row.join }\n puts footer\n puts \"Press TAB to choose\".colorize(color: :red) if promotion\n puts \"Press and ENTER to confirm\".colorize(color: :red) if promotion\n @highlight = true\n end",
"def render_cell(name, state, opts = {})\n cell = Cell::Base.create_cell_for(@controller, name, opts)\n cell.render_state(state)\n end",
"def print_state\n @@rows.times do |row|\n @@columns.times do |column|\n print '%4.4s' % @state_array[row * @@columns + column].to_s,\" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def update\n @grid.update\n end",
"def render_board\n i = 0\n while i < board.dimension\n puts \"\"\"\n #{render_row(i)} \"\"\"\n i += 1\n end\n end",
"def render\n\n # Sets a black background on the screen (Comment this line out and the background will become white.)\n # Also note that black is the default color for when no color is assigned.\n outputs.solids << grid.rect\n\n # The position, size, and color (white) are set for borders given to the world collection.\n # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters.\n outputs.borders << state.world.map do |x, y|\n [x * state.tile_size,\n y * state.tile_size,\n state.tile_size,\n state.tile_size, 255, 255, 255]\n end\n\n # The top, bottom, and sides of the borders for collision_rects are different colors.\n outputs.borders << state.world_collision_rects.map do |e|\n [\n [e[:top], 0, 170, 0], # top is a shade of green\n [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue\n [e[:left_right], 170, 0, 0], # left and right are a shade of red\n ]\n end\n\n # Sets the position, size, and color (a shade of green) of the borders of only the player's\n # box and outputs it. If you change the 180 to 0, the player's box will be black and you\n # won't be able to see it (because it will match the black background).\n outputs.borders << [state.x,\n state.y,\n state.tile_size,\n state.tile_size, 0, 180, 0]\n end",
"def display_board\n row_idx = -1\n numera = [1,2,3,4,5,6,7,8,9]\n @display = @grid.map do |row|\n \n col_idx = -1\n row_idx += 1 \n row.map do |col| \n col_idx += 1 \n if @flag_pair.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'F'.orange\n elsif col == :B\n col = 'H'.green\n elsif (@known_empty.include? ((row_idx.to_s) + (col_idx.to_s))) && (numera.include? col)\n col = col.to_s.red\n elsif @known_empty.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'O'.blue\n else\n col = 'H'.green\n end \n end \n end\n end",
"def draw\n @app.clear\n @life.cells.each do |coordinates|\n x = coordinates[0]\n y = coordinates[1]\n # Cells that are going to live look different from dying cells.\n if @life.should_remain_alive?(x, y)\n @app.fill rgb(0x30, 0x30, 0xBB)\n else\n @app.fill rgb(0x50, 0x50, 0xFF)\n end\n @app.rect :left => x * @cell_width,\n :top => y * @cell_height, \n :width => @cell_width,\n :height => @cell_height\n end\n end",
"def draw\n \t #\n\t # Draw the \"top\" line.\n\t #\n\t puts \" \" + \"_\" * (@width * 2 - 1)\n\n\t #\n\t # Draw each of the rows.\n\t #\n\t @height.times do |y|\n\t \tprint \"|\"\n\t\t@width.times do |x|\n\t\t # TODO --> remote \"grid\" references??\n\t\t # render \"bottom\" using \"S\" switch\n\t\t print( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\n\t\t # render \"side\" using \"E\" switch\n\t\t if @grid[y][x] & @@E != 0\n\t\t print( ( (@grid[y][x] | @grid[y][x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t else\n\t\t print \"|\"\n\t\t end\n\t\tend\n\t\tputs\n\t end\n\n \t #\n\t # Output maze metadata.\n\t #\n\t puts \"#{$0} #{@width} #{@height} #{@seed}\"\n end",
"def render\n system(\"clear\")\n board.each_with_index do |row,i1|\n complete_row = []\n row.each_with_index do |col,i2|\n pos = [i1, i2]\n # debugger\n if pos == cursor.cursor_pos\n complete_row << board[i1][i2].symbol.colorize(:color => :white, :background => :black)\n else\n complete_row << board[i1][i2].symbol.colorize(:color => :white, :background => :red)\n end\n end\n puts complete_row.join\n end\n end",
"def toggle_grid\n if @show_grid\n self.show_grid = false\n else\n self.show_grid = true\n end\n end",
"def render_cell(name, state, *args)\n @subject_cell = ::Cell::Base.create_cell_for(@controller, name, *args)\n @view_assigns = extract_state_ivars_for(@subject_cell) do\n @last_invoke = @subject_cell.render_state(state, *args)\n end\n \n @last_invoke\n end",
"def render(reveal = false)\n @grid.map do |row|\n row.map do |tile|\n reveal ? tile.reveal : tile.render\n end.join(\"\")\n end.join(\"\\n\")\n end",
"def draw\n\t\t#\n\t\t# Draw the \"top\" line.\n\t\t#\n\t\tputs \" \" + \"_\" * (@width * 2 - 1)\n\t\n\t\t#\t\n\t\t# Draw each of the rows.\n\t\t#\n\t\t@height.times do |y|\n\t\t\tprint \"|\"\n\t\t\t@width.times do |x|\n\t\t\t\t# render \"bottom\" using \"S\" switch\n\t\t\t\tprint( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\t\t\t\n\t\t\t\t# render \"side\" using \"E\" switch\t\n\t\t\t\tif @grid[y][x] & @@E != 0\n\t\t\t\t\tprint( ( (@grid[y][x] | @grid[y][x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t\t\telse\n\t\t\t\t\tprint \"|\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs\n\t\tend\n\n\t\t#\t\n\t\t# Output maze metadata.\n\t\t#\n\t\tputs metadata\n\tend",
"def draw()\n @ucActStates.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @ucAtkStat.draw()\n @ucDefStat.draw()\n @ucSpiStat.draw()\n @ucAgiStat.draw()\n @ucEvaStat.draw()\n @ucHitStat.draw()\n @ucCriStat.draw()\n end",
"def render\n print \"\\n\"\n @board.each do |row|\n row.each do |col|\n print \"#{col.nil? ? '.' : col} \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def render()\n print \" \"\n (0...@size).each do |col|\n print (col).to_s + \" \"\n end\n puts\n\n (0...@size).each do |row|\n (-1...@size).each do |col|\n print col == -1 ? row : card([row, col]).display\n print \" \"\n end\n puts\n end\n end",
"def draw()\n @ucActStates.draw()\n @cCharImage.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @cExpGauge.draw()\n @ucExp.draw()\n end",
"def display\n puts \"===Current Board Status===\"\n @bingo_board.each { |row| puts print row }\n end",
"def draw\n @game.state.views.each do |view|\n view.draw\n end\n end",
"def display\n\t\t#\n\t\t# Draw the \"top row\" of the maze\n\t\t#\n\t\tprint \"\\e[H\"\n\t\tputs \" \" + \"_\" * (@width * 2 - 1)\t\n\n\t\t# \n\t\t# Step through the grid cells of the maze\n\t\t#\t\n\t\t@grid.each_with_index do |row,y|\n\t\t\tprint \"|\"\n\t\t\trow.each_with_index do |cell,x|\n\t\t\t\t\n\t\t\t\t# \n\t\t\t\t# Color the cell if its frontier\n\t\t\t\t#\n\t\t\t\tprint \"\\e[41m\" if cell == @@FRONTIER\n\t\t\t\tif empty?(cell) && y+1 < @height && empty?(@grid[y+1][x])\n\t\t\t\t\tprint \" \"\n\t\t\t\telse\n\t\t\t\t\tprint( (cell & @@S != 0) ? \" \" : \"_\" )\n\t\t\t\tend\n\t\t\t\tprint \"\\e[m\" if cell == @@FRONTIER\n\n\t\t\t\t#\n\t\t\t\t# Draw the \"grid\" of the maze\n\t\t\t\t#\n\t\t\t\tif empty?(cell) && x+1 < @width && empty?(row[x+1])\n\t\t\t\t\tprint( ( y+1 < @height && ( empty?(@grid[y+1][x]) || empty?(@grid[y+1][x+1]) ) ) ? \" \" : \"_\" )\n\t\t\t\telsif cell & @@E != 0\n\t\t\t\t\tprint( ( (cell | row[x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t\t\telse\n\t\t\t\t\tprint \"|\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs\n\t\tend\n\tend",
"def render\n super\n args.outputs.primitives << [\n # Layout\n {x: 330, y: 335, w: 556, h: 308, r: 100, g: 100, b: 100}.solid,\n @exit,\n {x: 860, y: 625, text: 'X', r: 175, g: 175, b: 175}.label,\n { x: 340, y: 370, text: \"Money: $#{state.money}\", size_enum: 5, alignment_enum: align(:left) }.label,\n { x: 500, y: 66, text: 'Take a Break', size_enum: 10, r: 250, g: 250, b: 250 }.label\n ]\n args.outputs.primitives << items.map(&:render)\n end",
"def display_game\n\t\t@current_config.each.with_index(1) { |row, index|\n\t\t\tprint \"Row #{index}: \"\n\t\t\trow.times{|num| print 'X'}\n\t\t\tputs \"\"\n\t\t}\n\tend",
"def print_grid\n @grid.each do |row|\n row.each do |cell|\n if cell == 'X'\n print(cell.red)\n else\n print(cell)\n end\n end\n print(\"\\n\")\n end\n end",
"def draw\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\t# render the selected state\n\t\t\t\t\t# (it has been rendered before, so it should render now without errors)\n\t\t\t\t\tunless @history_cache.nil?\n\t\t\t\t\t\t# render the states\n\t\t\t\t\t\t# puts \"history: #{@history_cache.size} - #{@history_cache.collect{|x| !x.nil?}.inspect}\"\n\t\t\t\t\t\t\n\t\t\t\t\t\t# TODO: render to FBO once and then render that same state to the screen over and over again as long as @time_travel_i is unchanged\n\t\t\t\t\t\t# currently, framerate is down to ~30fps, because this render operation is expensive.\n\t\t\t\t\t\t\n\t\t\t\t\t\t# State 0 is not renderable, because that is before the first update runs. Without the first update, the first draw will fail. Just skip state 0. Later, when we attempt to compress history by diffs, state 0 may come in handy.\n\t\t\t\t\t\trender_onion_skin(\n\t\t\t\t\t\t\t@history_cache[1..(@time_travel_i-1)], ONION_SKIN_STANDARD_COLOR,\n\t\t\t\t\t\t\t@history_cache[@time_travel_i], ONION_SKIN_NOW_COLOR,\n\t\t\t\t\t\t\t@history_cache[@forecast_range], ONION_SKIN_ERROR_COLOR\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t# @history_cache[@time_travel_i].draw @window\n\t\t\t\t\t\t\n\t\t\t\t\t\t# ^ currently the saved state is rendering some UI which shows what the current TurnCounter values are. This is going to have weird interactions with onion skinning. Should consider separating UI drawing from main entity drawing.\n\t\t\t\t\t\t# (or maybe onion-skinning the UI will be cool? idk)\\\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t@ui.draw @window, @wrapped_object, @history_cache, @turn\n\t\t\t\tend\n\t\t\tend",
"def cheat\n Board.print_grid(@grid)\n end",
"def render\n\t\tclear_screen\n\t\tcenter_this [\"\",\" MINESWEE\\u2691ER\"]\n\n\t\t# Create the upper and lower vertical edges of board\n\t\tboard_vertical_edge = \" +\"\n\t\t@width.times { board_vertical_edge << \"--\" }\n\t\tboard_vertical_edge << \"-+\"\n\n\t\t# Display column headers vertically to save space\n\t\t# Places tens place directly above the ones place, if necessary\n\t\ttens = \" \"\n\t\tones = \" \"\n\t\t@width.times do |x|\n\t\t\tif x >= 10\n\t\t\t\ttens << x.to_s[0] + \" \"\n\t\t\t\tones << x.to_s[1] + \" \"\n\t\t\telse\n\t\t\t\ttens << \" \"\n\t\t\t\tones << x.to_s + \" \"\n\t\t\tend\n\t\tend\n\t\tcenter_this tens if @width >= 11\n\t\tcenter_this ones\n\t\tcenter_this board_vertical_edge # Display top edge of board\n\n\t\t# Loop through and display each row\n\t\t@cell_at.each_with_index do |row, row_title|\n\t\t\t# Add the row title, as a letter, to the row contents\n\t\t\trow_contents = row_title.to_s.tr(\"0-9\", \"a-z\").upcase + \" | \"\n\t\t\t# Loop through each cell in row and it to row contents\n\t\t\trow.each do |col|\n\t\t\t\tcase col.state\n\t\t\t\twhen :hidden\n\t\t\t\t\trow_contents << \"\\u2591 \"\n\t\t\t\twhen :flagged\n\t\t\t\t\trow_contents << \"\\u2691 \"\n\t\t\t\twhen :visible\n\t\t\t\t\trow_contents << col.risk unless col.risk == :mine\n\t\t\t\t\trow_contents << \"\\u2699\" if col.risk == :mine\n\t\t\t\t\trow_contents << \" \"\n\t\t\t\tend\n\t\t\tend\n\t\t\trow_contents << \"|\"\n\t\t\tcenter_this row_contents # Display row\n\t\tend\n\t\tcenter_this board_vertical_edge # Display bottom edge of board\n\t\tcenter_this \" FLAGS LEFT: #{@flags_left}\" # Display remaining flags\n\t\tputs\n\t\tputs\n\tend",
"def render\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |tile, j|\n if i == 0 || i == 7\n if j == 0 || j == 7\n print \" R \"\n elsif j == 1 || j == 6\n print \" Kn\"\n elsif j == 2 || j == 5\n print \" B \"\n else\n print \" T \"\n end\n elsif i == 1 || i == 6\n print \" p \"\n else\n print \" X \".colorize(:blue)\n end\n end\n puts\n end\n return nil\n end",
"def grid(*)\n super\n end",
"def render\n glClearColor(*@background_color)\n @render_list.each { | o | o.render }\n end",
"def display\n system 'clear'\n @line_width = 60\n display_header\n display_board\n display_shield_row\n display_legend\n end",
"def display\n\t\tdisplay_headers\n\t\t@rows.each do |row|\n\t\t\tdisplay_row(row)\n\t\tend\n\tend",
"def draw\n @status_buttons.each do |i|\n i.draw\n end\n end",
"def print_grid\n puts \"Generation: #{@generation}\"\n @width.times do |x|\n @height.times do |y|\n print \"#{@current_generation[x][y]}\" + \" \"\n end\n puts\n end\n puts \"-------------------------------------------------\"\n end",
"def draw\n @headers[@game_state_model::players[@game_state_model.player_turn_state]::player_color].draw(@x, @y, 35)\n\n if @game_state_model.player_turn_state == 0\n @ico_one.draw(@x + 143, @y + 20, 35)\n elsif @game_state_model::players[@game_state_model.player_turn_state]::ai == nil\n @ico_two.draw(@x + 143, @y + 20, 35)\n else \n @ico_ai.draw(@x + 143, @y + 20, 35)\n end\n\n @tiles[@game_state_model::players[0]::player_color].draw(@x + 10, @y + 8, 35)\n @tiles[@game_state_model::players[1]::player_color].draw(@x + 10, @y + 48, 35)\n # @block_purple.draw(@x + 10, @y + 5, 1)\n # @block_green.draw(@x + 10, @y + 45, 1)\n @question.draw\n @cancel.draw\n @font.draw(\"#{@game_state_model::players[0]::name}\", 50, @y + 7, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[0]::score}\", 50, @y + 22, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"#{@game_state_model::players[1]::name}\", 50, @y + 47, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[1]::score}\", 50, @y + 62, 35, 1.0, 1.0, 0xff_ffffff)\n end",
"def print_grid\n rows = @grid.map do |row|\n row.join(\" \")\n end\n print rows.join(\"\\n\")\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def display \n system(\"clear\") || system(\"cls\")\n\n grid = content.split(\"\\n\")\n print \" \" # make grid line up\n grid.length.times{|num| print \" #{num + 1}\"}\n grid.length.times{|row|\n puts \"\"\n print (65+row).chr + \" \"\n grid[row].length.times{|col|\n print grid[row][col] \n }\n }\n puts \"\"\n end",
"def show \n for i in 0...size\n for j in 0...size\n print @grid[i][j] + \" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def grid_modified!\n end",
"def draw()\n @vc.content_tag(:table) do\n @left = true\n @vc.capture do\n for col in columns do\n @vc.concat col.field(@record, self)\n end\n @vc.concat('<td colspan=3></td>'.html_safe) if !@left\n end\n end\n end",
"def render\n\t\tputs `clear` #this clears the terminal to keep the playing space clean\n\t\tfor i in 0...@@board.length\n\t\t\tmapping_array = @@board[i].map { |e| renderHelper(e) }\n\t\t\tputs mapping_array.join('|')\n\t\tend\n\tend",
"def draw_current \t \n \t\" #{@spaces[:space_1]} | #{@spaces[:space_2]} | #{@spaces[:space_3]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_4]} | #{@spaces[:space_5]} | #{@spaces[:space_6]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_7]} | #{@spaces[:space_8]} | #{@spaces[:space_9]}\\n\" +\n \t\t\t\t\t\t \" | | \\n\\n\"\n end",
"def draw_states\n draw_header\n \n change_color(system_color)\n draw_text(5, 32, self.width, 24, \"Estados:\")\n \n change_color(normal_color)\n @enchant[:effects][9].each_with_index do |x, i|\n draw_icon($data_states[x].icon_index, 5, 56 + 24 * i)\n draw_text(32, 56 + 24 * i, self.width - 32, 24, $data_states[x].name)\n end\n \n @enchant[:effects][10].each_with_index do |x, i|\n draw_text(self.width - 64, 56 + 24 * i, 64, 24, \"#{x}%\")\n end\n \n draw_text(5, 56, self.width, 24, MBS::Equip_Enchantment::EMPTY_TEXT) if @enchant[:effects][9].empty?\n end",
"def render\n outputs.solids << [grid.rect, 100, 100, 100]\n render_zombies\n render_killed_zombies\n render_player\n render_flash\n end",
"def start\n ConwayViewerOpenGL::to_gl(self.cells)\n end",
"def display(obj)\n\t\t@mainGrid.remove(@currentObject.gtkObject)\n\t\t@mainGrid.remove(@background)\n\t\t@currentObject = obj\n\t\t@mainGrid.attach(@currentObject.gtkObject, 0, 1, 0,1)\n\t\t@mainGrid.attach(@background,0,1,0,1)\n\t\tshow_all\n\tend",
"def render\n @windows.each_value(&:render)\n end",
"def render\n # Every cell is an individual quad\n # using the propane grid convenience function instead of a nested loop\n grid(z.size - 1, z[0].size - 1) do |x, y|\n # one quad at a time\n # each quad's color is determined by the height value at each vertex\n # (clean this part up)\n no_stroke\n push_matrix\n begin_shape(PConstant::QUADS)\n translate(x * scl - w * 0.5, y * scl - h * 0.5, 0)\n fill(z[x][y] + 127, 220)\n vertex(0, 0, z[x][y])\n fill(z[x + 1][y] + 127, 220)\n vertex(scl, 0, z[x + 1][y])\n fill(z[x + 1][y + 1] + 127, 220)\n vertex(scl, scl, z[x + 1][y + 1])\n fill(z[x][y + 1] + 127, 220)\n vertex(0, scl, z[x][y + 1])\n end_shape\n pop_matrix\n end\n end",
"def render_grid_lines\n outputs.lines << (0..grid.width).map { |x| vertical_line(x) }\n outputs.lines << (0..grid.height).map { |y| horizontal_line(y) }\n end",
"def print_grid\n @grid.each do |arr|\n puts arr.join(\" \")\n end\n end"
] |
[
"0.72304994",
"0.7206337",
"0.70700365",
"0.70438075",
"0.69868636",
"0.68171823",
"0.676829",
"0.67381376",
"0.6724603",
"0.6667249",
"0.6667249",
"0.6661648",
"0.65830845",
"0.65780807",
"0.6576031",
"0.649558",
"0.6399635",
"0.6392365",
"0.62914515",
"0.6261261",
"0.6240864",
"0.6229519",
"0.622807",
"0.6209215",
"0.62052286",
"0.62040085",
"0.61816955",
"0.61730146",
"0.615548",
"0.614407",
"0.61425716",
"0.6140112",
"0.6101141",
"0.6059088",
"0.599919",
"0.599474",
"0.5978127",
"0.59743255",
"0.59565294",
"0.59421146",
"0.59334964",
"0.5914406",
"0.58999515",
"0.5886082",
"0.5876211",
"0.5862551",
"0.5857132",
"0.5856244",
"0.58474195",
"0.5843218",
"0.5835172",
"0.5813089",
"0.5802839",
"0.58005214",
"0.5781839",
"0.57770133",
"0.5766545",
"0.57653034",
"0.57611054",
"0.574798",
"0.57285815",
"0.5725981",
"0.57000667",
"0.5677259",
"0.56596756",
"0.565692",
"0.565235",
"0.5622871",
"0.5609779",
"0.55999726",
"0.5599031",
"0.5589219",
"0.5588638",
"0.55824965",
"0.558163",
"0.5573715",
"0.55709773",
"0.556901",
"0.555658",
"0.55550075",
"0.55418503",
"0.55418503",
"0.55418503",
"0.55418503",
"0.55418503",
"0.55418503",
"0.55236435",
"0.5520642",
"0.5507166",
"0.5487396",
"0.5477349",
"0.545976",
"0.5447622",
"0.5442262",
"0.54397476",
"0.54374146",
"0.54292345",
"0.541844",
"0.54107946",
"0.5405189"
] |
0.5515794
|
88
|
5 points Extend your previous program to act like a smart grandfather clock. Given both the hour of the day and a sound, your program will display the sound that many times. For example: $ ruby exercise6.rb 4 GONGGG! GONGGG! GONGGG! GONGGG! GONGGG!
|
def grandfather_clock(hour, sound, &block)
hour.times do
block.call(sound)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def speak(number_of_times)\n\t\tindex = 0\n\t\tuntil number_of_times == index \n\t\t\tputs \"Ho, ho, ho!, Haaaappy holidays!\"\n\t\t\tindex +=1\n\t\tend \n\tend",
"def speak(repetitions)\n repetitions.times {puts \"Woof!\"}\n end",
"def mayday\n\tprint \"Les ennemis attaquent \"\n\t\t3.times do\n\t\tsleep(0.2)\n\t\tprint \".\"\n\tend\n\tprint \"POW!\"\n\t3.times do\n\t\tsleep(0.2)\n\t\tprint \".\"\n\tend\n\tputs \"THUMP...\" \n\tsleep(0.5)\n\tputs \"\"\nend",
"def full_game\n 52.times do\n round\n end\n output\n rematch\n end",
"def using_times\n\t7.times do\n\t puts \"Wingardium Leviosa\"\n\tend\nend",
"def alarm \n \n#greeting \t\nputs \"Ready Steady Go\"\n\n#user input/converting to an integer \nputs \"Start you clock: Input Hour (from 1-12) and press enter\"\nhour = gets.chomp.to_i\nputs \"Input minutes and press enter\"\nmin = gets.chomp.to_i\n#setting the index to 0 \ni = 0\nhour += 12\n\ncurrent_time = DateTime.now\nsetTime = DateTime.new(2021,10,8, hour, min)\n\ncurrent_time.strftime \"%H:%M\"\nsetTime.strftime \"%H:%M\"\n\n\tif min < 13\n\t\tputs \"Crunch-Time set for #{hour}:0#{min}\"\n\telse\n\t\tputs \"Crunch-Time set for #{hour}:#{min}\"\n\tend\n#loop for the the alarm sound function. Loop will end after 1 rotation of the code\nwhile i < 1\n\t#gem\n\tcurrent_time = DateTime.now\n\tcurrent_time.strftime \"%H:%M\"\n\t#setting paramiters \n if (current_time.strftime \"%H:%M\") == (setTime.strftime \"%H:%M\")\n\t\t#execution for the mp3 audio. \n\t\tpid = fork{ exec 'afplay', \"sound.mp3\"}\n\t\tputs \"Al' here, how did you go? Have a break and lets do it all again. Otherwise, scroll down to Exit\"\n\t\ti+=1\n end \n end \nend",
"def sheetlisten()\n n=0.5\n i=0\n while i<@songstr.length-1\n case @songstr[i]\n when 'a' \n play :a\n when 'b' \n play :b\n when 'c' \n play :c\n when 'd' \n play :d\n when 'e' \n play :e\n when 'f' \n play :f\n when 'g' \n play :g\n else\n if(!is_numeric?(@songstr[i]))\n puts(\"invalid char\")\n end\n end\n if(!is_numeric?(@songstr[i+1]))\n sleep 0.5\n else\n case @songstr[i+1]\n when '2' \n #for halfnote at regular speed: sleep 1\n n=1\n when '8' \n #for eighth\n n=0.25\n when '6' \n #for sixteenth note\n n=0.125\n end\n sleep n\n i+=1\n end\n i+=1\n end\n end",
"def talk\r\n\t\tputs \"You spend a little time each day talking to \" + @name +\".\t\t\"\r\n\t\t@height += @height * 1.5\r\n\t\tif @yield == 0\r\n\t\t\tif ((@height >= 1) and (@height < 3))\r\n\t\t\t\t@yield += 2\r\n\t\t\telsif ((@height >= 3) and (@height < 7))\r\n\t\t\t\t@yield += 5\r\n\t\t\telsif @height >= 7 \r\n\t\t\t\t@yield += 10\r\n\t\t\telse \r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tputs \"Well that certainly helped! Even if your neighbours did think you were crazy. Here we are 1 year later and \" + @name.to_s + \" is now \" + @height.to_s + \" metres tall and now has \" + @yield.to_s + \" oranges.\"\r\n\t\telse\r\n\t\t\tputs @name + \"'s produced all their fruit for this year.\"\r\n\t\tend\r\n\tend",
"def part1\n 2.times do\n \n 6.times do\n play :G4\n play :E4\n play :E2\n sleep 0.5\n end\n \n 2.times do\n play :A4\n play :E4\n play :E2\n sleep 0.5\n end\n end\nend",
"def alejandro1\n # Variable creation.\n # Data structure (way of storing data): List\n notes = [:b4, :b4, :b4, :d4, :e4, :fs4, :fs4, :e4,\n :fs4, :fs4, :fs4, :c4, :c4, :c4, :c4] # :r is rest.\n \n durations = [0.5, 0.25, 0.25, 0.5, 0.5, 0.5, 1, 0.5,\n 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5]\n \n play_pattern_timed notes, durations\nend",
"def alejandro1\n # Variable creation.\n # Data structure (way of storing data): List\n notes = [:b4, :b4, :b4, :d4, :e4, :fs4, :fs4, :e4,\n :fs4, :fs4, :fs4, :cs4, :cs4, :cs4, :cs4] # :r is rest.\n \n durations = [0.5, 0.25, 0.25, 0.5, 0.5, 0.5, 1, 0.5,\n 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5]\n \n play_pattern_timed notes, durations\nend",
"def gulag\n @soviet_sound.stop\n @gulag.play\n puts `clear`\n puts '\n ███ ▄█ █▄ ▄████████ ▄██████▄ ███ █▄ ▄█ ▄████████ ▄██████▄ \n ▀█████████▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ \n ▀ ███▀▀██ ███ ███ ███ █▀ ███ █▀ ███ ███ ███ ███ ███ ███ █▀ \n ███ ▀ ▄███▄▄▄▄███▄▄ ▄███▄▄▄ ▄███ ███ ███ ███ ███ ███ ▄███ \n ███ ▀▀███▀▀▀▀███▀ ▀▀███▀▀▀ ▀▀███ ████▄ ███ ███ ███ ▀███████████ ▀▀███ ████▄ \n ███ ███ ███ ███ █▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ \n ███ ███ ███ ███ ███ ███ ███ ███ ███ ███▌ ▄ ███ ███ ███ ███ \n ▄████▀ ███ █▀ ██████████ ████████▀ ████████▀ █████▄▄██ ███ █▀ ████████▀ \n ▀ \n '.colorize(:red) \n puts \" Welcome to the Gulag, a fight for survival where winning your Gunfight will grant you a second chance…\n While losing your Gunfight results in possible elimination.\"\n \n puts \" YOUR FATE IS IN THE HANDS OF THE RUBY SAMPLE METHOD\n +--^----------,--------,-----,--------^-, \n | ||||||||| `--------' | O \n `+---------------------------^----------| \n `\\_,---------,---------,--------------'\n / XXXXXX /'| /'\n / XXXXXX / `\\ /'\n / XXXXXX /`-------'\n / XXXXXX /\n / XXXXXX /\n (________( \n `------' \n\n \"\n egg1 = [@easter_egg[2]]\n result_egg1 = @prompt.collect do\n key(:answer).select(\"Press Enter:\", egg1)\n end\n\n puts `clear`\n\n egg_result = result_egg1.values.join \n \n if egg_result = @easter_egg[2]\n moving_anim()\n end\n \n \n arr = [method(:final_straw_lose), method(:final_straw_win)]\n\n didIwin = arr.sample\n didIwin.call\n end",
"def one_round_human_codemaker\n show_round(@round)\n puts 'The machine is thinking...'\n sleep 1\n @guess = define_secret_code\n print_colorized_array(@guess)\n end",
"def play_sweet_riff\n puts \"You played a face melting riff!\"\n take_a_drink\n end",
"def alarm_clock_anna \n time = 30 \n until time == 45 \n puts \"Good Morning Anna, it's great to stay up late\"\n time += 5 \nend \nend",
"def tick\n\t\t#method does what the superclass method does....\n\t\tsuper\n\t\t\n\t\t#...method also sounds the alarm\t\n\t\tif @hours == @alarm_hours && @mins == @alarm_mins && @secs == @alarm_secs\n\t\t\tthen\n\t\t\tputs \"Beep Beep Beep!\\nThe time is #{@hours}:#{@mins}:#{@secs}\"\n\t\t\t@alarmsound = :ALARM #return ALARM for unit testing\n\t\tend\n\tend",
"def time_emoji\n %w[clockface hourglass alarmclock stopwatch watch].sample\n end",
"def chord\n note_num = 4\n samples = []\n count = 0\n duration = nil\n\n while duration.nil?\n puts Rainbow(\"For how many seconds should your chord be played?\").blue\n duration = STDIN.gets.chomp.to_i\n if duration < 1 || duration > 40 || !duration.is_a?(Integer)\n puts Rainbow(\"Please enter a number of seconds greater than 1 and less than 150!\").yellow\n duration = nil\n end\n end\n\n while count <= note_num - 1\n frequency *= 2 if count == 3\n amplitude = 0.25\n num_samples = Notes.SAMPLE_RATE * duration\n\n case count\n when 0\n frequency = Notes.get_notes\n voice = generate_sinewave(num_samples, frequency, amplitude)\n voice_1 = voice\n when 1\n frequency = Notes.get_notes\n voice = generate_sinewave(num_samples, frequency, amplitude)\n voice_2 = voice\n when 2\n frequency = Notes.get_notes\n voice = generate_sinewave(num_samples, frequency, amplitude)\n voice_3 = voice\n when 3\n frequency = Notes.get_notes\n frequency *= 2\n voice = generate_sinewave(num_samples, frequency, amplitude)\n voice_4 = voice\n end\n\n if count >= 3\n samples = [voice_1, voice_2, voice_3, voice_4].transpose.map {|x| x.reduce(:+)}\n export_samples(samples.flatten)\n end\n count += 1\n end\n samples\nend",
"def round_start\n puts 'Welcome to Hangman!'\n puts \"The word is #{@secret_word.length} characters long.\"\n print_teaser\n player_guess\n end",
"def speak(num)\n num.times do\n p \"Woof!\"\n end\n end",
"def play(song)\n puts \"#{timestamp}: Playing #{song}\"\n sleep(120 + 60*rand)\nend",
"def play(song)\n puts \"#{timestamp}: Playing #{song}\"\n sleep (120 + 60 * rand)\nend",
"def explain_game\n\t\tputs \"In the Secret Number Game, you guess a number between 1 and 10 and, if you pick the right number, you win!\"\n\t\tputs \"Good luck #{@player}!\"\n\tend",
"def using_times \n 7.times do \n puts \"Wingardium Leviosa\"\n end\nend",
"def play\n\t\tputs \"Hello, welcome to my game!\"\n\n\t\tNUMBER_OF_ROUNDS.times do \n\t\t\tround = Round.new\n\t\t\tround.play\n\t\t\tputs \"You made #{round.number_of_guesses} guesses.\"\n\t\t\tadd_guesses(round.number_of_guesses)\n\t\t\tif round.won?\n\t\t\t\t@win_count += 1\n\t\t\tend\n\t\tend\n\t\tputs \"Your average number of guesses is #{average_guesses}.\"\n\t\tputs \"Your total correct guess is #{@win_count}\"\n\t\n\tend",
"def speak\r\n\t\tputs \"Ho, ho, ho! Merry Christmas and Haaaappy holidays to all!\"\r\n\tend",
"def speak(n)\n \t\"Woof! \" * n\n end",
"def play\n beats = list.to_string\n `say -r #{rate} -v #{voice} #{beats}`\n end",
"def count_sheep\n\t5.times do |sheep|\n\t\tputs sheep\n\tend\nend",
"def speak(num)\n num.times{|x| puts \"Woof!\"}\n end",
"def lengthwin\n puts \"You have six cards, and are under 21. Congratulations, you win.\"\n restart\n end",
"def plays(h)\n\th.each do |bros, inst|\n\t\tputs \"#{bros.to_s.capitalize} Marx plays the #{inst}\"\n\tend\nend",
"def plays(h)\n\th.each do |bros, inst|\n\t\tputs \"#{bros.capitalize} Marx plays the #{inst}\"\n\tend\nend",
"def using_times\n 7.times do\n puts \"Wingardium Leviosa\"\n end\nend",
"def speak(integer)\n integer.times do\n puts \"Woof!\"\n end\n end",
"def speak(integer)\n integer.times do\n print \"Woof! \"\n end\n end",
"def count_sheep\n\t5.times do |sheep|\n\t puts sheep\n\tend\nend",
"def play\n wake\n puts \"You play fetch with #{@name}.\"\n time_passed\n end",
"def drum_roll(dramatic_text, beep)\n print \"\\a\" unless beep == false\n c = 0\n dramatic_text.length.times do\n print dramatic_text[c]\n c += 1\n sleep 0.05\nend\nend",
"def games_title_fly_in_01\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \" $$$$$$$$$$ $$$ $$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$ $$$ $$$\"\n puts \" $$$$$$$$$$ $$$ $$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$ $$$ $$$\"\n puts \" $$$ $$$ $$$ $$$ $$$ $$$$ $$$ $$$ $$$ $$$ $$$$ $$$\"\n puts \" $$$$$$$ $$$ $$$$$$$$$$ $$$ $$$$ $$$$$$$$ $$$ $$$ $$$$$$ $$$\"\n puts \" $$$$$$$ $$$ $$$$$$$$$$ $$$ $$$$ $$$$$$$ $$$ $$$ $$$ $$$$$$\"\n puts \" $$$ $$$ $$$ $$$ $$$ $$$$ $$$ $$$ $$$ $$$ $$$ $$$$\"\n puts \" $$$ $$$$$$$$$ $$$ $$$ $$$ $$$$$$$$$$ $$$ $$$ $$$$$$$$$$ $$$ $$$\"\n puts \" $$$ $$$$$$$$$ $$$ $$$ $$$ $$$$$$$$$$ $$$ $$$ $$$$$$$$$$ $$$ $$$\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\nend",
"def speak()\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end",
"def beep\n play_song([Note::G, Note::WHOLE])\n end",
"def speak\n \tputs \"Ho, Ho, Ho! Haaaaaappy holidays!\"\n end",
"def beat1(r, n)\r\n # shuffle beat\r\n t1,t2,a1,a2 = 0.45,0.25,0.4,0.5\r\n play r,amp: a1; play r+n; sleep t1\r\n play r,amp: a2; play r+n; sleep t2\r\nend",
"def speak\r\n puts \"Ho, ho, ho! Haaappy holidays!\"\r\n end",
"def speak(integer)\n integer.times {puts \"woof!\"}\n end",
"def intro_verse\n 4.times do\n play chord(:F, :major)\n sleep 1.5\n end\n \n 4.times do\n play chord(:C, :major)\n sleep 1.5\n end\n \n 4.times do\n play chord(:D, :minor7)\n sleep 1.5\n end\n \n 4.times do\n play chord(:Bb, :major)\n sleep 1.5\n end\n \n 4.times do\n play chord(:F, :major)\n sleep 1.5\n end\n \n 4.times do\n play chord(:C, :major)\n sleep 1.5\n end\n \n 4.times do\n play chord(:A, :minor)\n sleep 1.5\n end\n \n 4.times do\n play chord(:Bb, :major)\n sleep 1.5\n end\nend",
"def grandfather_clock &block\n time = Time.new.hour\n if time == 0\n time = 12\n elsif time > 12\n time = time - 12\n end\n\n time.times do\n block.call\n end\n\n # Work in progress for output once every hour while code running\n # while true\n # if (Time.new.hour - time) == 1\n # block.call\n # puts \"It is #{time}o'clock!\"\n # if time == 12\n # time = 1\n # else \n # time = time + 1\n # end\n # end\n # end\nend",
"def speak(int)\n \tint.times do |x|\n \tp \"Woof!\"\n \tend\n end",
"def drawHangMan()\n\n puts \"\\n\"\n\n if(@numOfGuesses > 2)\n puts \" xxxxxxxxxxxxx\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 3)\n puts \" x x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 3)\n puts \" x x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 4)\n puts \" xxx x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 4)\n puts \" xxxxx x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 4)\n puts \" xxx x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 5)\n puts \" x x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 7)\n puts \" x x x x\"\n elsif(@numOfGuesses > 6)\n puts \" x x x\"\n elsif(@numOfGuesses > 5)\n puts \" x x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 5)\n puts \" x x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 9)\n puts \" x x x\"\n elsif(@numOfGuesses > 8)\n puts \" x x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 9)\n puts \" x x x\"\n elsif(@numOfGuesses > 8)\n puts \" x x\"\n elsif(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 1)\n puts \" x\"\n else\n puts \"\\n\"\n end\n\n if(@numOfGuesses > 0)\n puts \"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n else\n puts \"\\n\"\n end\n\n puts \"\\n\"\n\n end",
"def speak\r\n puts \"Ho, ho, ho! Haaaappy holidays!\"\r\n puts \"\"\r\n end",
"def play tick, sounds\n\n # Obviously can't play a tune without a tune\n if @tune.empty? || !@playing\n return\n end\n\n # Right then, see if the current note's played time is past\n while @tune_index == -1 || @last_note + @tune[@tune_index][1] <= tick\n\n # Move onto the next note, back to the beginning if we reach the end\n @tune_index += 1\n if @tune_index >= @tune.length\n @tune_index = 0\n end\n\n # Double check if we're repeating\n if !@repeat\n @playing = false\n return\n end\n\n # Output the note\n sounds << \"#{@notes_prefix}#{@tune[@tune_index][0]}#{@notes_postfix}\"\n @last_note = tick\n end\n\n end",
"def difficulty_intro\n print \"\\nWhat difficulty would you like to play? (e)asy, (m)edium, or (h)ard? \"\n end",
"def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\t\tputs \"\"\n\tend",
"def roll_five_alt\n puts \"...........\n: * * :\n: * :\n: * * :\n'''''''''''\n\"\nend",
"def draw_playtime(x, y, width)\n #draw_bg_rect(x, y, width, line_height)\n desc = Vocab::pi_playtime\n text = sprintf(desc, player.hours, player.minutes)\n draw_text(x, y, width, line_height, text, 1)\n end",
"def potential_greetings(time)\n if time >= 5 && time <= 12 \n puts \"Good Mornin'!\"\n elsif time >= 12 && time <= 18\n puts \"Good Afternoon ma dudes!\"\n elsif time >= 18 && time <= 20\n puts \"Good evenin'!\"\n elsif time >= 20 && time <= 24\n puts \"goodnight!\"\n else \n puts \"Salutations comrade\"\n end \nend",
"def speak (bark_num)\n bark_num.times {puts \"Woof!\"}\n end",
"def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end",
"def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end",
"def roll_six_alt\n puts \"...........\n: * * :\n: * * :\n: * * :\n'''''''''''\n\"\nend",
"def playLushSounds\n in_thread do\n sleep 2\n with_fx :reverb, room: 0.9, amp: 1.4 do\n with_fx :hpf, cutoff: 80 do\n sample :ambi_glass_hum, attack: 3\n sleep 1\n sample :ambi_glass_hum, attack: 1, rate: 2, amp: 0.7, pan: -0.9\n sample :ambi_glass_hum, attack: 1, rate: -2, amp: 0.7, pan: 0.9\n end\n end\n end\nend",
"def game_intro\n puts \"Welcome to the Farmers Market\"\n puts \"*\" * 30\n puts \"What is your name?\"\nend",
"def say_happy_birthday_to(name, repetitions)\n repetitions.times { |i| puts \"Happy Birthday #{name}\"}\n end",
"def background_music(song1, song2)\n puts \"The song, #{song1}, makes me want to work continuously.\"\n puts \"The song, #{song2}, makes me sleepy.\"\n puts \"I wsih every song made me feel like I could conqueor the world!\"\nend",
"def help_players\n puts \"Greed is a dice game played among 2 or more players, using 5\"\n puts \"six-sided dice.\"\n pressToContinue\n end",
"def play\n# \tThere are 3 players in Knuckleheads: \n\t\tputs \"There are #{to_s} players in #{@title}\"\n# \tI'm Moe with a health of 100 and a score of 103.\n# \tI'm Larry with a health of 60 and a score of 65.\n# \tI'm Curly with a health of 125 and a score of 130.\n\t\t@Player.each do |spieler|\n\t\t\tputs \"I'm #{spieler} with a health of #{@health} and a score of #{score}\"\n\t\t\tend\n# \tMoe got blammed!\n# \tMoe got w00ted!\n# \tMoe got w00ted!\n# \tI'm Moe with a health of 120 and a score of 123.\n# \tLarry got blammed!\n# \tLarry got w00ted!\n# \tLarry got w00ted!\n# \tI'm Larry with a health of 80 and a score of 85.\n# \tCurly got blammed!\n# \tCurly got w00ted!\n# \tCurly got w00ted!\n# \tI'm Curly with a health of 145 and a score of 150.\n\t\tend",
"def make_a_sound\n\t\tputs \"ROARRRR!!!\"\n\tend",
"def meow\r\n\t\t# output: prints string of # of meows based on talkative-ness\r\n\t\t\t# IF mild (1 to 3) , meows once\r\n\t\t\tputs \"meowww\" if (1..3).include?(@meowiness)\r\n\t\t\t# IF medium (4 to 6), meows 3 times\r\n\t\t\t3.times { print \"meowww \"} if (4..6).include?(@meowiness)\r\n\t\t\t# IF high (7 to 8), meows 5 times,\r\n\t\t\t5.times { print \"meowwww \" } if (7..8).include?(@meowiness)\r\n\t\t\t# IF really high (9 to 10), meows 5 times, CAPS\r\n\t\t\t5.times { print \"meowwww \".upcase } if (9..10).include?(@meowiness)\r\n\t\tend",
"def greeting(time)\n\t\"It's already #{day_of_the_week(time)}! Time to slay the day!\"\nend",
"def pbToneChangeAll(tone, duration)\n $game_screen.start_tone_change(tone,duration * 2)\n for picture in $game_screen.pictures\n picture.start_tone_change(tone,duration * 2) if picture\n end\nend",
"def printRandom(duration)\n st = \"q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M,1,2,3,4,5,6,7,8,9,0,!,@,#,$,%,^,&,*,(,),_,+,[,],|,{,}\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe( x[$prng.rand(0...x.length())] ))}\"\n currentTime = Time.now.to_i\n end\n menu()\nend",
"def week_3\n wait(0)\n say \"Start your first short run.\"\n count_down(90, 'running')\n say \"Stop running now. You have 1 long run and two short ones left.\"\n count_down(90, 'walking')\n\n say \"Start the first long run now.\"\n count_down(3*60, 'running')\n say \"Stop running now. You have a short run and a long run left.\"\n count_down(3*60, 'walking')\n\n say \"Start your second short run.\"\n count_down(90, 'running')\n say \"Stop running. You have 1 more long run left.\"\n count_down(90, 'walking')\n\n say \"Start your last run now.\"\n count_down(3*60, 'running')\n say \"Stop running. After this walk, you will have finished.\"\n count_down(3*60, 'walking')\n\n say \"Great! You've finished for today.\"\nend",
"def happy_hour\n event_display(\"It's HAPPY HOUR! Everybody let's loose.\")\n group_event_hash_creator({soft_skills: 2, wellbeing: 2})\n end",
"def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\tend",
"def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\tend",
"def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\tend",
"def play_round #this is a single round \n self.dictionary\n @fragment = \"\"\n round_over = false\n\n while round_over == false\n player = self.current_player\n if self.take_turn(player) == true\n round_over = true\n else\n self.next_player!\n end\n end\n\n puts \"Round is over! Word spelt: #{@fragment}\"\n puts \"STANDINGS:\"\n puts \"#{self.record(self.current_player.name)}\"\n puts \"#{self.record(self.previous_player.name)}\"\n puts \"__________________________________________________\"\n puts \"__________________________________________________\"\n puts \"__________________________________________________\"\n puts \"\"\n end",
"def update\n n = $seconds_per_tick\n @time += n\n\n @ticks_to_update_clock -= 1\n\n if @ticks_to_update_clock == 0\n @ticks_to_update_clock = (60 / $seconds_per_tick).to_i\n @text.text = to_s\n end\n\n if !@time.day? and @old_hour != @time.hour\n @sun_shining_mask.color.opacity = sun_mask_opacity\n @old_hour = @time.hour\n end\n end",
"def speak\r\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\r\n\tend",
"def game_over\n puts \" ██████╗ █████╗ ███╗ ███╗███████╗\"\n sleep(1)\n puts \"██╔════╝ ██╔══██╗████╗ ████║██╔════╝\"\n sleep(1)\n puts \"██║ ███╗███████║██╔████╔██║█████╗ \"\n sleep(1)\n puts \"██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ \"\n sleep(1)\n puts \"╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗\"\n sleep(1)\n puts \"╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n puts \"██████╗ ██╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██╔═══██╗██║ ██║██╔════╝██╔══██╗ \"\n sleep(1)\n puts \"██║ ██║██║ ██║█████╗ ██████╔╝ \"\n sleep(1)\n puts \"██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗ \"\n sleep(1)\n puts \"╚██████╔╝ ╚████╔╝ ███████╗██║ ██║ \"\n sleep(1)\n puts \"╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ \"\n sleep(1)\n\n\n exit(0)\nend",
"def pbToneChangeAll(tone,duration)\n $game_screen.start_tone_change(tone,duration*2)\n for picture in $game_screen.pictures\n picture.start_tone_change(tone,duration*2) if picture\n end\nend",
"def finish_round\n display(\"\\n\\n ---------------- TIME TO SETTLE ---------------- \\n\\n\")\n end",
"def setTime\n if self.exists && File.writable?(\".\")\n nFile = File.new(\"timed_#{@filename}\", \"w+\")\n \n self.play\n \n puts \"Press enter every time the next lyric should show up!\\n\"\n \n @file.each {\n |line|\n charPrint(line)\n getTime(line, nFile)\n }\n\n nFile.close\n @file.rewind\n end\n end",
"def speak\n\t\tfor i in 1..42\n\t\t\tputs grunt\n\t\tend\n\tend",
"def repeat_ho(num)\n num.times { puts 'hi' }\n end",
"def bass_intro\n play :f2, sustain: 3\n sleep 3.66\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :D3, sustain: 0.66\n sleep 0.66\n play :e3, sustain: 0.66\n sleep 0.93\n play :d3, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :bb2, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :f2, sustain: 3.5\n sleep 4.4\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :d3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :a2, sustain: 4\n sleep 5.4\n play :a2, sustain: 0.66\n sleep 0.66\n play :bb2, sustain: 3.5\n sleep 4.4\n play :E3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 1.66\nend",
"def ec2(amp = 0.2, tonics = [:e2], num = 4, synth = :fm)\n num.times do\n synth synth, note: chord(tonics.choose, [:m11, :m9, :major, :major7].choose),\n attack: [1, 0.75, 1.25, 1.5, 2].choose, cutoff: 80,\n amp: amp, pan: rrand(-0.2,0.2)\n sleep 1\n end\nend",
"def speak\n\t\tputs \"Haaaappy holidays!! Ho, ho, ho!\"\n\tend",
"def beer_song number\r\n\r\n\twhile number != 0\r\n\t\tputs number.to_s + \" bottles of beer on the wall, \" + number.to_s + \" bottles of beer.\"\r\n\t\tnumber -= 1\r\n\t\tputs \"Take one down and pass it around, \" + number.to_s + \" bottles of beer on the wall.\"\r\n\t\tputs\r\n\tend\r\nend",
"def greeting\n puts \"\\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\"\n puts \" ● WELCOME TO TIC TAC TOE ●\"\n puts \"★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\"\n\n puts \"\\n❉ Game Types ❉\"\n puts \"--------------------------------------------\"\n puts \">> 1 << One Player Game\"\n puts \">> 2 << Two Players Game\"\n puts \">> 0 << The computer will play against itself\"\n puts \"--------------------------------------------\"\n end",
"def fizz_buzz_cuckoo_clock(time)\n array = time.split(\":\").map(&:to_i)\n array[0] = array[0] % 12\n case\n when array[0] == 0 && array[1] == 0\n answer = (\"Cuckoo\" + \" \") * 11 + \"Cuckoo\"\n when array[1] == 0\n answer = (\"Cuckoo\" + \" \") * (array[0] - 1) + \"Cuckoo\"\n when array[1] == 30\n answer = \"Cuckoo\"\n when (array[1] % 3) == 0 && (array[1] % 5) == 0\n answer = \"Fizz Buzz\"\n when (array[1] % 3) == 0\n answer = \"Fizz\"\n when (array[1] % 5) == 0\n answer = \"Buzz\"\n else\n answer = \"tick\"\n end\n return answer\nend",
"def play_round\n puts @game_word + \"\\n\\n\"\n guess = @curr_player.get_guess\n if correct_guess?(guess)\n @curr_player.correct_guesses += [guess]\n else\n @curr_player.guesses_remaining -= 1\n @curr_player.incorrect_guesses += [guess]\n end\n puts \"#{@curr_player.name}'s' incorrect guesses: #{@curr_player.incorrect_guesses}\"\n puts \"#{@curr_player.name}'s guesses remaining: #{@curr_player.guesses_remaining}\"\n puts \"#{@curr_player.name}'s available points: #{@curr_player.correct_guesses.length * @secret_word.length}\"\n puts \"#{@curr_player.name}'s flower: \"\n puts File.read(\"flower#{@curr_player.guesses_remaining}.txt\")\n puts \"_____________________________________\"\n puts \"\\n\\n\"\n @curr_player_index = (@curr_player_index + 1) % 2\n @curr_player = @players[@curr_player_index]\n end",
"def tally\n player = @game.player\n output = \"\"\n output << \"Tally at present is #{player.score}\\n\"\n output << \"You have killed #{player.monsters_killed} monsters so far...\\n\" if rand > 0.5\n\n puts output\n\n output\n end",
"def jeeves_thinks\n print \"\\nJeeves is considering his options\"\n 3.times do\n print '.'\n sleep 0.5\n end\n puts ''\n end",
"def tenBells\n 10.times do\n # beep if you can\n print \"-\"\n end\nend",
"def scream (*exclamations)\n\t\trandom_exclamations = [\"No way!\", \"AAAAAAHHHHHH!\", \"Please help me!\", \"OOOOOHHHHHHH!\", \"Ouch!\", \"SO UNFAIR!\", \"Ouchie ouchie ouchie ouchie...\", \"DUDE!\"]\n\t\trandom_exclamation_a = random_exclamations.sample\n\t\trandom_exclamation_b = random_exclamations.sample\n\n\t\tdef print_scream(random_exclamation_a, random_exclamation_b, *exclamations)\n\t\t\tif sufficient_caffeine_level(1)\n\t\t\t\tprint \"#{@name} is screaming: #{random_exclamation_a} \"\n\t\t\t\texclamations.each {|x| print \"WOOOOAAAHH! #{x} \"}\n\t\t\t\tputs \" #{random_exclamation_b}\"\n\t\t\t\t@caffeine_level -= 1\n\t\t\t\tcheck_caffeine_level()\n\t\t\telse\n\t\t\t\tputs \"#{@name} doesn't have enough caffeine to scream. Drink coffee now!\"\n\t\t\tend\n\t\tend\n\t\tprint_scream(random_exclamation_a, random_exclamation_b, *exclamations)\n\tend",
"def speak\n print \"Ho, ho, ho! Haaaappy holidays!\"\nend",
"def play_random_clip()\n 0.upto(8){\n\tid = rand($full_sample_filelist.size)\n=begin\t\n\t# Theses variables are used by the sample playing - affected to the last line of knobs\n\t$sample_volume = 1.0\n\t$sample_speed = 1.0\n\t$sample_reverse = false\n\t$sample_sampling_rate = 44100\n\t$sample_start_pos = 0.0\n\t$sample_phaser = [ false, 0.95, 0.95, 3, 0.6, 2, \"-t\" ] # active gain-in gain-out delay decay speed [-s(inusoid)|-t(riangle)]\n\t$sample_flanger = [ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ] # [active, delay depth regen width speed shape phase interp]\n\t$sample_reverb = [ false, 99, 99, 100, 100, 0, 0, ] # active, reverb, HF-damping, room-scale, stereo-depth, pre-delay, wet-gain\n=end\n\tcmd = \"play -v #{$sample_volume} \\\"#{$full_sample_filelist[id]}\\\" \"\n\tcmd += \"rate #{$sample_sampling_rate} \"\n\tcmd += \"speed #{$sample_speed} \"\n\tcmd += \"#{$sample_reverse == true ? \"reverse\" : \"\"} \"\n\tcmd += \"trim =0.0 \"\n\t\n\tcmd += $sample_phaser[0] == true ? \"phaser #{$sample_phaser[1].round(2)} #{$sample_phaser[2].round(2)} #{$sample_phaser[3].round(2)} #{$sample_phaser[4].round(2)} #{$sample_phaser[5].round(2)} #{$sample_phaser[6]} \" : \"\"\n\tcmd += $sample_flanger[0] == true ? \"flanger #{$sample_flanger[1].round(2)} #{$sample_flanger[2].round(2)} #{$sample_flanger[3].round(2)} #{$sample_flanger[4].round(2)} #{$sample_flanger[5].round(2)} #{$sample_flanger[6]} #{$sample_flanger[7].round(2)} #{$sample_flanger[8]} \" : \"\"\n\tcmd += $sample_reverb[0] == true ? \"reverb #{$sample_reverb[1].round(2)} #{$sample_reverb[2].round(2)} #{$sample_reverb[3].round(2)} #{$sample_reverb[4].round(2)} #{$sample_reverb[5].round(2)} #{$sample_reverb[6].round(2)} \" : \"\"\n\t\n\tcmd += \" > /dev/null 2>&1\" #[ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ]\n\n\tputs cmd\n \tThread.new(){\n\t\tif(rand(2) < 1) then # thread it and jump to next sample instantly\n\t\t\tThread.new(){\n\t\t\t\tsystem(cmd)\n\t\t\t}\n\t\telse\n\t\t\tsystem(cmd)\n\t\tend\n \t####sleep(rand(1.0))\n \t}\n\n }\nend",
"def sing \r\n\t\tputs \"You serenade \" + @name + \" once a day.\"\r\n\t\t@height += @height * 2\r\n\t\tif @yield == 0\r\n\t\t\tif ((@height >= 1) and (@height < 3))\r\n\t\t\t\t@yield += 4\r\n\t\t\telsif ((@height >= 3) and (@height < 7))\r\n\t\t\t\t@yield += 10\r\n\t\t\telsif @height >= 7\r\n\t\t\t\t@yield += 20\r\n\t\t\telse\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tputs \"That's the trick. I've never seen such growth! Here we are 1 year later and \" + @name.to_s + \" is now \" + @height.to_s + \" metres tall and now has \" + @yield.to_s + \" oranges.\" \r\n\t\telse\r\n\t\t\tputs @name + \"'s produced all their fruit for this year.\"\r\n\t\tend\r\n\tend"
] |
[
"0.6780683",
"0.6447429",
"0.63293344",
"0.6293141",
"0.62922144",
"0.62651974",
"0.62627226",
"0.6220753",
"0.6175988",
"0.61480397",
"0.6140392",
"0.613198",
"0.6079507",
"0.60727185",
"0.6062683",
"0.60451233",
"0.6015646",
"0.60102326",
"0.5997692",
"0.5988598",
"0.5981116",
"0.5979525",
"0.59792703",
"0.59684664",
"0.5962721",
"0.59593815",
"0.5947674",
"0.59348273",
"0.5929532",
"0.5928424",
"0.5920087",
"0.5918482",
"0.59161335",
"0.5901349",
"0.58931166",
"0.5891805",
"0.5882176",
"0.5855333",
"0.58521664",
"0.582854",
"0.5811486",
"0.5808372",
"0.58062",
"0.5804751",
"0.5802668",
"0.57967556",
"0.5791317",
"0.5787776",
"0.5787144",
"0.5769268",
"0.57600415",
"0.5745591",
"0.5743604",
"0.57396483",
"0.573611",
"0.5735943",
"0.5735801",
"0.5719774",
"0.5699917",
"0.5699917",
"0.5698492",
"0.56949735",
"0.5692048",
"0.5689442",
"0.56852376",
"0.56807303",
"0.5676754",
"0.5674221",
"0.5670714",
"0.56665677",
"0.56660426",
"0.564952",
"0.5649489",
"0.56467396",
"0.56425846",
"0.56425846",
"0.56425846",
"0.5638213",
"0.5632496",
"0.56308556",
"0.56302166",
"0.5630064",
"0.56250554",
"0.5619003",
"0.5617364",
"0.56126505",
"0.56123716",
"0.561196",
"0.5611272",
"0.5606627",
"0.5605029",
"0.56021845",
"0.5601293",
"0.55890703",
"0.55736405",
"0.5571396",
"0.55645615",
"0.5564031",
"0.5563072",
"0.55552244"
] |
0.7293099
|
0
|
yaml and marshal i/o
|
def loadyaml(filename) YAML.load_file(filename) end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_yaml() end",
"def y(obj)\n puts obj.to_yaml\nend",
"def y(obj)\n puts obj.to_yaml\nend",
"def to_yaml\n # write yaml\n end",
"def paml(x)\n\n puts(YAML.dump(x))\nend",
"def yaml_content() = JSON.parse(content.to_json).to_yaml",
"def to_yaml(opts_={})\n data_ = marshal_dump\n ::YAML.quick_emit(nil, opts_) do |out_|\n out_.map(taguri, to_yaml_style) do |map_|\n map_.add('format', data_[0])\n if data_[1].kind_of?(::String)\n map_.add('value', data_[1])\n map_.add('parse_params', data_[2]) if data_[2]\n else\n map_.add('fields', data_[1])\n map_.add('unparse_params', data_[2]) if data_[2]\n end\n end\n end\n end",
"def to_yaml\n as_yaml.to_yaml\n end",
"def yaml_dump(file, obj)\n\t\tFile.open(file.to_s, 'w+') {|f| f.write obj.to_yaml}\n\tend",
"def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end",
"def to_yaml\n to_h.to_yaml\n end",
"def to_yaml\n to_parsed.to_yaml\n end",
"def serialize \n Base64.encode64(@data.to_yaml) \n end",
"def yaml\n config = fetch(@variable, {})\n stringified = if config.respond_to?(:deep_stringify_keys)\n config.deep_stringify_keys\n else\n # TODO: remove when dropping rails 3 support\n # two level stringify for rails 3 compatibility\n config.stringify_keys.each_value(&:stringify_keys!)\n end\n stringified.to_yaml\n end",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def write_to_yaml(data,yaml_file) \n File.open(yaml_file,'w') { |yf| YAML.dump(data,yf) }\nend",
"def load_yaml(filename); end",
"def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def to_yaml\n to_h.to_yaml\n end",
"def yaml_file?; end",
"def yaml_save(object, filename)\n File.open (filename), \"w\" do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml( *args )\n ::Logging::Layouts::Parseable.yaml(*args)\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml(opts = {})\n return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end",
"def yaml(hash)\n method = hash.respond_to?(:ya2yaml) ? :ya2yaml : :to_yaml\n string = hash.deep_stringify_keys.send(method)\n# string.gsub(\"!ruby/symbol \", \":\").sub(\"---\",\"\").split(\"\\n\").map(&:rstrip).join(\"\\n\").strip\nend",
"def load_yaml(data, safe: T.unsafe(nil), whitelist_classes: T.unsafe(nil), whitelist_symbols: T.unsafe(nil), aliases: T.unsafe(nil)); end",
"def to_yaml(file=nil)\n hsh = to_hash\n string = hsh.to_yaml\n if file\n File.open(file, 'w') {|v| v.print string }\n end\n string\n end",
"def to_yaml\n return @data.to_yaml\n end",
"def to_yaml(opts = {})\n return super unless defined?(YAML::ENGINE) && YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml(opts={})\n YAML.quick_emit(nil, opts) do |out|\n out.scalar(taguri, to_h, :plain)\n end\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def encode(value)\n value.to_yaml\n end",
"def encode(value)\n value.to_yaml\n end",
"def yaml\n @config.to_yaml\n end",
"def serialize(object)\n YAML.dump(object)\n end",
"def yaml_dump(val)\n yml = \"\\n\" + YAML.dump(val)\n yml.gsub(/ +\\n/, \"\\n\")\n end",
"def to_yaml\n self.to_h.to_yaml\n end",
"def to_yaml\n self.to_h.to_yaml\n end",
"def dump_yaml(args = {})\n\t # \n\t # parse arguments\n\t # \n\t if args.keys.size == 1 and args.values.size == 1\n\t data = args.keys.first\n\t output_path = args.values.first\n\t else\n\t raise \"dump_yaml() currently only accepts one {URL => location} pair\"\n\t end\n\t \n\t # \n\t # serialize the file\n\t # \n\t File.open(output_path, 'w') {|f| f.write data.to_yaml }\n\tend",
"def to_yaml\n require 'yaml'\n self.config.to_hash.to_yaml\n end",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def to_yaml\n @attributes.to_yaml\n end",
"def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end",
"def load_database_yaml; end",
"def load_database_yaml; end",
"def to_yaml\n\t\tYAML::dump self.to_hash\n\tend",
"def aorta( obj )\n tempfile = File.join('/tmp',\"yobj_#{ Time.now.to_i }\")\n File.open( tempfile, 'w' ) { |f| f << obj.to_yaml }\n system( \"#{ ENV['EDITOR'] || 'vi' } #{ tempfile }\" )\n return obj unless File.exists?( tempfile )\n content = YAML::load( File.open( tempfile ) )\n File.delete( tempfile )\n content\nend",
"def read_yaml(base, name, opts = T.unsafe(nil)); end",
"def serialize\n YAML::dump(self)\n end",
"def to_yaml_type \n YAML_TYPE\n end",
"def serialize\n margaret_file = File.open(\"messages.yaml\", \"a+\")\n margaret_file.puts YAML::dump(@string_margaret)\n end",
"def ouput_yaml\n array = Array.new(@size * @size, 0)\n File.open('test_yaml.out', 'w') { |file| file.puts YAML.dump(array) }\n end",
"def test_load_from_yaml\n loaded = Syck.load(<<-eoyml)\n--- !set\nfoo: bar\nbar: baz\n eoyml\n assert_equal(@set, loaded)\n end",
"def to_yaml\n YAML.dump(to_h)\n rescue => err\n raise ParseError.new(err), err\n end",
"def to_yaml\n dump(:x)\n end",
"def read_yaml(throw_missing: T.unsafe(nil), **kwd); end",
"def to_yaml(opts = {})\n definition.to_yaml(opts)\n end",
"def to_yaml\n @main.to_yaml\n end",
"def load yaml\n data = YAML::load yaml \n raise \"Cannot load YAML data\" unless data\n\n @raw = @data = @errors = @commands = nil\n @errors = data.delete('__ERRORS__')\n @commands = data.delete('__COMMANDS__')\n @raw = OpenStruct.new data\n @data = { }\n end",
"def ansible_setup_yaml(built_setup)\n YAML.dump(built_setup)\nend",
"def to_yaml\n self.original.to_yaml\n end",
"def format_as_yaml\n\t\tobjects = {}\n\t\tself.instance_variables.each do |k|\n\t\t\tobjects[k.to_s.gsub('@','')] = instance_eval(k.to_s)\n\t\tend\n\t\tobjects.delete(\"filename\")\n\t\tobjects.delete(\"previous_file\")\n\t\treturn objects\n\tend",
"def yaml\n @yaml ||= has_yaml? ? YAML.load(@content) : {}\n end",
"def to_yaml( opts = {} )\n YAML::quick_emit(self.object_id, opts) do |out|\n out.map(taguri) do |map|\n fields_to_serialize.each do |field|\n map.add(field, instance_variable_value(field))\n end\n end\n end\n end",
"def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"def load_library(path)\n # code goes here\n data = YAML.load_file(path)\n \n YAML.dump(\"foo\")\n { :a => 'b'}.to_yaml\n #data.map do |english, japanese|\n # binding.pry\n #end\n binding.pry\nend",
"def yaxml2yaml yaxml, options\r\n data = YAXML::yaxml2yaml(yaxml)\r\n\r\n if ENCODINGS.include?(options[:source_encoding])\r\n data = data.encode(options[:target_encoding], options[:source_encoding], :replace => '?')\r\n else\r\n data = data.encode(\"UTF-8\")\r\n end\r\n\r\n data\r\n end",
"def to_yaml( opts={} )\n\t\trequire 'yaml'\n\t\tYAML.quick_emit( self.object_id, opts ) {|out|\n\t\t\tout.seq( self.class.to_yaml_type ){|seq|\n\t\t\t\tseq.add( self.dirs )\n\t\t\t}\n\t\t}\n\tend",
"def to_yaml( opts = {} )\n YAML::quick_emit( self, opts ) do |out|\n out.map( taguri, to_yaml_style ) do |map|\n sort.each do |k, v| #<- Adding sort.\n map.add( k, v )\n end\n end\n end\n end",
"def as(format)\n @format = 'yaml'\n end",
"def to_s\n @content.to_yaml(:indentation => 4)\n end",
"def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end",
"def generate_save\n YAML.dump(self)\n end",
"def structure_dump() end",
"def to_yaml\n YAML::dump(self)\n end",
"def to_yaml\n YAML::dump(self)\n end",
"def to_yaml\n YAML::dump(self)\n end",
"def marshal_load(serialised); end",
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def yaml(filename)\n YAML.load(IO.read(filename).gsub(/---\\z/, ''))\nend",
"def gedcom_to_yaml(f)\n yaml = \"---\\n\"\n lines = f.lines\n line = lines.shift\n\n while line\n level, key, val = line.split(\" \", 3).map(&:strip)\n level = level.to_i\n\n yaml << \"#{' ' * level}#{key.inspect}: #{val.inspect if key == 'VALUE'}\\n\"\n\n if val.size.zero? || key == 'VALUE'\n line = lines.shift\n else\n line = \"#{level + 1} VALUE #{val}\"\n end\n end\n yaml\n end",
"def to_yaml_s\n fail '@key is empty' if \"#{@key}\".empty?\n\n x = \"=== #{@key} ===\\n\"\n x += \"#{(description || 'FIXME: NO DESCRIPTION GIVEN')}\\n\"\n\n # comment every line that describes the item:\n x = x.each_line.map{ |y| \"# #{y}\" }.join\n\n # add yaml (but stripped of frontmatter and first indent)\n # TODO: should we be using SafeYAML? http://danieltao.com/safe_yaml/\n x += { @key => @value }.to_yaml.gsub(/^---\\s*\\n/m, '').gsub(/^ /, '' )\n x += \"\\n\"\n\n if @skip_yaml\n x.gsub( /^/, '### ' )\n else\n x\n end\n end",
"def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end",
"def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end",
"def to_yaml\n self.to_h.deep_stringify_keys.compact.to_yaml\n end",
"def to_yaml(*args)\n YAML.dump(as_json(*args))\n end",
"def to_yaml\n\t\tYAML.dump self.export\n\tend",
"def to_yaml(indent_space_count = 0)\n yaml = \"\"\n longest_label_mapping_length =\n @label_mappings.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.to_s.length : max_length\n end\n\n if @label_mappings.length > 0\n yaml += \" \" * indent_space_count + \"Kit:\\n\"\n ljust_amount = longest_label_mapping_length + 1 # The +1 is for the trailing \":\"\n @label_mappings.sort.each do |label, path|\n yaml += \" \" * indent_space_count + \" - #{(label + \":\").ljust(ljust_amount)} #{path}\\n\"\n end\n end\n \n return yaml\n end",
"def to_yaml(opts = {})\n YAML::dump_stream({'logical' => logical}, {'physical' => physical})\n end",
"def format_local_yaml()\n prev = nil\n index_to_add = Array.new\n n = 0\n ifile = File.open( \"local.yaml\" )\n local_data = ifile.readlines\n ifile.close\n local_data.each_with_index { |line, index|\n if(index == 0)\n next\n end\n if(line =~ /^type:/)\n if not(prev =~ /---/)\n index_to_add.push(index+n)\n n=n+1\n end\n end\n prev = line\n }\n index_to_add.each { |i|\n local_data.insert(i, '---')\n }\n File.open(\"local.yaml\", \"w+\") do |f|\n f.puts(local_data)\n end\nend",
"def yaml2yaxml yaml, options\r\n if ENCODINGS.include? options[:source_encoding]\r\n yaml = yaml.encode(options[:target_encoding], options[:source_encoding], :replace => '?')\r\n else\r\n yaml = yaml.encode(\"UTF-8\")\r\n end\r\n\r\n hash = YAML::load(yaml)\r\n hash, target_language = set_target_language(hash, options[:target_language])\r\n YAXML::yaml2yaxml(hash.to_yaml, :root_name => target_language || root, :from_yaml=> true).to_s\r\n end"
] |
[
"0.77047825",
"0.7329348",
"0.7329348",
"0.7229099",
"0.71335256",
"0.7013666",
"0.6907123",
"0.67749083",
"0.6761539",
"0.6701907",
"0.668908",
"0.6663233",
"0.6635896",
"0.66057444",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6560579",
"0.6550302",
"0.6546937",
"0.6544867",
"0.6539069",
"0.65287405",
"0.6526184",
"0.64970255",
"0.64319366",
"0.642907",
"0.6415979",
"0.6413354",
"0.6387252",
"0.6380951",
"0.6366773",
"0.6366773",
"0.6287302",
"0.62865996",
"0.6286229",
"0.6286229",
"0.6263504",
"0.62625587",
"0.62555945",
"0.6254326",
"0.6254326",
"0.6249722",
"0.6228698",
"0.62001425",
"0.62001425",
"0.61983687",
"0.61806417",
"0.61716807",
"0.61716807",
"0.6168357",
"0.61547804",
"0.6149027",
"0.6140599",
"0.6132074",
"0.61319107",
"0.613096",
"0.61298645",
"0.61281085",
"0.61222965",
"0.6116574",
"0.6114451",
"0.6113663",
"0.6101782",
"0.61014885",
"0.60948855",
"0.60804486",
"0.6071764",
"0.606426",
"0.60548514",
"0.60548514",
"0.60303247",
"0.6026516",
"0.6020543",
"0.59943",
"0.5991645",
"0.598098",
"0.59696275",
"0.59676445",
"0.59567714",
"0.594568",
"0.594568",
"0.594568",
"0.59389067",
"0.5938335",
"0.5938011",
"0.5938006",
"0.5936692",
"0.59320194",
"0.59320194",
"0.5928231",
"0.59190065",
"0.59108555",
"0.591061",
"0.5892852",
"0.5891214",
"0.58909124"
] |
0.0
|
-1
|
Why's aorta method to edit an object in YAML, awesome! Source:
|
def aorta( obj )
tempfile = File.join('/tmp',"yobj_#{ Time.now.to_i }")
File.open( tempfile, 'w' ) { |f| f << obj.to_yaml }
system( "#{ ENV['EDITOR'] || 'vi' } #{ tempfile }" )
return obj unless File.exists?( tempfile )
content = YAML::load( File.open( tempfile ) )
File.delete( tempfile )
content
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def y(obj)\n puts obj.to_yaml\nend",
"def y(obj)\n puts obj.to_yaml\nend",
"def edit_yaml(yaml_location, &block)\n d = YAML.load_file(yaml_location)\n block.call(d)\n File.open(yaml_location, 'w') {|f| f.write d.to_yaml }\n end",
"def yaml(object) \n title = split(object)\n category = split(object, 1)\n ret = ''\n \n ret += '---' + \"\\n\"\n ret += \"layout: styleguide\" + \"\\n\"\n ret += \"title: #{title.capitalize}\" + \"\\n\"\n ret += \"category: #{category}\" + \"\\n\"\n ret += \"scss: _#{title}.scss\" + \"\\n\"\n ret += '---' + \"\\n\"\n \n ret\n end",
"def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end",
"def yaml_save(object, filename)\n File.open (filename), \"w\" do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def paml(x)\n\n puts(YAML.dump(x))\nend",
"def yaml_file?; end",
"def pets\n load_yaml('personaje/pets')\nend",
"def yaml_dump(file, obj)\n\t\tFile.open(file.to_s, 'w+') {|f| f.write obj.to_yaml}\n\tend",
"def to_yaml(arg = {})\n \"subfield: #{name} #{object_id}\".to_yaml(arg)\n end",
"def yaml_content() = JSON.parse(content.to_json).to_yaml",
"def to_yaml() end",
"def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend",
"def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend",
"def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend",
"def deprecated_yaml_erb_backend=(_arg0); end",
"def deprecated_yaml_erb_backend=(_arg0); end",
"def parse_yaml(readable_obj)\n ::YAML.load(readable_obj)\n end",
"def test_load_from_yaml\n loaded = Syck.load(<<-eoyml)\n--- !set\nfoo: bar\nbar: baz\n eoyml\n assert_equal(@set, loaded)\n end",
"def as(format)\n @format = 'yaml'\n end",
"def from_yaml\n\t\tdata = YAML.load File.read(\"save.yaml\")\n\t\t@board = Board.new(data[:board], data[:positions])\n\t\t@current_turn = data[:current_turn]\n\t\t@ai_on = data[:ai_on]\t\t\n\tend",
"def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"def yaml(hash)\n method = hash.respond_to?(:ya2yaml) ? :ya2yaml : :to_yaml\n string = hash.deep_stringify_keys.send(method)\n# string.gsub(\"!ruby/symbol \", \":\").sub(\"---\",\"\").split(\"\\n\").map(&:rstrip).join(\"\\n\").strip\nend",
"def load_yaml(data, safe: T.unsafe(nil), whitelist_classes: T.unsafe(nil), whitelist_symbols: T.unsafe(nil), aliases: T.unsafe(nil)); end",
"def test_new\n assert_equal({\n \"drylands\"=>\"Drylands\",\n \"savannah\"=>\"Savanna\",\n }, FakeYaml.load(sample(\"terrain_stuff_l_english\")))\n end",
"def attributes_editor(yaml_input)\n dtk_folder = OsUtil.dtk_local_folder\n file_path = \"#{dtk_folder}/temp_attrs.yaml\"\n File.open(file_path, 'w'){|f| f << yaml_input}\n OsUtil.edit(file_path)\n OsUtil.print(\"If you want to use different editor please set environment variable EDITOR and log back into dtk-shell!\", :yellow) unless ENV['EDITOR']\n edited_yaml = File.open(file_path,'r'){|f|f.read}\n File.unlink(file_path)\n edited_yaml\n end",
"def write_yml(filename,object)\n File.open(filename,'w') do |f|\n f.write(YAML.dump(object))\n end\n end",
"def load_yaml(filename); end",
"def write_to_yaml(data,yaml_file) \n File.open(yaml_file,'w') { |yf| YAML.dump(data,yf) }\nend",
"def read_yaml(base, name, opts = T.unsafe(nil)); end",
"def nice_yaml(string)\n YAML.dump(string).gsub(/\\A---\\n/, '')\n end",
"def []= (fei, object)\n\n #linfo { \"[]= #{fei}\" }\n\n fei_path = compute_file_path(fei)\n\n fei_parent_path = File.dirname(fei_path)\n\n FileUtils.makedirs(fei_parent_path) \\\n unless File.exist?(fei_parent_path)\n\n File.open(fei_path, 'w') { |file| YAML.dump(object, file) }\n end",
"def load_yaml(args = {})\n file = File.read(args[:file] || CMUX_YAML)\n yaml = YAML.load(file)\n args[:key] ? yaml[args[:key]] : yaml\n rescue Psych::SyntaxError\n message = \"Make sure you've written #{file} in YAML Simple Mapping.\" \\\n ' Please check README.'\n raise message.red\n end",
"def update_yaml_setting(yaml, key, setting, default)\n unless yaml[key][setting]\n yaml[key][setting] = default\n File.open(yaml_path, 'w') {|f|\n f.write(yaml.to_yaml)\n }\n @formatter.config_updated(yaml_path)\n end\n end",
"def to_yaml\n # write yaml\n end",
"def yaml_object_type\n nil\n end",
"def format_local_yaml()\n prev = nil\n index_to_add = Array.new\n n = 0\n ifile = File.open( \"local.yaml\" )\n local_data = ifile.readlines\n ifile.close\n local_data.each_with_index { |line, index|\n if(index == 0)\n next\n end\n if(line =~ /^type:/)\n if not(prev =~ /---/)\n index_to_add.push(index+n)\n n=n+1\n end\n end\n prev = line\n }\n index_to_add.each { |i|\n local_data.insert(i, '---')\n }\n File.open(\"local.yaml\", \"w+\") do |f|\n f.puts(local_data)\n end\nend",
"def save_yaml(yaml)\n yaml_file = File.join(thor_root, \"thor.yml\")\n\n unless File.exist?(yaml_file)\n FileUtils.mkdir_p(thor_root)\n yaml_file = File.join(thor_root, \"thor.yml\")\n FileUtils.touch(yaml_file)\n end\n\n File.open(yaml_file, \"w\") { |f| f.puts yaml.to_yaml }\n end",
"def modify_yaml_for_testing(yaml_path)\n puts \"Modifying yaml for testing\"\n yaml_file = yaml_path + \"/bf.config.yaml\"\n c_path = Dir.pwd\n c_path.slice!(/\\/test$/)\n\n bf_config = File.open(yaml_file).read\n bf_config.gsub!(/\\/h\\/hsap.36.1.hg18\\/hsap_36.1_hg18.fa/, \"/t/test/test.fa\")\n bf_config.gsub!(%r{h/hsap.36.1.hg18/bwaaln/hsap_36.1_hg18.fa}, \n \"/t/test/bwaaln/test.fa\")\n %w{28000 8000 4000}.each {|n| bf_config.gsub!(/#{n}/, \"400\") }\n %w{8g 4g}.each {|n| bf_config.gsub!(/#{n}/, \"1g\") }\n \n bf_config.gsub!(/dist_dir:.+$/, \"dist_dir: #{c_path}\")\n bf_config.gsub!(/reads_per_file:.+$/, \"reads_per_file: 480\")\n\n # Send email only to the user that is testing this\n user=`id -u -n`.chomp\n bf_config.gsub!(/email_to:.+$/, \"email_to: #{user}@bcm.edu\")\n\n File.open(yaml_file, \"w\") {|f| f.write(bf_config)}\nend",
"def load_from_yaml(file)\n document_lines = File.readlines(file)\n\n headers = document_lines.enum_for(:each_with_index).\n find_all { |line, _| line =~ /^---/ }\n if headers.empty? || headers.first[1] != 0\n headers.unshift [\"--- name:default\", -1]\n end\n\n options = headers.map do |line, line_number|\n line_options = Hash.new\n line = line.chomp\n line.split(/\\s+/)[1..-1].each do |opt|\n if opt =~ /^(\\w+):(.*)$/\n line_options[$1] = $2\n else\n raise ArgumentError, \"#{file}:#{line_number}: wrong format #{opt}, expected option_name:value, where 'value' has no spaces\"\n end\n end\n line_options['merge'] = (line_options['merge'] == 'true')\n line_options['chain'] = (line_options['chain'] || '').split(',')\n [line_options, line_number]\n end\n options[0][0]['name'] ||= 'default'\n\n options.each do |line_options, line_number|\n if !line_options['name']\n raise ArgumentError, \"#{file}:#{line_number}: missing a 'name' option\"\n end\n end\n\n sections = []\n options.each_cons(2) do |(_, line0), (_, line1)|\n sections << document_lines[line0 + 1, line1 - line0 - 1]\n end\n sections << document_lines[options[-1][1] + 1, document_lines.size - options[-1][1] - 1]\n\n changed_sections = []\n @conf_options = options\n\n sections.each_with_index do |doc, idx|\n doc = doc.join(\"\")\n doc = evaluate_dynamic_content(file, doc)\n\n result = YAML.load(StringIO.new(doc))\n\n conf_options = options[idx].first\n name = conf_options.delete('name')\n changed = in_context(\"while loading section #{name} of #{file}\") do\n add(name, result || Hash.new, conf_options)\n end\n\n if changed\n changed_sections << name\n end\n end\n\t if !changed_sections.empty?\n\t \t@merged_conf.clear\n\t end\n changed_sections\n rescue Exception => e\n raise e, \"error loading #{file}: #{e.message}\", e.backtrace\n end",
"def yml_file_to_object(options={})\n content = read_file_content(options)\n YAML.load(content)\nend",
"def load_yaml(yaml_path, variables = nil)\n #puts \"load_yaml #{yaml_path}\"\n if variables\n YAML.load(ERB.new(File.read(yaml_path)).result(OpenStruct.new(variables).instance_eval { binding })) \n else\n YAML.load(ERB.new(File.read(yaml_path)).result)\n end\nend",
"def yaml(filename)\n YAML.load(IO.read(filename).gsub(/---\\z/, ''))\nend",
"def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end",
"def from_yaml\n YAML.load(self)\n end",
"def load_object (path)\n\n o = YAML.load_file(path)\n File.delete(path)\n o\n end",
"def yaml( *args )\n ::Logging::Layouts::Parseable.yaml(*args)\n end",
"def load_file(file)\n buf = File.read(file)\n\n # parse the document into a Psych tree; we don't load here because we want\n # the file/line info while creating our entities.\n doc = YAML.parse(buf, filename: file)\n\n # Document should be an Array of Hashes\n seq = doc.children.first or return # ignore empty documents\n load_error!('not a yaml sequence (Array)', file, seq) unless seq.sequence?\n\n # Loop through each Hash\n seq.children.each do |map|\n\n # Make sure it's a mapping before we convert it to a ruby Hash\n load_error!('not a yaml mapping (Hash)', file, map) unless map.mapping?\n entity = YAML.send(:symbolize_names!, map.to_ruby)\n\n # Ensure they're not using some unknown keys\n unknown_keys = entity.keys - SUPPORTED_KEYS\n load_error!(\"unknown keys: #{unknown_keys}\", file, map) unless\n unknown_keys.empty?\n\n load_error!(\"id and update are mutually exclusive\", file, map) if\n entity[:id] and entity[:update]\n\n source = \"#{file}:#{map.start_line + 1}\"\n\n create = {}\n create[:id] = entity[:id] if entity.has_key?(:id)\n create[:update] = entity[:update] if entity.has_key?(:update)\n\n # Create an Array of the various base Entities that will be layered into\n # this Entity\n create[:base] = [entity[:base]].flatten.compact\n\n # Construct an Array of component arguments that will be sent to\n # Morrow::EntityManager#create_entity\n entity[:components] ||= []\n load_error!('The `components` field must be an Array; %s' %\n [ entity[:components].inspect ], file, map) unless\n entity[:components].is_a?(Array)\n\n create[:components] = entity[:components].map do |conf|\n case conf\n when Symbol\n conf\n when String\n conf.to_sym\n when Hash\n load_error!(<<~ERROR, file, map) unless conf.size == 1\n Multiple keys found in single component configuration. Note that\n the `components` field is an Array. Perhaps you missed a '-'\n before the next component after this one.\n ERROR\n\n # A Hash is a component with non-default values. The values may be\n # provided as a Hash, an Array (must have all elements), or a scalar\n # (for single field Components)\n comp, config = conf.first\n case config\n when Hash\n config.rekey! { |k| k.to_sym }\n when Array\n # don't make any changes\n else\n # turn this non-array value into an array of a single element\n config = [ config ]\n end\n { comp.to_sym => config }\n else\n load_error!('Unsupported component configuration type: %s' %\n [ conf.inspect ], file, map)\n end\n end\n\n create[:remove] = entity[:remove] || []\n\n # defer the action if we're not able to do it at the moment\n begin\n create_or_update(**create)\n rescue Morrow::UnknownEntity\n defer(source: source, entity: create)\n rescue Exception => ex\n raise Morrow::Error, <<~ERROR.chomp\n error in entity file: #{source}: #{entity.pretty_inspect\n .chomp.gsub(/\\n/, \"\\n\" + ' ' * 16)}\n ERROR\n end\n end\n\n # Attempt to flush any deferred actions now that we've loaded everything in\n # the file.\n flush\n end",
"def yaml\n config = fetch(@variable, {})\n stringified = if config.respond_to?(:deep_stringify_keys)\n config.deep_stringify_keys\n else\n # TODO: remove when dropping rails 3 support\n # two level stringify for rails 3 compatibility\n config.stringify_keys.each_value(&:stringify_keys!)\n end\n stringified.to_yaml\n end",
"def editObject _obj, _args\n \"_obj editObject _args;\" \n end",
"def set_yaml_repr(dat)\n @data = dat unless dat.nil?\n end",
"def fill_from_yaml(yaml)\n fill_from_hash(Psych.load(yaml))\n end",
"def serialize(object)\n YAML.dump(object)\n end",
"def save\n # Build a String of SQL, that will insert all the attributes into the persons table\n\n<<<<<<< HEAD\n someone = Person.create_person(input)\n\n # Append this to yaml file\n # @directory << someone.to_yaml\n # puts @directory\n\n @directory << someone\n \n\n\n case input\n\n when 'l'\n #pull in existing people from the YAML file\n @directory += YAML.load_documents(File.open('student_directory.yml'))\n end\n print \"Enter Student or Instructor, q to save and quit: \"\n\n # Open a student_directory.yml YAML file and write it out on one line a appends vs overwrites\n File.open('student_directory.yml', 'a') do |f| \n @directory.compact.each do |person|\n f.write(person.to_yaml)\n end\n end\nend",
"def yaml_api\n \"github.com/api/v2/yaml\"\nend",
"def edit\n Log.add_info(request, params.inspect)\n\n @yaml = ApplicationHelper.get_config_yaml\n end",
"def to_yaml\n self.original.to_yaml\n end",
"def read_yaml(throw_missing: T.unsafe(nil), **kwd); end",
"def yaml_file_workaround(current_contents, delete_quotes)\n nested_map = current_contents[/^\\-\\s\\w+:/] ? true : false\n regex = nested_map ? /^(\\-?\\s+)/ : /^(\\s+\\-\\s)/\n if delete_quotes\n current_contents.delete!('\"')\n end\n current_contents.gsub!(regex, ' \\\\1')\n current_contents\n end",
"def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end",
"def origin=(object)\n self.hokusai_class = object.class.to_s\n self.hokusai_template = YAML.dump(object.as_template)\n end",
"def to_yaml_s\n fail '@key is empty' if \"#{@key}\".empty?\n\n x = \"=== #{@key} ===\\n\"\n x += \"#{(description || 'FIXME: NO DESCRIPTION GIVEN')}\\n\"\n\n # comment every line that describes the item:\n x = x.each_line.map{ |y| \"# #{y}\" }.join\n\n # add yaml (but stripped of frontmatter and first indent)\n # TODO: should we be using SafeYAML? http://danieltao.com/safe_yaml/\n x += { @key => @value }.to_yaml.gsub(/^---\\s*\\n/m, '').gsub(/^ /, '' )\n x += \"\\n\"\n\n if @skip_yaml\n x.gsub( /^/, '### ' )\n else\n x\n end\n end",
"def read_yaml(base, name)\n path = File.join(base, name)\n self.content = File.read(path)\n relative_base = base.gsub(Dir.pwd, \"\")\n if relative_base.start_with?(\"/#{JDoc::DocumentationFile.documentation_directory}\")\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n self.data[\"layout\"] = \"documentation\" if self.data[\"layout\"].nil?\n self.data[\"title\"] = JDoc::DocumentationFile.file_title(path) if self.data[\"title\"].nil?\n return\n elsif self.content =~ /^(---\\s*\\n.*?\\n?)/m\n self.content = $POSTMATCH\n self.data = {\n \"layout\" => \"documentation\",\n \"title\" => JDoc::DocumentationFile.file_title(path)\n }\n return\n end\n end\n\n read_yaml_original(base, name)\n end",
"def read_yaml(path)\n data = File.read path\n\n # Necessary to be backward-compatible with documentation generated\n # by earliar RDoc versions.\n data = data.gsub(/ \\!ruby\\/(object|struct):(RDoc::RI|RI).*/, '')\n data = data.gsub(/ \\!ruby\\/(object|struct):SM::(\\S+)/,\n ' !ruby/\\1:RDoc::Markup::\\2')\n\n OpenStructHash.convert YAML.load(data)\n end",
"def load_database_yaml; end",
"def load_database_yaml; end",
"def load yaml\n data = YAML::load yaml \n raise \"Cannot load YAML data\" unless data\n\n @raw = @data = @errors = @commands = nil\n @errors = data.delete('__ERRORS__')\n @commands = data.delete('__COMMANDS__')\n @raw = OpenStruct.new data\n @data = { }\n end",
"def editStage(nostage, name, desc)\n find(:xpath, \"//*[@id='config-array-#{nostage.to_i-1}-com.spigit.idea.IdeaConfig.lifecycleStages']\").set name\n find(:xpath, \"//*[@id='config-array-#{nostage.to_i-1}-com.spigit.idea.IdeaConfig.lifecycleStageDescriptions']\").set desc\n sleep 3\n end",
"def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end",
"def to_yaml(opts = {})\n return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end",
"def generate_save\n YAML.dump(self)\n end",
"def update!(**args)\n @deleted = args[:deleted] if args.key?(:deleted)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @included_permissions = args[:included_permissions] if args.key?(:included_permissions)\n @name = args[:name] if args.key?(:name)\n @stage = args[:stage] if args.key?(:stage)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @image_node = args[:image_node] if args.key?(:image_node)\n @meta_no_preview = args[:meta_no_preview] if args.key?(:meta_no_preview)\n @meta_no_snippet = args[:meta_no_snippet] if args.key?(:meta_no_snippet)\n @teradoc = args[:teradoc] if args.key?(:teradoc)\n @text_node = args[:text_node] if args.key?(:text_node)\n @title = args[:title] if args.key?(:title)\n end",
"def convert_spec(yaml_spec)\n YAML.load(reduce_spec(yaml_spec)) or\n\traise \"Didn't get a valid YAML document\"\n end",
"def load_yml(filename); end",
"def set_yaml_stream(format,yaml_stream)\n\n m = yaml_stream.match /^(---.+?---\\n)(.*)$/m\n raise \"failed to parse yaml stream\\n#{yaml_stream}\" unless m\n\n attributes_yaml = m[1]\n txt = m[2]\n\n enml = self.class.format_to_enml(format,txt)\n attributes_hash = YAML.load(attributes_yaml)\n \n # process tag names\n # allow for comma separated tag list\n tag_names = attributes_hash['tagNames']\n tag_names = tag_names.split(/\\s*,\\s*/) if tag_names.instance_of?(String)\n\n self.title = attributes_hash['title']\n self.tagNames = attributes_hash['tagNames']\n self.content = enml\n end",
"def yaml_dump(val)\n yml = \"\\n\" + YAML.dump(val)\n yml.gsub(/ +\\n/, \"\\n\")\n end",
"def from_yaml\n results = YAML.load(self)\n \n # Replace bad values\n if results == false or results == nil\n \"\"\n else\n results\n end\n end",
"def to_yaml\n as_yaml.to_yaml\n end",
"def test_old\n assert_equal({\n \"shiva\"=>\"Shiva\",\n \"ganesha\"=>\"Ganesha\",\n \"surya\"=>\"Surya\",\n \"ganga\"=>\"Ganga\",\n \"shakti\"=>\"Shakti\",\n \"vishnu\"=>\"Vishnu\",\n \"shiva_desc\"=>\"Shiva is the god of transformation through destruction and the Lord of Dance.\",\n \"ganesha_desc\"=>\"Ganesha is the god of knowledge and beginnings, the Lord of Obstacles.\",\n \"surya_desc\"=>\"Surya is the god of the sun, courage and will.\",\n \"ganga_desc\"=>\"Ganga is the goddess of the sacred river, Ganges, who purifies and redeems.\",\n \"shakti_desc\"=>\"Shakti is the goddess of power and dynamic energy.\",\n \"vishnu_desc\"=>\"Vishnu is the all-pervading god who sustains the world.\",\n \"RV_NO_DEITY_TITLE\"=>\"No Current Deity.\",\n \"RV_NO_DEITY_DESC\"=>\"Hinduism allows you to select which god to follow as your main deity. Each deity will come with its own effects and last until your monarch changes.\",\n \"RV_PICK_DEITY_THIS\"=>\"Follow $NAME|Y$\",\n \"RV_PICK_DEITY\"=>\"Select Deity\",\n }, FakeYaml.load(sample(\"religion_l_english\")))\n end",
"def to_yaml(opts = {})\n return super unless defined?(YAML::ENGINE) && YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end",
"def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end",
"def load(filename)\n update! YAML.load_file(filename)\n end",
"def to_yaml_type \n YAML_TYPE\n end",
"def set_default_value(opt1, opt2)\n return if @yaml[opt1][opt2].present?\n return if @record && @record[@yaml['name']].present?\n\n @yaml[opt1][opt2] = if @yaml['default'].class == Hash\n evaluate = @yaml['default']['eval']\n return if evaluate.blank?\n # add @parent if it's a method call and @parent is not present\n if evaluate[0] != evaluate[0].upcase && !evaluate.match('@parent')\n evaluate.prepend('@parent.')\n end\n eval(evaluate)\n else\n @yaml['default']\n end\nend",
"def parse_yaml(path)\n require 'yaml'\n\n str = Nitro::Template.new.render(File.read(path))\n\n if yaml = YAML::load(str)\n for name, data in yaml\n self[name] = instantiate(data)\n end\n end\n\n # sort the objects.\n\n str.scan(/^(\\w*?):$/).each do |key|\n @objects << self[key.to_s]\n end\n end",
"def update!(**args)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @self_link = args[:self_link] if args.key?(:self_link)\n @status = args[:status] if args.key?(:status)\n @template_contents = args[:template_contents] if args.key?(:template_contents)\n end",
"def to_yaml_git(opts = {})\n YAML::quick_emit(self, opts) do |out|\n out.map(taguri, to_yaml_style) do |map|\n map.add(\"attributes\", @attributes)\n end\n end\n end"
] |
[
"0.65748596",
"0.65748596",
"0.64384025",
"0.64170545",
"0.63207906",
"0.6252102",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6228083",
"0.60380065",
"0.60380065",
"0.5968703",
"0.5968123",
"0.5836689",
"0.5795446",
"0.579061",
"0.5773924",
"0.5749024",
"0.5727315",
"0.5727315",
"0.5727315",
"0.56846505",
"0.56846505",
"0.5676313",
"0.56391525",
"0.56287825",
"0.5624622",
"0.5591879",
"0.5591879",
"0.5579511",
"0.55727",
"0.5533903",
"0.55216384",
"0.5509639",
"0.55084497",
"0.55051017",
"0.5480262",
"0.5477863",
"0.54679555",
"0.5450198",
"0.5444606",
"0.5427969",
"0.5426905",
"0.54207504",
"0.54083467",
"0.54031587",
"0.5396188",
"0.53903466",
"0.53739387",
"0.53640527",
"0.5348158",
"0.53442246",
"0.53336054",
"0.53211987",
"0.53148097",
"0.5306261",
"0.53015864",
"0.5300908",
"0.5286178",
"0.5282548",
"0.5274505",
"0.5266178",
"0.5257372",
"0.52546334",
"0.5254142",
"0.52481234",
"0.5230729",
"0.5226416",
"0.52219796",
"0.52197224",
"0.52152485",
"0.5213619",
"0.5213619",
"0.52061146",
"0.5185721",
"0.518365",
"0.5176213",
"0.51747334",
"0.51727307",
"0.51684535",
"0.51660275",
"0.5161412",
"0.51527876",
"0.51484734",
"0.5144574",
"0.5143262",
"0.5139173",
"0.51212156",
"0.51147157",
"0.51118946",
"0.5096219",
"0.5072969",
"0.507234",
"0.50621873",
"0.5053813"
] |
0.7580655
|
0
|
GET /definitions GET /definitions.json
|
def index
@definitions = Definition.order('created_at desc')
respond_to do |format|
format.html # index.html.erb
format.json { render json: @definitions }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def definitions\n @definitions ||= { responses: {} }\n end",
"def definitions() return @definitions end",
"def index\n @definitions = Definition.all\n end",
"def definitions\n # Some httparty work to fetch definitions from Websters\n end",
"def definitions\n definitions_repository.all\n end",
"def definitions\n @definitions ||= g_definitions\n end",
"def index\n\n @definitions = Definition.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @definitions.to_xml(:request => request) }\n format.json { render :json => @definitions.to_json(:request => request) }\n end\n end",
"def definitions\n return @definitions\n end",
"def get_definitions\n Dictionary.find_by_word(word_id)\n end",
"def generate_definitions_list\n definitions = YARD::Registry.all(:definition).uniq.sort_by{|define| define.name.to_s}\n generate_full_list(definitions, 'Definition', 'definitions')\nend",
"def get_definitions(word, *args)\n http_method = :get\n path = '/word/{word}/definitions'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n @custom_definitions = CustomDefinition.all\n end",
"def definitions=(value)\n @definitions = value\n end",
"def index\n\n if params[:tag]\n @definitions.tagged_with(params[:tag])\n elsif params[:letter]\n @definitions = Definition.starts_with(params[:letter])\n else\n @definitions = Definition.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def show\n @definitions = @word.definitions.order(cached_votes_up: :desc, created_at: :desc)\n end",
"def all\n @definitions ||= []\n end",
"def definitions; end",
"def definitions; end",
"def print_definition()\n puts \"Definition\"\n puts \"----------------------------------------\"\n puts @word_info[:title], \" \"\n @word_info[:types_definitions].each do |type|\n puts \"\\t\" + type[:type]\n type[:definitions].each_with_index do |defintion, i|\n puts \"\\t #{i+1}. #{defintion}\"\n end\n print \"\\n\"\n end\n end",
"def definitions\n run_context.definitions\n end",
"def list_service_definitions_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.list_service_definitions ...'\n end\n allowable_values = ['v1', 'v2', 'v2.1']\n if @api_client.config.client_side_validation && opts[:'schema_version'] && !allowable_values.include?(opts[:'schema_version'])\n fail ArgumentError, \"invalid value for \\\"schema_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'schema_version'] = opts[:'schema_version'] if !opts[:'schema_version'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceDefinitionsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_service_definitions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#list_service_definitions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def definitions\n definitions = []\n while (code, parameters = response) and code != 250\n definitions << Definition.new(split(parameters), lines(false).join(\"\\n\"))\n end\n definitions\n end",
"def show\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @definition }\n end\n end",
"def show\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @definition }\n end\n end",
"def definitions(word)\n MinWords::DB[:defines].where(word_id: word[:id]).all\n end",
"def definition_by_name(name)\n definitions_repository.get(name)\n end",
"def definitions(options = {})\n SpanDictionary.new(options).definitions\n end",
"def definitions(options = {})\n SpanDictionary.new(options).definitions\n end",
"def load_definitions\n clear_definitions\n Dir[File.expand_path('../../data/*.json', __dir__)].each { |f| load_json(f) }\n end",
"def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @definitions = Definition.where(word_id: word_id.ids)\n render json:{\n id: @definitions\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end",
"def factory_definitions\n @factory_definitions ||= {}\n end",
"def index\n @pluto_process_definitions = collection.all\n\n respond_to do |format|\n format.json { render json: @pluto_process_definitions }\n end\n end",
"def initialize\n @definitions = {}\n end",
"def get_config_var_definitions(variable_id)\n path = \"/d2l/api/lp/#{$lp_ver}/configVariables/(#{variable_id}/definition\"\n _get(path)\n # returns Definition JSON data block\nend",
"def get_definition\n\n end",
"def definition\n @definition ||= []\n end",
"def definition_list(options = {}, &block)\n definition_list_for(resource, options, &block)\n end",
"def definitions\n # try looking for the definition list\n defn = @body.at_css('#definitions')\n return defn.parent if defn\n\n # try looking for the heading\n defn = @body.at_xpath('.//a:section/a:heading[text() = \"Definitions\"]', a: NS)\n return defn.parent if defn\n\n nil\n end",
"def get_all_config_var_definitions(search = '', bookmark = '')\n path = \"/d2l/api/lp/#{$lp_ver}/configVariables/definitions/\"\n path += \"?search=#{search}\" if search != ''\n path += \"?bookmark=#{bookmark}\" if bookmark != ''\n _get(path)\n # returns paged result set of Definition JSON data blocks\nend",
"def pending\n @definitions = Definition.all.pending\n render json: @definitions, status: :accepted\n end",
"def property_definitions\n set_attributes_for(PropertyDefinition)\n PropertyDefinition.find(:all)\n end",
"def size\n @definitions.size\n end",
"def list_definitions(resource, filter = nil)\n resource_id = resource.respond_to?(:id) ? resource.id : resource\n version = configuration.provider_default_api_version(provider, 'metricDefinitions')\n\n url = File.join(\n configuration.environment.resource_url,\n resource_id,\n 'providers/microsoft.insights/metricdefinitions'\n )\n\n url << \"?api-version=#{version}\"\n url << \"&$filter=#{filter}\" if filter\n\n response = rest_get(url)\n\n Azure::Armrest::ArmrestCollection.create_from_response(\n response,\n Azure::Armrest::Insights::MetricDefinition\n )\n end",
"def new\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @definition }\n end\n end",
"def new\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @definition }\n end\n end",
"def app_definitions\n return @app_definitions\n end",
"def get_document_schema\n filePath = Rails.root.join(\"lib\", \"base_truevault_doc.json\")\n file = File.read(filePath)\n schema = JSON.parse(file).with_indifferent_access\n end",
"def lb_definitions\n des=[]\n def_paths=lb_paths(Xbrlware::LBConstants::DEFINITION)\n def_paths.each do |path|\n _deflb = deflb(path)\n des += _deflb.definition unless _deflb.nil?\n end\n des\n end",
"def definitions(input)\n list = 1\n input.body.each do |definition|\n current_definition = definition['text']\n puts \"#{list}. #{current_definition}\"\n list += 1\n end\n end",
"def get_definition()\n html_def = @noko.css(\"li.g:first-of-type\")\n local_word_info = Hash.new\n local_word_info[:title] = html_def.css(\"h3 span\")[0].text\n\n if local_word_info[:title].ascii_only?\n local_word_info[:title] = local_word_info[:title].upcase\n else\n local_word_info[:title] = make_readable(local_word_info[:title]).upcase\n end\n\n local_word_info[:types_definitions] = []\n html_def.css(\"tr\").each do |e|\n # puts e\n if e.to_s =~ /<div/\n definitions = Hash.new\n definitions[:type] = e.css(\"div\")[0].text.upcase\n definitions[:definitions] = []\n e.css(\"li\").each do |li|\n definitions[:definitions] << li.text\n end\n local_word_info[:types_definitions] << definitions\n end\n end\n\n return local_word_info\n end",
"def definitions\n load_currencies if @iso_definitions.nil?\n\n @iso_definitions.merge(\n @unofficial_definitions.merge(@historical_definitions)\n )\n end",
"def definitions(*directories)\n directories.empty? ? @definitions : @definitions = directories\n end",
"def definitions(key, field=nil)\n begin\n defs = self.definition_schema[key]\n if field.present?\n defs[field]\n else\n defs\n end\n rescue NoMethodError => e\n field_key = field.present? ? \"#{key}/#{field}\" : key\n ErrorTracker.report_exception(e, self.study.user, { missing_key: field_key, analysis_metadatum: self.attributes.to_h})\n Rails.logger.error \"Error accessing remote HCA Analysis metadata field definitions for #{field_key}: #{e.message}\"\n nil\n end\n end",
"def read_definitions\n definitions = []\n definitions_file = ARGV[0]\n $logger.info \"Reading user definitions from \\\"#{definitions_file}\\\"\"\n options = {:col_sep => DELIM, :headers => :first_row, :return_headers => false}\n CSV.foreach(definitions_file, options) do |row|\n next if row.empty?\n id = row[0].strip\n first_name = row[1].strip\n last_name = row[2].strip\n workspace = row[3].strip\n definitions << {id: id, first_name: first_name, last_name: last_name, workspace: workspace}\n end\n definitions\nend",
"def get_definition(cls, bld, fun)\r\n bld.add(\"///\")\r\n bld.add(\"/// Web API get single \" + cls.getUName())\r\n bld.add(\"///\")\r\n\r\n get_body(cls, bld, fun)\r\n\r\n bld.endFunction\r\n end",
"def index\n if params[:step_definition_id] \n step_definition = StepDefinition.find(params[:step_definition_id])\n if step_definition != nil\n @field_definitions = step_definition.field_definitions\n else\n @field_definitions = []\n end\n else \n @field_definitions = FieldDefinition.all\n end\n end",
"def app_definitions=(value)\n @app_definitions = value\n end",
"def read_definitions_file\n if File.exist?(definitions_file_path)\n YAML.safe_load(\n ERB.new(File.read(definitions_file_path)).result,\n permitted_classes: YAML_PERMITTED_CLASSES,\n aliases: true\n ) || []\n else\n raise LoadError,\n \"Could not find elements.yml file! Please run `rails generate alchemy:install`\"\n end\n end",
"def definition_schema\n begin\n # check for local copy first\n if File.exist?(self.definition_filepath)\n existing_schema = File.read(self.definition_filepath)\n JSON.parse(existing_schema)\n else\n Rails.logger.info \"#{Time.zone.now}: saving new local copy of #{self.definition_filepath}\"\n metadata_schema = RestClient.get self.definition_url\n # write a local copy\n unless Dir.exist?(self.definition_root)\n FileUtils.mkdir_p(self.definition_root)\n end\n new_schema = File.new(self.definition_filepath, 'w+')\n new_schema.write metadata_schema.body\n new_schema.close\n JSON.parse(metadata_schema.body)\n end\n rescue RestClient::ExceptionWithResponse => e\n ErrorTracker.report_exception(e, self.study.user, { request_url: self.definition_url, request_response: e.http_body})\n Rails.logger.error \"Error retrieving remote HCA Analysis metadata schema: #{e.message}\"\n {error: \"Error retrieving definition schema: #{e.message}\"}\n rescue JSON::ParserError => e\n ErrorTracker.report_exception(e, self.study.user, { metadata_body: metadata_schema.body})\n Rails.logger.error \"Error parsing HCA Analysis metadata schema: #{e.message}\"\n {error: \"Error parsing definition schema: #{e.message}\"}\n end\n end",
"def list_service_definitions(opts = {})\n data, _status_code, _headers = list_service_definitions_with_http_info(opts)\n data\n end",
"def definitions\n definitions = Element.definitions.flat_map { |e| e[\"contents\"] }\n definitions.compact!\n definitions\n end",
"def definition_url\n \"https://raw.githubusercontent.com/HumanCellAtlas/metadata-schema/#{self.version}/json_schema/analysis.json\"\n end",
"def GatherDefines()\n return @Defines\n end",
"def sort_definitions\n {}\n end",
"def definition_filepath\n Rails.root.join(self.definition_root, 'analysis.json')\n end",
"def index\n @ped_program_definitions = PedProgramDefinition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_program_definitions }\n end\n end",
"def definitions\n Element.definitions.collect { |e| e['contents'] }.flatten.compact\n end",
"def unofficial_definitions\n load_currencies if @unofficial_definitions.nil?\n\n @unofficial_definitions\n end",
"def show\n\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end",
"def index\n @definition.index\n end",
"def read_definitions_file\n if ::File.exist?(definitions_file_path)\n ::YAML.safe_load(File.read(definitions_file_path)) || []\n else\n raise LoadError, \"Could not find menus.yml file! Please run `rails generate alchemy:install`\"\n end\n end",
"def definition_cache\n @definition_cache ||= {}\n end",
"def find_space_attribute_definitions(params={}, headers=default_headers)\n @logger.info(\"Finding Space Attribute Definitions\")\n get(\"#{@api_url}/spaceAttributeDefinitions\", params, headers)\n end",
"def parse_definition_list; end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition.dictionary, notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def definitions=(defs)\n @definitions = Hash[defs.collect do |key,value|\n [key.to_sym, Hash[value.collect do |key, val|\n [key.to_i, Hash[val.collect{|k,v| [k.to_i, v]}]]\n end]]\n end]\n end",
"def find_user_attribute_definitions(params={}, headers=default_headers)\n @logger.info(\"Finding User Attribute Definitions\")\n get(\"#{@api_url}/userAttributeDefinitions\", params, headers)\n end",
"def content_definitions\n return nil if definition.blank?\n\n definition[\"contents\"]\n end",
"def read_definitions_file\n if ::File.exist?(definitions_file_path)\n ::YAML.safe_load_file(definitions_file_path) || []\n else\n raise LoadError, \"Could not find menus.yml file! Please run `rails generate alchemy:install`\"\n end\n end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def index\n @r_property_definitions = RPropertyDefinition.all\n end",
"def create\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: 'Definition was successfully created.' }\n format.json { render json: @definition, status: :created, location: @definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_kapp_attribute_definitions(kapp_slug, params={}, headers=default_headers)\n @logger.info(\"Finding Kapp attribute definitions in the \\\"#{kapp_slug}\\\" kapp.\")\n get(\"#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions\", params, headers)\n end",
"def index\n @doc_type_am_configurations = DocTypeAmConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @doc_type_am_configurations }\n end\n end",
"def list_operation_definitions(resource_type_path)\n parsed_path = CanonicalPath.parse(resource_type_path.to_s)\n feed_id = parsed_path.feed_id\n resource_type_id = parsed_path.resource_type_id\n ret = http_get(\"/feeds/#{feed_id}/resourceTypes/#{resource_type_id}/operationTypes\")\n ret.map { |ot| ot['id'] }\n end",
"def get_license_definitions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LicenseApi.get_license_definitions ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/license/definitions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<LicenseDefinition>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LicenseApi#get_license_definitions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n\t\t\t@definition.index\n\t\tend",
"def each(&block)\n @definitions.each(&block)\n end",
"def object_definition_metadata\n version = @account.api_version.nil? ? 'latest' : @account.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end",
"def get_all(account = nil)\n account ||= user_api.account\n @all_definitions[account] ||= RagentApi::CollectionDefinitionMapping.get_all(account)\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: \"Definition was successfully created.\" }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_error_definitions!\n self.output[:definitions].merge!(\n 'Error' => {\n type: 'object',\n properties: {\n type: type_and_format('string'),\n message: type_and_format('string')\n }\n },\n 'Errors' => {\n type: 'object',\n properties: {\n errors: {\n type: 'array',\n items: { '$ref' => '#/definitions/Error' }\n }\n }\n }\n )\n end",
"def show\n @definition = @word.definitions.new\n @definition_theme = DefinitionTheme.new\n @themes = Theme.all\n @exemple = Exemple.new\n @groups = Group.all\n @definition_group = DefinitionGroup.new\n @words = Word.all\n @definition_translation = DefinitionTranslation.new\n @group = Group.new\n @search = Search.new\n end",
"def GatherDefines()\n defines = @Defines\n defines.concat(@ResourceFileSet.GatherDefines())\n return defines\n end",
"def write_endpoint_definitions!\n controller_definitions = controllers\n .formatted(format)\n .inject({}) do |definitions, path_definition|\n\n definitions.merge(path_definition)\n end\n\n inject_objects_under_key!(:paths, controller_definitions, true)\n end",
"def get_object_definition(object_type)\n result = {}\n definition = @client.get_business_object_definition(object_type)\n selector = 'BusinessObjectDef > FieldList > Field'\n Nokogiri::XML(definition).css(selector).map do |field|\n result[field['Name']] = field.css('Description').inner_html\n end\n return result\n end",
"def object_definition_metadata\n version = self.api_version.nil? ? 'latest' : self.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end",
"def new\n\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_definitions(code)\n ast, comments = parse_with_comments(code)\n vm = RubyLint::VirtualMachine.new(:comments => comments)\n\n vm.run(ast)\n\n return vm.definitions\nend"
] |
[
"0.71696943",
"0.7035405",
"0.69830155",
"0.6952514",
"0.68399847",
"0.6793316",
"0.6740609",
"0.65474063",
"0.6519796",
"0.64545053",
"0.64442104",
"0.64051026",
"0.6389717",
"0.63701975",
"0.63386023",
"0.63142693",
"0.6281907",
"0.6281907",
"0.62501967",
"0.6196053",
"0.6179486",
"0.61791325",
"0.61249554",
"0.61249554",
"0.6100022",
"0.604552",
"0.60449755",
"0.60449755",
"0.6026379",
"0.602073",
"0.59596825",
"0.5950709",
"0.5936134",
"0.59354633",
"0.590266",
"0.5882988",
"0.58646464",
"0.5848308",
"0.58357173",
"0.5804822",
"0.5802224",
"0.57953113",
"0.57252216",
"0.5699669",
"0.5699669",
"0.5665727",
"0.56184906",
"0.56055444",
"0.559803",
"0.55956966",
"0.559084",
"0.5579681",
"0.55773884",
"0.5543242",
"0.5531828",
"0.55168533",
"0.5513414",
"0.5504653",
"0.5492948",
"0.548704",
"0.5463909",
"0.5462436",
"0.54315305",
"0.5420042",
"0.54167956",
"0.5398826",
"0.5392184",
"0.5388527",
"0.53880674",
"0.53834474",
"0.5378802",
"0.53672934",
"0.53452975",
"0.53414404",
"0.53346753",
"0.533193",
"0.5328576",
"0.53161407",
"0.53144705",
"0.5313298",
"0.5310191",
"0.5287489",
"0.5275053",
"0.52630883",
"0.52592856",
"0.52574396",
"0.523942",
"0.5228689",
"0.5215946",
"0.52153295",
"0.5189199",
"0.5181956",
"0.5172902",
"0.5159837",
"0.5146083",
"0.51383",
"0.5136653",
"0.5134393",
"0.5129355",
"0.50939786"
] |
0.6830788
|
5
|
GET /definitions/1 GET /definitions/1.json
|
def show
@definition = Definition.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @definition }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @definitions = Definition.order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def index\n @definitions = Definition.all\n end",
"def index\n\n @definitions = Definition.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @definitions.to_xml(:request => request) }\n format.json { render :json => @definitions.to_json(:request => request) }\n end\n end",
"def definitions\n @definitions ||= { responses: {} }\n end",
"def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @definitions = Definition.where(word_id: word_id.ids)\n render json:{\n id: @definitions\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end",
"def get_definitions(word, *args)\n http_method = :get\n path = '/word/{word}/definitions'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def definitions() return @definitions end",
"def definition_by_name(name)\n definitions_repository.get(name)\n end",
"def index\n @custom_definitions = CustomDefinition.all\n end",
"def new\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @definition }\n end\n end",
"def new\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @definition }\n end\n end",
"def definitions\n # Some httparty work to fetch definitions from Websters\n end",
"def index\n\n if params[:tag]\n @definitions.tagged_with(params[:tag])\n elsif params[:letter]\n @definitions = Definition.starts_with(params[:letter])\n else\n @definitions = Definition.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def show\n @definitions = @word.definitions.order(cached_votes_up: :desc, created_at: :desc)\n end",
"def print_definition()\n puts \"Definition\"\n puts \"----------------------------------------\"\n puts @word_info[:title], \" \"\n @word_info[:types_definitions].each do |type|\n puts \"\\t\" + type[:type]\n type[:definitions].each_with_index do |defintion, i|\n puts \"\\t #{i+1}. #{defintion}\"\n end\n print \"\\n\"\n end\n end",
"def get_definitions\n Dictionary.find_by_word(word_id)\n end",
"def get_definition(cls, bld, fun)\r\n bld.add(\"///\")\r\n bld.add(\"/// Web API get single \" + cls.getUName())\r\n bld.add(\"///\")\r\n\r\n get_body(cls, bld, fun)\r\n\r\n bld.endFunction\r\n end",
"def list_service_definitions_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.list_service_definitions ...'\n end\n allowable_values = ['v1', 'v2', 'v2.1']\n if @api_client.config.client_side_validation && opts[:'schema_version'] && !allowable_values.include?(opts[:'schema_version'])\n fail ArgumentError, \"invalid value for \\\"schema_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'schema_version'] = opts[:'schema_version'] if !opts[:'schema_version'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceDefinitionsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_service_definitions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#list_service_definitions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def definitions\n definitions_repository.all\n end",
"def generate_definitions_list\n definitions = YARD::Registry.all(:definition).uniq.sort_by{|define| define.name.to_s}\n generate_full_list(definitions, 'Definition', 'definitions')\nend",
"def show\n\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end",
"def get_definition\n\n end",
"def pending\n @definitions = Definition.all.pending\n render json: @definitions, status: :accepted\n end",
"def definition_url\n \"https://raw.githubusercontent.com/HumanCellAtlas/metadata-schema/#{self.version}/json_schema/analysis.json\"\n end",
"def definitions\n @definitions ||= g_definitions\n end",
"def index\n @pluto_process_definitions = collection.all\n\n respond_to do |format|\n format.json { render json: @pluto_process_definitions }\n end\n end",
"def new\n\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end",
"def initialize\n @definitions = {}\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def definitions; end",
"def definitions; end",
"def get_config_var_definitions(variable_id)\n path = \"/d2l/api/lp/#{$lp_ver}/configVariables/(#{variable_id}/definition\"\n _get(path)\n # returns Definition JSON data block\nend",
"def all\n @definitions ||= []\n end",
"def definitions\n return @definitions\n end",
"def size\n @definitions.size\n end",
"def definitions=(value)\n @definitions = value\n end",
"def load_definitions\n clear_definitions\n Dir[File.expand_path('../../data/*.json', __dir__)].each { |f| load_json(f) }\n end",
"def get_service_definition_with_http_info(service_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.get_service_definition ...'\n end\n # verify the required parameter 'service_name' is set\n if @api_client.config.client_side_validation && service_name.nil?\n fail ArgumentError, \"Missing the required parameter 'service_name' when calling ServiceDefinitionAPI.get_service_definition\"\n end\n allowable_values = ['v1', 'v2', 'v2.1']\n if @api_client.config.client_side_validation && opts[:'schema_version'] && !allowable_values.include?(opts[:'schema_version'])\n fail ArgumentError, \"invalid value for \\\"schema_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions/{service_name}'.sub('{service_name}', CGI.escape(service_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'schema_version'] = opts[:'schema_version'] if !opts[:'schema_version'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceDefinitionGetResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_service_definition,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#get_service_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if params[:step_definition_id] \n step_definition = StepDefinition.find(params[:step_definition_id])\n if step_definition != nil\n @field_definitions = step_definition.field_definitions\n else\n @field_definitions = []\n end\n else \n @field_definitions = FieldDefinition.all\n end\n end",
"def definitions\n definitions = []\n while (code, parameters = response) and code != 250\n definitions << Definition.new(split(parameters), lines(false).join(\"\\n\"))\n end\n definitions\n end",
"def definition_schema\n begin\n # check for local copy first\n if File.exist?(self.definition_filepath)\n existing_schema = File.read(self.definition_filepath)\n JSON.parse(existing_schema)\n else\n Rails.logger.info \"#{Time.zone.now}: saving new local copy of #{self.definition_filepath}\"\n metadata_schema = RestClient.get self.definition_url\n # write a local copy\n unless Dir.exist?(self.definition_root)\n FileUtils.mkdir_p(self.definition_root)\n end\n new_schema = File.new(self.definition_filepath, 'w+')\n new_schema.write metadata_schema.body\n new_schema.close\n JSON.parse(metadata_schema.body)\n end\n rescue RestClient::ExceptionWithResponse => e\n ErrorTracker.report_exception(e, self.study.user, { request_url: self.definition_url, request_response: e.http_body})\n Rails.logger.error \"Error retrieving remote HCA Analysis metadata schema: #{e.message}\"\n {error: \"Error retrieving definition schema: #{e.message}\"}\n rescue JSON::ParserError => e\n ErrorTracker.report_exception(e, self.study.user, { metadata_body: metadata_schema.body})\n Rails.logger.error \"Error parsing HCA Analysis metadata schema: #{e.message}\"\n {error: \"Error parsing definition schema: #{e.message}\"}\n end\n end",
"def show\n respond_with(@schema) do |format|\n format.json { render json: @schema.to_json }\n end\n end",
"def definitions(input)\n list = 1\n input.body.each do |definition|\n current_definition = definition['text']\n puts \"#{list}. #{current_definition}\"\n list += 1\n end\n end",
"def show\n @import_def = ImportDef.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import_def }\n end\n end",
"def get_document_schema\n filePath = Rails.root.join(\"lib\", \"base_truevault_doc.json\")\n file = File.read(filePath)\n schema = JSON.parse(file).with_indifferent_access\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def definitions(word)\n MinWords::DB[:defines].where(word_id: word[:id]).all\n end",
"def create\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: 'Definition was successfully created.' }\n format.json { render json: @definition, status: :created, location: @definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @definition.index\n end",
"def find_single(scope) \n JSON[RestClient.get \"#{@site}/unit/#{scope}\", :accept=>'json'][0]\n end",
"def show\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schema }\n end\n end",
"def definition\n @definition ||= []\n end",
"def definition_filepath\n Rails.root.join(self.definition_root, 'analysis.json')\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition.dictionary, notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ped_program_definitions = PedProgramDefinition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_program_definitions }\n end\n end",
"def show\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @schema }\n end\n end",
"def show\n @ref_hospitalization_type = Ref::HospitalizationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_hospitalization_type }\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\t\t@definition.index\n\t\tend",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def get_definition()\n html_def = @noko.css(\"li.g:first-of-type\")\n local_word_info = Hash.new\n local_word_info[:title] = html_def.css(\"h3 span\")[0].text\n\n if local_word_info[:title].ascii_only?\n local_word_info[:title] = local_word_info[:title].upcase\n else\n local_word_info[:title] = make_readable(local_word_info[:title]).upcase\n end\n\n local_word_info[:types_definitions] = []\n html_def.css(\"tr\").each do |e|\n # puts e\n if e.to_s =~ /<div/\n definitions = Hash.new\n definitions[:type] = e.css(\"div\")[0].text.upcase\n definitions[:definitions] = []\n e.css(\"li\").each do |li|\n definitions[:definitions] << li.text\n end\n local_word_info[:types_definitions] << definitions\n end\n end\n\n return local_word_info\n end",
"def schema_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SchemaApi.schema_get ...\"\n end\n # resource path\n local_var_path = \"/schema\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SchemaApi#schema_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @mgamedefinition = Mgamedefinition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mgamedefinition }\n end\n end",
"def show\n @task_definition = TaskDefinition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_definition }\n end\n end",
"def show\n @metadata_schema = MetadataSchema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metadata_schema }\n end\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: \"Definition was successfully created.\" }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n definition = Definition.where(id: params[:id]).first\n render json: definition, :include => {:user => {:only => :username}}\n end",
"def factory_definitions\n @factory_definitions ||= {}\n end",
"def json_schema\n raise NotImplementedError\n end",
"def json_schema\n raise NotImplementedError\n end",
"def get_all_config_var_definitions(search = '', bookmark = '')\n path = \"/d2l/api/lp/#{$lp_ver}/configVariables/definitions/\"\n path += \"?search=#{search}\" if search != ''\n path += \"?bookmark=#{bookmark}\" if bookmark != ''\n _get(path)\n # returns paged result set of Definition JSON data blocks\nend",
"def json_spec_schema(spec)\n Data.export(json_spec_path, spec, DummyUtil.new)\n end",
"def minimal\n {\n swagger: '2.0',\n info: {\n version: '0.0.0',\n title: 'Simple API'\n }\n }\n end",
"def index\n @title = @for_which.sub('_', ' ').pluralize.titleize #ex, Quality Systems\n @definitions = params[:two_tier_definitionx_definitions][:model_ar_r]\n @definitions = @definitions.where(:for_which => @for_which)\n @definitions = @definitions.page(params[:page]).per_page(@max_pagination).order('ranking_index') \n end",
"def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def show\n @doc_type_am_configuration = DocTypeAmConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doc_type_am_configuration }\n end\n end",
"def index\n @doc_type_am_configurations = DocTypeAmConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @doc_type_am_configurations }\n end\n end",
"def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end",
"def definition_list(options = {}, &block)\n definition_list_for(resource, options, &block)\n end",
"def set_definition\n @definition = Definition.find(params[:id])\n end",
"def set_definition\n @definition = Definition.find(params[:id])\n end",
"def set_definition\n @definition = Definition.find(params[:id])\n end",
"def get_license_definitions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LicenseApi.get_license_definitions ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/license/definitions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<LicenseDefinition>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LicenseApi#get_license_definitions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end",
"def swagger_spec_for service\n {\n description: service.description.nil? ? service.name : service.description,\n path: \"#{swagger_spec_path(service.system_name)}.{format}\"\n }\n end",
"def definitions\n run_context.definitions\n end",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def test_download_schema\n Excon.stub(method: :get) do |request|\n assert_equal('example.com', request[:host])\n assert_equal('/schema', request[:path])\n assert_equal('application/vnd.heroku+json; version=3',\n request[:headers]['Accept'])\n Excon.stubs.pop\n {status: 200, headers: {'Content-Type' => 'application/json'},\n body: MultiJson.dump(SAMPLE_SCHEMA)}\n end\n\n schema = Heroics::download_schema(\n 'https://username:token@example.com/schema',\n default_headers: {'Accept' => 'application/vnd.heroku+json; version=3'})\n assert_equal(SAMPLE_SCHEMA, schema.schema)\n end",
"def definitions\n # try looking for the definition list\n defn = @body.at_css('#definitions')\n return defn.parent if defn\n\n # try looking for the heading\n defn = @body.at_xpath('.//a:section/a:heading[text() = \"Definitions\"]', a: NS)\n return defn.parent if defn\n\n nil\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def query_def; @hit.mrna.definition; end",
"def read_definitions\n definitions = []\n definitions_file = ARGV[0]\n $logger.info \"Reading user definitions from \\\"#{definitions_file}\\\"\"\n options = {:col_sep => DELIM, :headers => :first_row, :return_headers => false}\n CSV.foreach(definitions_file, options) do |row|\n next if row.empty?\n id = row[0].strip\n first_name = row[1].strip\n last_name = row[2].strip\n workspace = row[3].strip\n definitions << {id: id, first_name: first_name, last_name: last_name, workspace: workspace}\n end\n definitions\nend",
"def index\n @schemas = Schema.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schemas }\n end\n end",
"def definitions(key, field=nil)\n begin\n defs = self.definition_schema[key]\n if field.present?\n defs[field]\n else\n defs\n end\n rescue NoMethodError => e\n field_key = field.present? ? \"#{key}/#{field}\" : key\n ErrorTracker.report_exception(e, self.study.user, { missing_key: field_key, analysis_metadatum: self.attributes.to_h})\n Rails.logger.error \"Error accessing remote HCA Analysis metadata field definitions for #{field_key}: #{e.message}\"\n nil\n end\n end",
"def object_definition_metadata\n version = @account.api_version.nil? ? 'latest' : @account.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end",
"def show\n @definition = @word.definitions.new\n @definition_theme = DefinitionTheme.new\n @themes = Theme.all\n @exemple = Exemple.new\n @groups = Group.all\n @definition_group = DefinitionGroup.new\n @words = Word.all\n @definition_translation = DefinitionTranslation.new\n @group = Group.new\n @search = Search.new\n end"
] |
[
"0.6423631",
"0.6383879",
"0.6200107",
"0.6055134",
"0.6040642",
"0.6014104",
"0.58885425",
"0.58833396",
"0.5860071",
"0.58480954",
"0.58480954",
"0.5817164",
"0.581531",
"0.57763374",
"0.5767419",
"0.5749257",
"0.57099915",
"0.5693339",
"0.5589913",
"0.55643064",
"0.5544749",
"0.5519406",
"0.5474132",
"0.5424982",
"0.5421463",
"0.54033625",
"0.53026676",
"0.5300332",
"0.5286607",
"0.528376",
"0.5283527",
"0.5283527",
"0.5245687",
"0.5242858",
"0.5237017",
"0.52141917",
"0.5209469",
"0.5206524",
"0.5200051",
"0.51940596",
"0.5188832",
"0.51783234",
"0.5169647",
"0.516679",
"0.5162288",
"0.5153918",
"0.5147211",
"0.51404244",
"0.5107632",
"0.5070421",
"0.5069302",
"0.5064092",
"0.5053332",
"0.5052049",
"0.5044736",
"0.50406164",
"0.5036848",
"0.50340563",
"0.5023102",
"0.5004708",
"0.49999285",
"0.49981093",
"0.49927336",
"0.49784136",
"0.49753296",
"0.49740365",
"0.49685505",
"0.4966175",
"0.496335",
"0.49557674",
"0.49557674",
"0.49494466",
"0.4943222",
"0.4940308",
"0.49211085",
"0.49188483",
"0.49169922",
"0.49122405",
"0.4900637",
"0.48973376",
"0.48946187",
"0.48946187",
"0.48946187",
"0.48932797",
"0.48867264",
"0.48867264",
"0.48862144",
"0.4872377",
"0.48553145",
"0.48507982",
"0.48492768",
"0.48480573",
"0.48480573",
"0.4840776",
"0.48397255",
"0.48300034",
"0.48259896",
"0.48219177",
"0.48162472"
] |
0.6233283
|
3
|
GET /definitions/new GET /definitions/new.json
|
def new
@definition = Definition.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @definition }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @import_def = ImportDef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_def }\n end\n end",
"def new\n\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end",
"def new\n @schema = Schema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schema }\n end\n end",
"def new\n @schema = Schema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @schema }\n end\n end",
"def new\n @reflection = Reflection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reflection }\n end\n end",
"def new\n @fact = fact_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fact }\n end\n end",
"def new\n @definition = Definition.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @definition }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @schema_field = SchemaField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @schema_field }\n end\n end",
"def new\n @ref_hospitalization_type = Ref::HospitalizationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_hospitalization_type }\n end\n end",
"def new\n @fhir_base_url = FhirBaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fhir_base_url }\n end\n end",
"def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end",
"def new\n @all_field_type = AllFieldType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @all_field_type }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def new\n @girltype = Girltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @girltype }\n end\n end",
"def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end",
"def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'reference_type' }\n format.json { render json: @reference_type }\n end\n end",
"def new\n @ftype = Ftype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ftype }\n end\n end",
"def new\n @wadl = Wadl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wadl }\n end\n end",
"def new\n @fieldtype = Fieldtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fieldtype }\n end\n end",
"def create\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: 'Definition was successfully created.' }\n format.json { render json: @definition, status: :created, location: @definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @task_definition = TaskDefinition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_definition }\n end\n end",
"def new\n @api_noun = Api::Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end",
"def new\n @observation_type = ObservationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation_type }\n end\n end",
"def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end",
"def new\n @foiltype = Foiltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n @star_fact = Star::Fact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_fact }\n end\n end",
"def new\n @identifier_type = IdentifierType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @identifier_type }\n end\n end",
"def new\n @archetype = Archetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @archetype }\n end\n end",
"def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end",
"def new\n @concept = Concept.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concept }\n end\n end",
"def new\n @gl_type = GlType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl_type }\n end\n end",
"def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end",
"def new\n @processdef = Processdef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @processdef }\n end\n end",
"def new\n @ctype = Ctype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ctype }\n end\n end",
"def new\n @mgamedefinition = Mgamedefinition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mgamedefinition }\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @holidaytype = Holidaytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holidaytype }\n end\n end",
"def new\n @expectation = Expectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expectation }\n end\n end",
"def new\n @familiar = Familiar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @familiar }\n end\n end",
"def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\n end\n end",
"def new\n @pluto_process_definition = collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pluto_process_definition }\n end\n end",
"def new\n @structure_type = StructureType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @structure_type }\n end\n end",
"def new\n @registry = Registry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registry }\n end\n end",
"def new\n @prototype = Prototype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prototype }\n end\n end",
"def new\n @breadcrumb = 'create'\n @contracting_request_document_type = ContractingRequestDocumentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contracting_request_document_type }\n end\n end",
"def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end",
"def create\n @custom_definition = @site.custom_definitions.new(custom_definition_params)\n\n if @custom_definition.save\n redirect_to @site\n else\n render 'new'\n end\n end",
"def new\n @law = Law.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @law }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rulebook }\n end\n end",
"def new\n @document_type = DocumentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_type }\n end\n end",
"def new\n @identifier = Identifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identifier }\n end\n end",
"def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end",
"def new\n @field = Field.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @field }\n end\n end",
"def new\n @field = Field.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @field }\n end\n end",
"def new\n @fish_type = FishType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish_type }\n end\n end",
"def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition.dictionary, notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @dictionary = Dictionary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dictionary }\n end\n end",
"def new\n @id = Id.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @id }\n end\n end",
"def new\n @format_lookup = FormatLookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @format_lookup }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @expression_relationship_type = ExpressionRelationshipType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expression_relationship_type }\n end\n end",
"def new\n @chef_mapping = ChefMapping.new\n @source = []\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chef_mapping }\n end\n end",
"def new\n @var_conf = VarConf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @var_conf }\n end\n end",
"def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end",
"def new\n @incident_type = IncidentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident_type }\n end\n end",
"def new\n @taxon_rule = TaxonRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon_rule }\n end\n end",
"def new\n @reform_type = ReformType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reform_type }\n end\n end",
"def new\n @entity = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @title = 'New Clinical Specialty'\n @description = 'Add a new clinical specialty'\n @clinicalsection = Clinicalsection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinicalsection }\n end\n end",
"def new\n resource = build_resource({})\n respond_with resource\n end",
"def new\n @macroval = Macroval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @macroval }\n end\n end",
"def new\n @conceptual_entity = ConceptualEntity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conceptual_entity }\n end\n end",
"def new\n @desc = Desc.new\n @phase_collection = Desc.phase_hashes\n @star_collection = Desc.star_hashes\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @desc }\n end\n end",
"def new\n @office = Office.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end\n end",
"def new\n @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end",
"def new\n @status = Status.new\n @status.build_document\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: \"Definition was successfully created.\" }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @resource = Resource.new\n @resource_types=ResourceType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @ped_program_definition = PedProgramDefinition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ped_program_definition }\n end\n end",
"def new\n @incident_kind = IncidentKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident_kind }\n end\n end",
"def new\n @fueltype = Fueltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fueltype }\n end\n end",
"def new\n @knowledge = Knowledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def new\n @realty_type = RealtyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @realty_type }\n end\n end",
"def new\n @entity_mapping = EntityMapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_mapping }\n end\n end",
"def new\n @breadcrumb = 'create'\n @infrastructure_type = InfrastructureType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @infrastructure_type }\n end\n end",
"def new\n @variable = Variable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variable }\n end\n end",
"def new\n @fun = Fun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fun }\n end\n end",
"def new\n puts @category.inspect\n @internal = @category.internals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internal }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end"
] |
[
"0.6930692",
"0.68009335",
"0.6758711",
"0.67394155",
"0.65274596",
"0.6403782",
"0.6383718",
"0.6373029",
"0.6325937",
"0.63258094",
"0.6313153",
"0.6310018",
"0.63092446",
"0.6306276",
"0.62651294",
"0.6259509",
"0.62584955",
"0.62469876",
"0.6246857",
"0.62422776",
"0.6231919",
"0.6229909",
"0.6217011",
"0.6215065",
"0.620442",
"0.62006384",
"0.61855245",
"0.61809874",
"0.61658496",
"0.6162518",
"0.6152223",
"0.6145567",
"0.61334735",
"0.6116966",
"0.61134285",
"0.6103737",
"0.60946673",
"0.60881335",
"0.60774785",
"0.6073097",
"0.60724205",
"0.60704225",
"0.60610706",
"0.6056498",
"0.60478497",
"0.6044378",
"0.6042978",
"0.60418844",
"0.60402215",
"0.60270685",
"0.6020516",
"0.6018051",
"0.60101545",
"0.6007459",
"0.6004577",
"0.59983546",
"0.59983546",
"0.59977484",
"0.59945095",
"0.5992721",
"0.5992595",
"0.5982244",
"0.5980144",
"0.5978957",
"0.5978957",
"0.5978957",
"0.5978957",
"0.5978957",
"0.5969828",
"0.5967461",
"0.59630436",
"0.59578556",
"0.59569764",
"0.595483",
"0.59498894",
"0.5942815",
"0.594165",
"0.5941544",
"0.594042",
"0.5933841",
"0.5933619",
"0.59309626",
"0.5928968",
"0.59215814",
"0.5920217",
"0.5918832",
"0.59183496",
"0.5912916",
"0.59128433",
"0.59121567",
"0.591087",
"0.59093136",
"0.5909178",
"0.59072775",
"0.59061414",
"0.59054476",
"0.59038675",
"0.590121",
"0.5898569"
] |
0.7344656
|
1
|
POST /definitions POST /definitions.json
|
def create
@definition = Definition.new(params[:definition])
respond_to do |format|
if @definition.save
if user_signed_in?
format.html { redirect_to action: "confirm", :code => @definition.code }
else
UserMailer.confirm_definition_email(@definition.email, @definition.word, @definition.code).deliver
format.html { redirect_to action: "thanks" }
end
else
format.html { render action: "new" }
format.json { render json: @definition.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: 'Definition was successfully created.' }\n format.json { render json: @definition, status: :created, location: @definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: \"Definition was successfully created.\" }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition.dictionary, notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n step_definition_attributes = step_definition_params\n field_definitions_attributes = step_definition_attributes.delete(\"field_definitions\")\n\n @step_definition = StepDefinition.new(step_definition_attributes)\n @step_definition.field_definitions = FieldDefinition.createFieldDefinitions(field_definitions_attributes)\n\n respond_to do |format|\n if @step_definition.save\n format.html { redirect_to @step_definition, notice: 'Step definition was successfully created.' }\n format.json { render :show, status: :created, location: @step_definition }\n else\n format.html { render :new }\n format.json { render json: @step_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @field_definition = FieldDefinition.new(field_definition_params)\n\n respond_to do |format|\n if @field_definition.save\n format.html { redirect_to @field_definition, notice: 'Field definition was successfully created.' }\n format.json { render :show, status: :created, location: @field_definition }\n else\n format.html { render :new }\n format.json { render json: @field_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def definitions\n @definitions ||= { responses: {} }\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to word_path(@definition.word), notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def definition_params\n params.require(:definition).permit(:dictionary_id, :initialism, :meaning)\n end",
"def step_definition_params\n params.permit(:id, :order, :workflow_id, \n field_definitions: [:id, :name, :field_type, :validationRegex, :required, :errorMessage, :order]\n )\n end",
"def create\n\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n\n if @definition.save\n\n flash[:notice] = 'Definition was successfully created.'\n\n format.html {\n redirect_to(@definition)\n }\n format.xml {\n render(\n :xml => @definition.to_xml(:request => request),\n :status => :created,\n :location => @definition)\n }\n format.json {\n render(\n :json => @definition.to_json(:request => request),\n :status => :created,\n :location => @definition)\n }\n\n else\n\n format.html {\n render(:action => 'new')\n }\n format.xml {\n render(:xml => @definition.errors, :status => :unprocessable_entity)\n }\n format.json {\n render(:json => @definition.errors, :status => :unprocessable_entity)\n }\n end\n end\n end",
"def definition_params\n params.require(:definition).permit(:feature_id, :is_public, :is_primary, :ancestor_ids, :position, :content, :author_id, :language_id, :numerology, :tense)\n end",
"def definitions=(value)\n @definitions = value\n end",
"def create\n @definition = Definition.new(params[:definition])\n @definition.user_id = current_user.id\n current_user.definitions << @definition\n\n respond_to do |wants|\n if @definition.save\n flash[:notice] = 'Definition was successfully created.'\n wants.html { redirect_to(@definition) }\n wants.xml { render :xml => @definition, :status => :created, :location => @definition }\n else\n \tflash[:notice] = 'Definition was successfully created.'\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @definition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @definition }\n end\n end",
"def new\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @definition }\n end\n end",
"def definition_params\n params.require(:definition).permit(:sentence, :word_id)\n end",
"def create_tag_definition_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagDefinitionsApi.create_tag_definition ...\"\n end\n # resource path\n local_var_path = \"/1.0/kb/tagDefinitions\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagDefinitionsApi#create_tag_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @custom_definition = @site.custom_definitions.new(custom_definition_params)\n\n if @custom_definition.save\n redirect_to @site\n else\n render 'new'\n end\n end",
"def create\n @task_definition = TaskDefinition.new(params[:task_definition])\n\n respond_to do |format|\n if @task_definition.save\n format.html { redirect_to @task_definition, notice: 'Task definition was successfully created.' }\n format.json { render json: @task_definition, status: :created, location: @task_definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def definition_params\n params.require(:definition).permit(:content, :is_fr, :is_li, :word_id, :contributor_id, :source, :is_validated)\n end",
"def create\n megam_rest.post_appdefn(to_hash)\n end",
"def pending\n @definitions = Definition.all.pending\n render json: @definitions, status: :accepted\n end",
"def definitions; end",
"def definitions; end",
"def index\n @definitions = Definition.order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def create_or_update_service_definitions_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.create_or_update_service_definitions ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling ServiceDefinitionAPI.create_or_update_service_definitions\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceDefinitionCreateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :create_or_update_service_definitions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#create_or_update_service_definitions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @definitions = Definition.all\n end",
"def save_definition(word_id, definition)\n MinWords::DB[:defines].insert definition_text: definition, word_id: word_id\n end",
"def initialize\n @definitions = {}\n end",
"def create\n @defset = Defset.new(defset_params)\n\n respond_to do |format|\n if @defset.save\n format.html { redirect_to @defset, notice: 'Defset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @defset }\n else\n format.html { render action: 'new' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def custom_definition_params\n params.require(:custom_definition).permit(:name, :report_type_id)\n end",
"def index\n\n @definitions = Definition.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @definitions.to_xml(:request => request) }\n format.json { render :json => @definitions.to_json(:request => request) }\n end\n end",
"def generate_definitions_list\n definitions = YARD::Registry.all(:definition).uniq.sort_by{|define| define.name.to_s}\n generate_full_list(definitions, 'Definition', 'definitions')\nend",
"def create\n @schema = Schema.new(params[:schema])\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, :notice => 'Schema was successfully created.' }\n format.json { render :json => @schema, :status => :created, :location => @schema }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @schema.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def print_definition()\n puts \"Definition\"\n puts \"----------------------------------------\"\n puts @word_info[:title], \" \"\n @word_info[:types_definitions].each do |type|\n puts \"\\t\" + type[:type]\n type[:definitions].each_with_index do |defintion, i|\n puts \"\\t #{i+1}. #{defintion}\"\n end\n print \"\\n\"\n end\n end",
"def create\n @schema = Schema.new(params[:schema])\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render json: @schema, status: :created, location: @schema }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def factory_definitions\n @factory_definitions ||= {}\n end",
"def post\n \"\n desc 'create #{resource.singularize}' do\n tags %w[#{resource.singularize}]\n end\n params do\n # TODO: specify the parameters\n end\n post do\n # your code goes here\n end\"\n end",
"def index\n @custom_definitions = CustomDefinition.all\n end",
"def create(definition)\n raise \"Index definition must be a Hash.\" unless definition.is_a? Hash\n definition[:name] = self.index_name unless !definition[:name]\n definition[:fields] = definition[:fields].map(&:to_hash)\n resp = create_request().post(build_index_list_url(), :json => definition)\n raise_on_http_error(resp)\n return JSON.parse(resp.to_s)\n end",
"def create_process_def(process_def)\n doValidation(process_def)\n #@jtodoIMP handle when pass with ot without /\n post(process_def, self.create_process_uri)\n end",
"def create\n @schema = Schema.new(schema_params)\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render :show, status: :created, location: @schema }\n else\n format.html { render :new }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schema = Schema.new(schema_params)\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render :show, status: :created, location: @schema }\n else\n format.html { render :new }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @defect_type = DefectType.new(defect_type_params)\n\n respond_to do |format|\n if @defect_type.save\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully created.' }\n format.json { render :show, status: :created, location: @defect_type }\n else\n format.html { render :new }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_definitions(word, *args)\n http_method = :get\n path = '/word/{word}/definitions'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def postprocess(json_schema); json_schema; end",
"def definitions=(defs)\n @definitions = Hash[defs.collect do |key,value|\n [key.to_sym, Hash[value.collect do |key, val|\n [key.to_i, Hash[val.collect{|k,v| [k.to_i, v]}]]\n end]]\n end]\n end",
"def new\n\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def definitions() return @definitions end",
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def post(url_variables:, body:)\n ensure_service_document\n\n end",
"def index\n\n if params[:tag]\n @definitions.tagged_with(params[:tag])\n elsif params[:letter]\n @definitions = Definition.starts_with(params[:letter])\n else\n @definitions = Definition.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def write_endpoint_definitions!\n controller_definitions = controllers\n .formatted(format)\n .inject({}) do |definitions, path_definition|\n\n definitions.merge(path_definition)\n end\n\n inject_objects_under_key!(:paths, controller_definitions, true)\n end",
"def create\n @mgamedefinition = Mgamedefinition.new(params[:mgamedefinition])\n\n respond_to do |format|\n if @mgamedefinition.save\n format.html { redirect_to @mgamedefinition, notice: 'Mgamedefinition was successfully created.' }\n format.json { render json: @mgamedefinition, status: :created, location: @mgamedefinition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mgamedefinition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def apply_schema(definition)\n schema = MultiJson.load(File.read(SCHEMA_PATH))\n JSON::Validator.fully_validate(schema, definition)\n end",
"def setup_form\n form = {\n schema: {\n type: 'object',\n properties: {\n array: {\n title: 'You have not configured your schema form',\n type: 'array',\n items: {\n type: 'string',\n enum: [\n \"Ok I'll do it right away\",\n \"I'll let someone else do it for me\"\n ]\n }\n }\n }\n }\n }\n render json: form.to_json\n end",
"def post #:doc:\n end",
"def app_definitions=(value)\n @app_definitions = value\n end",
"def field_definition_params\n params.permit(:field_definition,:name, :field_type, :validationRegex, :required, :step_definition_id, :errorMessage, :order)\n end",
"def definitions(input)\n list = 1\n input.body.each do |definition|\n current_definition = definition['text']\n puts \"#{list}. #{current_definition}\"\n list += 1\n end\n end",
"def create_or_update_service_definitions(body, opts = {})\n data, _status_code, _headers = create_or_update_service_definitions_with_http_info(body, opts)\n data\n end",
"def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @definitions = Definition.where(word_id: word_id.ids)\n render json:{\n id: @definitions\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end",
"def << definition\n @definitions[definition.key] = definition\n end",
"def write_error_definitions!\n self.output[:definitions].merge!(\n 'Error' => {\n type: 'object',\n properties: {\n type: type_and_format('string'),\n message: type_and_format('string')\n }\n },\n 'Errors' => {\n type: 'object',\n properties: {\n errors: {\n type: 'array',\n items: { '$ref' => '#/definitions/Error' }\n }\n }\n }\n )\n end",
"def definitions\n # Some httparty work to fetch definitions from Websters\n end",
"def definition_builder; end",
"def definition_builder; end",
"def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def create_definition_files(folder)\n return unless File.directory? folder\n hash = Hash.new { |h, k| h[k] = [] }\n Dir.glob(\"#{definitions_dir}/**/*.json\").map do |f|\n filename = File.basename(f, '.*').to_s\n hash[filename] << [name: '', file: '']\n end\n save 'models', hash\n end",
"def definitions(options = {})\n SpanDictionary.new(options).definitions\n end",
"def definitions(options = {})\n SpanDictionary.new(options).definitions\n end",
"def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend",
"def json_spec_schema(spec)\n Data.export(json_spec_path, spec, DummyUtil.new)\n end",
"def create_label(name, description, types, color) \n data = {\n 'name' => name,\n 'description' => description,\n 'types' => types,\n 'color' => color\n }\n\n result = @access_token.post(\n \"#{SITE}/api/v2/labels\", \n data.to_json, \n {'Accept'=>'application/json', 'Content-Type' => 'application/json'}\n )\n\n JSON.parse(result.body)\n end",
"def index\n @pluto_process_definitions = collection.all\n\n respond_to do |format|\n format.json { render json: @pluto_process_definitions }\n end\n end",
"def word_params\n params.require(:word).permit(:word, :tag_list, definitions_attributes: [:definition, :URL])\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def endpoint_params\n params.require(:data).permit(:type, {\n attributes: [:verb, :path, response: [:code, :body, headers: {}]]\n })\n end",
"def create\n @r_property_definition = RPropertyDefinition.new(r_property_definition_params)\n\n respond_to do |format|\n if @r_property_definition.save\n format.html { redirect_to @r_property_definition, notice: 'R property definition was successfully created.' }\n format.json { render action: 'show', status: :created, location: @r_property_definition }\n else\n format.html { render action: 'new' }\n format.json { render json: @r_property_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def definitions\n run_context.definitions\n end",
"def declaration_params\n params.require(:declaration).permit(\n :title,\n :body,\n :step,\n )\n end",
"def glossary_params\n params.require(:glossary).permit(:user_id, :term, :word_class, :idiomatic, :memo, :tag_tokens, glossary_definitions_attributes: [:id, :user_id, :definition, :sentence, :_destroy])\n end",
"def create\n @schema_field = SchemaField.new(params[:schema_field])\n\n respond_to do |format|\n if @schema_field.save\n format.html { redirect_to @schema_field, :notice => 'Schema field was successfully created.' }\n format.json { render :json => @schema_field, :status => :created, :location => @schema_field }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @schema_field.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end",
"def definitions\n definitions = []\n while (code, parameters = response) and code != 250\n definitions << Definition.new(split(parameters), lines(false).join(\"\\n\"))\n end\n definitions\n end",
"def destroy\n @field_definition.destroy\n respond_to do |format|\n format.html { redirect_to field_definitions_url, notice: 'Field definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @import_def = ImportDef.new(params[:import_def])\n\n respond_to do |format|\n if @import_def.save\n format.html { redirect_to @import_def, notice: 'Import def was successfully created.' }\n format.json { render json: @import_def, status: :created, location: @import_def }\n else\n format.html { render action: \"new\" }\n format.json { render json: @import_def.errors, status: :unprocessable_entity }\n end\n end\n end",
"def definition\n @definition ||= []\n end",
"def list_service_definitions_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.list_service_definitions ...'\n end\n allowable_values = ['v1', 'v2', 'v2.1']\n if @api_client.config.client_side_validation && opts[:'schema_version'] && !allowable_values.include?(opts[:'schema_version'])\n fail ArgumentError, \"invalid value for \\\"schema_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'schema_version'] = opts[:'schema_version'] if !opts[:'schema_version'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceDefinitionsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_service_definitions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#list_service_definitions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n\n step_definition_attributes = step_definition_params\n field_definitions_attributes = step_definition_attributes.delete(\"field_definitions\")\n\n FieldDefinition.updateFieldDefinitions(field_definitions_attributes)\n\n respond_to do |format|\n if @step_definition.update(step_definition_attributes)\n format.html { redirect_to @step_definition, notice: 'Step definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_definition }\n else\n format.html { render :edit }\n format.json { render json: @step_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end",
"def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end",
"def post(endpoint, body, headers = {})\n headers = { accept: :json, content_type: :json }.merge(headers)\n @rest_resource[endpoint].post body, headers\n end",
"def create\n @target_def = TargetDef.new(params[:target_def])\n\n respond_to do |format|\n if @target_def.save\n flash[:notice] = 'TargetDef was successfully created.'\n format.html { redirect_to(@target_def) }\n format.xml { render :xml => @target_def, :status => :created, :location => @target_def }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @target_def.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end",
"def POST; end"
] |
[
"0.6339699",
"0.6263143",
"0.6234217",
"0.6203598",
"0.6068313",
"0.60348904",
"0.60322946",
"0.5752607",
"0.5720249",
"0.57096803",
"0.57054526",
"0.5700437",
"0.5660487",
"0.55631375",
"0.55631375",
"0.552386",
"0.551596",
"0.5499564",
"0.54778045",
"0.54729086",
"0.546584",
"0.546326",
"0.5437695",
"0.5437695",
"0.54312116",
"0.5426454",
"0.54010475",
"0.53476495",
"0.5337065",
"0.5325144",
"0.5312785",
"0.5302835",
"0.5282578",
"0.52587765",
"0.52555984",
"0.52527624",
"0.5251019",
"0.5245992",
"0.52368957",
"0.52312064",
"0.52053356",
"0.5205106",
"0.52038413",
"0.5197638",
"0.5197638",
"0.5192726",
"0.51804817",
"0.51780576",
"0.51721764",
"0.5170522",
"0.5169942",
"0.5156269",
"0.513819",
"0.51311284",
"0.5121917",
"0.51218134",
"0.512173",
"0.5119922",
"0.51189",
"0.5116936",
"0.5112191",
"0.51049584",
"0.51047105",
"0.50816053",
"0.5074638",
"0.5074276",
"0.5069315",
"0.50544757",
"0.50534534",
"0.50533056",
"0.50533056",
"0.5040306",
"0.50396967",
"0.50173855",
"0.50173855",
"0.5012581",
"0.500364",
"0.49994352",
"0.4976045",
"0.49648324",
"0.4963557",
"0.4962989",
"0.49486706",
"0.49397746",
"0.493106",
"0.4912868",
"0.49115732",
"0.49027607",
"0.48957917",
"0.4891041",
"0.48901877",
"0.48697755",
"0.48672825",
"0.48669365",
"0.48635122",
"0.48576573",
"0.48576573",
"0.48554692",
"0.4854518",
"0.4853641",
"0.48463607"
] |
0.0
|
-1
|
PUT /definitions/1 PUT /definitions/1.json
|
def update
@definition = Definition.find(params[:id])
respond_to do |format|
if @definition.update_attributes(params[:definition])
format.html { redirect_to @definition, notice: 'Definition was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @definition.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @definition = Definition.find(params[:id])\n @definition.update_attributes(params[:definition])\n respond_with @definition\n end",
"def update!(**args)\n @object_definitions = args[:object_definitions] if args.key?(:object_definitions)\n @operation_ids = args[:operation_ids] if args.key?(:operation_ids)\n end",
"def update!(**args)\n @object_definitions = args[:object_definitions] if args.key?(:object_definitions)\n @operation_ids = args[:operation_ids] if args.key?(:operation_ids)\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def create_or_update_service_definitions_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.create_or_update_service_definitions ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling ServiceDefinitionAPI.create_or_update_service_definitions\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceDefinitionCreateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :create_or_update_service_definitions,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#create_or_update_service_definitions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def update\n\n step_definition_attributes = step_definition_params\n field_definitions_attributes = step_definition_attributes.delete(\"field_definitions\")\n\n FieldDefinition.updateFieldDefinitions(field_definitions_attributes)\n\n respond_to do |format|\n if @step_definition.update(step_definition_attributes)\n format.html { redirect_to @step_definition, notice: 'Step definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_definition }\n else\n format.html { render :edit }\n format.json { render json: @step_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update\n respond_to do |format|\n if @definition.update(definition_params)\n format.html { redirect_to @definition, notice: \"Definition was successfully updated.\" }\n format.json { render :show, status: :ok, location: @definition }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @definition.update(definition_params)\n format.html { redirect_to @definition, notice: 'Definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @definition }\n else\n format.html { render :edit }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @definition.update(definition_params)\n format.html { redirect_to @definition.dictionary || @definition, notice: 'Definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @definition }\n else\n format.html { render :edit }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def test_client_from_schema_with_url_prefix\n uuid = '1ab1c589-df46-40aa-b786-60e83b1efb10'\n body = {'Hello' => 'World!'}\n result = {'Goodbye' => 'Universe!'}\n Excon.stub(method: :patch) do |request|\n assert_equal(\"/api/resource/#{uuid}\", request[:path])\n assert_equal('application/json', request[:headers]['Content-Type'])\n assert_equal(body, MultiJson.load(request[:body]))\n Excon.stubs.pop\n {status: 200, headers: {'Content-Type' => 'application/json'},\n body: MultiJson.dump(result)}\n end\n\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n output = StringIO.new\n cli = Heroics.cli_from_schema('cli', output, schema,\n 'https://example.com/api')\n cli.run('resource:update', uuid, body)\n assert_equal(MultiJson.dump(result, pretty: true) + \"\\n\", output.string)\n end",
"def apply_schema(definition)\n schema = MultiJson.load(File.read(SCHEMA_PATH))\n JSON::Validator.fully_validate(schema, definition)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @custom_definition.update(custom_definition_params)\n format.html { redirect_to @custom_definition, notice: 'Custom definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @custom_definition }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @custom_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put(id:, url_variables:, body:)\n ensure_service_document\n end",
"def create_method\n :put_json\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update_definition(id, new_def)\n MinWords::DB[:defines]\n .where(id: id)\n .update(:definition_text => new_def)\n end",
"def update\n\n @definition = Definition.find(params[:id])\n\n respond_to do |format|\n\n if @definition.update_attributes(params[:definition])\n\n flash[:notice] = 'Definition was successfully updated.'\n format.html { redirect_to(@definition) }\n format.xml { head :ok }\n format.json { head :ok }\n\n else\n\n format.html {\n render(:action => 'edit')\n }\n format.xml {\n render(:xml => @definition.errors, :status => :unprocessable_entity)\n }\n format.json {\n render(:json => @definition.errors, :status => :unprocessable_entity)\n }\n end\n end\n end",
"def set_definition\n @definition = Definition.find(params[:id])\n end",
"def set_definition\n @definition = Definition.find(params[:id])\n end",
"def set_definition\n @definition = Definition.find(params[:id])\n end",
"def create\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: 'Definition was successfully created.' }\n format.json { render json: @definition, status: :created, location: @definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update_break_type(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/break-types/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update(id: nil, body: nil)\n perform(:put, \"#{@resource_type}/#{id}\", body)\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def test_cli_from_schema\n uuid = '1ab1c589-df46-40aa-b786-60e83b1efb10'\n body = {'Hello' => 'World!'}\n result = {'Goodbye' => 'Universe!'}\n Excon.stub(method: :patch) do |request|\n assert_equal(\"/resource/#{uuid}\", request[:path])\n assert_equal('application/json', request[:headers]['Content-Type'])\n assert_equal(body, MultiJson.load(request[:body]))\n Excon.stubs.pop\n {status: 200, headers: {'Content-Type' => 'application/json'},\n body: MultiJson.dump(result)}\n end\n\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n output = StringIO.new\n cli = Heroics.cli_from_schema('cli', output, schema, 'https://example.com')\n cli.run('resource:update', uuid, body)\n assert_equal(MultiJson.dump(result, pretty: true) + \"\\n\", output.string)\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: \"Definition was successfully created.\" }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def put(request, response)\n write(request.body)\n Created\n end",
"def put(request, response)\n write(request.body)\n Created\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition.dictionary, notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def create_or_update(definition)\n raise \"Index definition must be a Hash.\" unless definition.is_a? Hash\n definition[:name] = self.index_name unless definition[:name]\n definition[:fields] = definition[:fields].map(&:to_hash)\n resp = create_request().put(build_index_definition_url(), :json => definition)\n raise_on_http_error(resp)\n return resp.to_s.empty? ? nil : JSON.parse(resp.to_s)\n end",
"def update\n\n # workflow_attributes = workflow_params\n # step_definitions_attributes = workflow_attributes.delete(\"step_definitions\")\n\n # StepDefinition.updateStepDefinitions(step_definitions_attributes)\n\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend",
"def update_definition(definition) update_attribute(:descriptor, definition) end",
"def update!(**args)\n @field_configs = args[:field_configs] if args.key?(:field_configs)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n respond_to do |format|\n if @field_definition.update(field_definition_params)\n format.html { redirect_to @field_definition, notice: 'Field definition was successfully updated.' }\n format.json { render :show, status: :ok, location: @field_definition }\n else\n format.html { render :edit }\n format.json { render json: @field_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n if @schema.update_attributes(params[:schema])\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n if @schema.update_attributes(params[:schema])\n format.html { redirect_to @schema, :notice => 'Schema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @schema.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update_api_definition_file\n if @research_tool.update(research_tool_params)\n redirect_to [:api_definition, :admin, @research_tool], notice: 'Research Tool was successfully updated.'\n else\n render :api_definition\n end\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def update!(**args)\n @cardinality = args[:cardinality] if args.key?(:cardinality)\n @default_value = args[:default_value] if args.key?(:default_value)\n @json_name = args[:json_name] if args.key?(:json_name)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @number = args[:number] if args.key?(:number)\n @oneof_index = args[:oneof_index] if args.key?(:oneof_index)\n @options = args[:options] if args.key?(:options)\n @packed = args[:packed] if args.key?(:packed)\n @type_url = args[:type_url] if args.key?(:type_url)\n end",
"def update\n respond_to do |format|\n if @schema.update(schema_params)\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema }\n else\n format.html { render :edit }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schema.update(schema_params)\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema }\n else\n format.html { render :edit }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, headers = {})\n process :put, path, headers\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @definitions = Definition.where(word_id: word_id.ids)\n render json:{\n id: @definitions\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update!(**args)\n @created = args[:created] if args.key?(:created)\n @definition = args[:definition] if args.key?(:definition)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @segment_id = args[:segment_id] if args.key?(:segment_id)\n @self_link = args[:self_link] if args.key?(:self_link)\n @type = args[:type] if args.key?(:type)\n @updated = args[:updated] if args.key?(:updated)\n end",
"def update_space_attribute_definition(name, body, headers=default_headers)\n @logger.info(\"Updating the \\\"#{name}\\\" Space Attribute Definition.\")\n put(\"#{@api_url}/spaceAttributeDefinitions/#{encode(name)}\",body, headers)\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def put(_status, headers, env)\n check_precondition!(env)\n\n if exists?\n update(env['rack.input'], env['CONTENT_TYPE'])\n headers = update_headers(headers)\n [200, headers, self]\n else\n create(env['rack.input'], env['CONTENT_TYPE'])\n [201, update_headers(headers), self]\n end\n end",
"def put(path, body: {}, headers: nil)\n response = conn.put do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end",
"def _update type, id, body\n @elasticsupport.client.update index: _index_for(type), type: type.to_s, id: id, body: body\n end",
"def update!(**args)\n @description = args[:description] if args.key?(:description)\n @format = args[:format] if args.key?(:format)\n @json_path = args[:json_path] if args.key?(:json_path)\n @name = args[:name] if args.key?(:name)\n @priority = args[:priority] if args.key?(:priority)\n @type = args[:type] if args.key?(:type)\n end",
"def put(*params); raise('Stub or mock required.') end",
"def create\n\n step_definition_attributes = step_definition_params\n field_definitions_attributes = step_definition_attributes.delete(\"field_definitions\")\n\n @step_definition = StepDefinition.new(step_definition_attributes)\n @step_definition.field_definitions = FieldDefinition.createFieldDefinitions(field_definitions_attributes)\n\n respond_to do |format|\n if @step_definition.save\n format.html { redirect_to @step_definition, notice: 'Step definition was successfully created.' }\n format.json { render :show, status: :created, location: @step_definition }\n else\n format.html { render :new }\n format.json { render json: @step_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end",
"def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def register(id, definition)\n if @definitions.has_key? id\n @logger.info 'Definition [%s] is being replaced' % id\n end\n\n @definitions.store id, definition\n end",
"def update\n put :update\n end",
"def set_custom_definition\n @custom_definition = CustomDefinition.find(params[:id])\n end",
"def put(name,&block)\n build_resource(name, :put, &block)\n end",
"def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end",
"def put(header = {})\n url = \"#{ApiClient.config.path}#{self.class.resource_path}\"\n response = ApiClient::Dispatcher.put(url, self.to_hash, header)\n attributes = ApiClient::Parser.response(response, url)\n update_attributes(attributes)\n end",
"def update(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n !!client.put(path, headers: headers, body: body)\n end",
"def create\n @definition = Definition.new(definition_params)\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to word_path(@definition.word), notice: 'Definition was successfully created.' }\n format.json { render :show, status: :created, location: @definition }\n else\n format.html { render :new }\n format.json { render json: @definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @defset.update(defset_params)\n format.html { redirect_to @defset, notice: 'Defset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def update\n @pronunciation = Pronunciation.find(params[:id])\n @pronunciation.update_attributes(params[:pronunciation])\n respond_with @definition\n end",
"def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end",
"def update\n respond_to do |format|\n if @table_def.update(table_def_params)\n format.html { redirect_to @table_def, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table_def.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end",
"def definition_params\n params.require(:definition).permit(:dictionary_id, :initialism, :meaning)\n end",
"def update\n @task_definition = TaskDefinition.find(params[:id])\n\n respond_to do |format|\n if @task_definition.update_attributes(params[:task_definition])\n format.html { redirect_to @task_definition, notice: 'Task definition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_definition.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5903674",
"0.5877338",
"0.5877338",
"0.581707",
"0.57526803",
"0.5628275",
"0.5628275",
"0.56269014",
"0.56230676",
"0.56042856",
"0.55740964",
"0.55352575",
"0.55137587",
"0.5510303",
"0.5502335",
"0.54641503",
"0.54230094",
"0.5415794",
"0.5392939",
"0.53609145",
"0.5343854",
"0.5343163",
"0.5339056",
"0.53365767",
"0.53185666",
"0.5315631",
"0.5296111",
"0.5296111",
"0.5296111",
"0.5295372",
"0.52907264",
"0.52635735",
"0.52533454",
"0.52438974",
"0.5227585",
"0.51925355",
"0.51898247",
"0.51805073",
"0.5170298",
"0.5170298",
"0.5157494",
"0.51480514",
"0.51351386",
"0.5131628",
"0.51226115",
"0.51212996",
"0.5117673",
"0.51169044",
"0.5106342",
"0.5105588",
"0.5100287",
"0.50960237",
"0.50838774",
"0.5078201",
"0.5078201",
"0.50733525",
"0.5063192",
"0.5063192",
"0.5056832",
"0.50550777",
"0.5052812",
"0.5051732",
"0.5050588",
"0.5050588",
"0.50451183",
"0.5035909",
"0.5032956",
"0.5032858",
"0.5027513",
"0.5027",
"0.5025606",
"0.5025451",
"0.5007837",
"0.50018275",
"0.49909452",
"0.49774787",
"0.49698472",
"0.49651882",
"0.4962951",
"0.49548954",
"0.49528944",
"0.49497342",
"0.49270585",
"0.49250847",
"0.49249622",
"0.49245626",
"0.4921438",
"0.49193293",
"0.49180642",
"0.49158418",
"0.4910406",
"0.4909591",
"0.4909425",
"0.4909425",
"0.4909425",
"0.49049145",
"0.49049145",
"0.49000508",
"0.48955017"
] |
0.56980634
|
6
|
DELETE /definitions/1 DELETE /definitions/1.json
|
def destroy
@definition = Definition.find(params[:id])
@definition.destroy
respond_to do |format|
format.html { redirect_to definitions_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to definitions_url, notice: 'Definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to definitions_url, notice: \"Definition was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @field_definition.destroy\n respond_to do |format|\n format.html { redirect_to field_definitions_url, notice: 'Field definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @import_def = ImportDef.find(params[:id])\n @import_def.destroy\n\n respond_to do |format|\n format.html { redirect_to import_defs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n dictionary = @definition.dictionary\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to dictionary_url(dictionary.id), notice: 'Definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete\n api(\"Delete\")\n end",
"def delete(*rest) end",
"def destroy\n @table_def.destroy\n respond_to do |format|\n format.html { redirect_to table_defs_url, status: 303 }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @task_definition = TaskDefinition.find(params[:id])\n @task_definition.destroy\n\n respond_to do |format|\n format.html { redirect_to task_definitions_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @step_definition.destroy\n respond_to do |format|\n format.html { redirect_to step_definitions_url, notice: 'Step definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @mgamedefinition = Mgamedefinition.find(params[:id])\n @mgamedefinition.destroy\n\n respond_to do |format|\n format.html { redirect_to mgamedefinitions_url }\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def deleteRequest\n\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @r_property_definition.destroy\n respond_to do |format|\n format.html { redirect_to r_property_definitions_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n type = DELETE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:10: 'delete'\n match( \"delete\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @target_def = TargetDef.find(params[:id])\n @target_def.destroy\n\n respond_to do |format|\n format.html { redirect_to(target_defs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @custom_definition.destroy\n redirect_to @site\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def destroy\n @definition.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(:back) }\n wants.xml { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @defset.destroy\n respond_to do |format|\n format.html { redirect_to defsets_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def delete!(*rest) end",
"def destroy\n @processdef = Processdef.find(params[:id])\n @processdef.destroy\n\n respond_to do |format|\n format.html { redirect_to processdefs_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end",
"def delete(header = {})\n url = \"#{ApiClient.config.path}#{self.class.resource_path}/#{id}\"\n response = ApiClient::Dispatcher.delete(url, header)\n attributes = ApiClient::Parser.response(response, url)\n update_attributes(attributes)\n end",
"def delete\n \n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def delete\n end",
"def retract_definition(*args)\n unless(args.length == 3 && !args.first.is_a?(Array))\n args = args.inject([]) {|a,i| a += i }\n end\n\n args = parse_schema_axioms(args)\n\n triples = QL.to_turtle(args, true)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug triples\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, triples, @schema_graph, \"text/turtle\")\n self\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @doc_type_am_configuration = DocTypeAmConfiguration.find(params[:id])\n @doc_type_am_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to doc_type_am_configurations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reflection.destroy\n head :no_content\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n @delete ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id|\n do_request('delete', entity, {:id=>id}, nil)\n end\n end\n end",
"def delete_service_definition_with_http_info(service_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.delete_service_definition ...'\n end\n # verify the required parameter 'service_name' is set\n if @api_client.config.client_side_validation && service_name.nil?\n fail ArgumentError, \"Missing the required parameter 'service_name' when calling ServiceDefinitionAPI.delete_service_definition\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions/{service_name}'.sub('{service_name}', CGI.escape(service_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :delete_service_definition,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#delete_service_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @dream_definition = DreamDefinition.find(params[:id])\n @dream_definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(dream_definitions_url) }\n format.xml { head :ok }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def delete\n \n end",
"def destroy; delete end",
"def delete(name)\n\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n conf.delete 'api'\n end",
"def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end",
"def delete_schema request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_schema_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(name); end",
"def delete(name); end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete(oid)\n end",
"def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @price_schema.destroy\n respond_to do |format|\n format.html { redirect_to price_schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @constant.destroy\n respond_to do |format|\n format.html { redirect_to constants_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @crop_definition = CropDefinition.find(params[:id])\n @crop_definition.destroy\n\n respond_to do |format|\n flash[:success] = 'Crop definition was successfully deleted.'\n format.html { redirect_to(admin_crop_definitions_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7056711",
"0.6766232",
"0.6750174",
"0.6583348",
"0.64048374",
"0.63863593",
"0.6327638",
"0.63005626",
"0.6287216",
"0.6265741",
"0.62635624",
"0.62557954",
"0.625193",
"0.623278",
"0.62260133",
"0.61956036",
"0.6157464",
"0.6146882",
"0.6141673",
"0.6134758",
"0.6134758",
"0.6134758",
"0.6134758",
"0.61158365",
"0.6102948",
"0.61011416",
"0.6101022",
"0.6096766",
"0.6076553",
"0.6074945",
"0.6060552",
"0.6053722",
"0.60402465",
"0.60210216",
"0.6009163",
"0.59911627",
"0.5989191",
"0.5980413",
"0.59707093",
"0.59689796",
"0.5965597",
"0.59565234",
"0.59549975",
"0.59549975",
"0.59543353",
"0.595429",
"0.59526384",
"0.5949225",
"0.59414124",
"0.5937262",
"0.59334195",
"0.5919232",
"0.5914203",
"0.5914203",
"0.5914203",
"0.5914203",
"0.5914203",
"0.5914203",
"0.5914203",
"0.5912298",
"0.5910885",
"0.5909693",
"0.5907656",
"0.59073365",
"0.5894538",
"0.5891732",
"0.5887459",
"0.5884613",
"0.5879402",
"0.58787733",
"0.58787733",
"0.5872413",
"0.5872413",
"0.5872413",
"0.586617",
"0.58465225",
"0.58282655",
"0.5828038",
"0.58206373",
"0.58194155",
"0.58194155",
"0.58191514",
"0.5818306",
"0.5814953",
"0.5813069",
"0.58126265",
"0.5810723",
"0.58094406",
"0.5808618",
"0.5805005",
"0.58031374",
"0.58018667",
"0.5796438",
"0.5785275",
"0.57814276",
"0.5777582",
"0.57769805",
"0.57769805",
"0.577386"
] |
0.6924805
|
2
|
verify definitions match the code submitted by user
|
def confirm
@definition = Definition.where(:code => params[:code]).first
if @definition
@definition.status = 'confirmed'
@definition.save!
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify\n end",
"def check_definition(definition, current_expected, current_key = nil)\n definition.each do |error_key, match_def|\n if match_def.is_a? Hash\n key = [current_key, error_key].compact.join('.')\n check_each(key, match_def, current_expected)\n else\n check_values(current_key, error_key, match_def, current_expected)\n end\n end\n end",
"def definitions; end",
"def definitions; end",
"def match(tokens, definitions); end",
"def verify\n end",
"def checks; end",
"def verify()\n # TODO\n end",
"def check_for_definitions\n @words.each do |word|\n @lemma ? lemma = \" - #{@lemmas[word]}\" : lemma = \"\"\n\n # Strip characters - mimics trimWordLowerCase in texts.js\n regex = /[\\u200B-\\u200D\\uFEFF\\u00A0]/\n word.gsub!(regex, \"\")\n regex = /^[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+|[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+$/\n word.gsub!(regex, \"\")\n \n next if word.length == 0\n \n # Convert to lowercase\n word = word.mb_chars.downcase.to_s\n current_word = word\n \n while word.length > 0 do\n if Match.find_by_word_and_text_id(word, @text)\n break\n else\n if word.length == 1\n @missing.push(\"#{current_word}#{lemma}\")\n break\n else\n if word.last == \"*\"\n word.chomp!(\"*\") # Remove wildcard character, if present\n word = word[0..-2] # Remove last character\n end\n word << \"*\" # Add wildcard character\n end\n end\n end\n end\n end",
"def verify\n\n end",
"def set_code\n codemaker_rules\n code_validation\n end",
"def validate_definitions!\n non_match = definitions.find_all do |definition|\n definition.provider != provider\n end\n unless non_match.empty?\n raise ArgumentError.new \"Rule defines `#{provider}` as provider but includes definitions for \" \\\n \"non matching providers. (#{non_match.map(&:provider).map(&:to_s).uniq.sort.join(\", \")})\"\n end\n end",
"def verify_terms(test_data)\n test_terms = test_data[Org::ORG_TERM_GRP.name]\n errors = []\n test_terms.each_with_index do |test_term, index|\n text_values_match?(test_term[Org::TERM_DISPLAY_NAME.name], element_value(org_display_name_input index), errors)\n text_values_match?(test_term[Org::TERM_NAME.name], element_value(org_term_name_input index), errors)\n text_values_match?(test_term[Org::TERM_QUALIFIER.name], element_value(org_term_qualifier_input index), errors)\n text_values_match?(test_term[Org::TERM_STATUS.name], element_value(org_term_status_input index), errors)\n text_values_match?(test_term[Org::TERM_TYPE.name], element_value(org_term_type_input index), errors)\n text_values_match?(test_term[Org::TERM_FLAG.name], element_value(org_term_flag_input index), errors)\n text_values_match?(test_term[Org::TERM_LANGUAGE.name], element_value(org_term_language_input index), errors)\n # TODO - element does not indicate its state # text_values_match?(test_term[CoreOrgData::TERM_PREF_FOR_LANGUAGE.name], element_value(org_term_pref_for_lang_input index), errors)\n text_values_match?(test_term[Org::MAIN_BODY_NAME.name], element_value(main_body_name_input index), errors)\n text_values_match?(test_term[Org::ADDITIONS_TO_NAME.name], element_value(addition_to_name_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE.name], element_value(org_term_source_name_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE_DETAIL.name], element_value(org_term_source_detail_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE_ID.name], element_value(org_term_source_id_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE_NOTE.name], element_value(org_term_source_note_input index), errors)\n end\n errors\n end",
"def check_conventions\n\tcheck_encoding\n\tcheck_yaml\n\tcheck_merge\n\tcheck_cucumber\n\tcheck_ruby\nend",
"def test_appellation_validity\n assert @valid_appellation_1.valid?\n assert @valid_appellation_2.valid?\n end",
"def verify_iss; end",
"def verify_iss; end",
"def validate\n check_syntax\n end",
"def validate\n \n \n end",
"def validate_code\n true\n end",
"def check\n \n end",
"def check\n \n end",
"def verify_functions(test_data)\n test_functions = test_data[Org::FUNCTIONS.name]\n errors = []\n test_functions = [{ Org::FUNCTION.name => ''}] unless test_functions\n test_functions.each_with_index do |test_function, index|\n text_values_match?(test_function[Org::FUNCTION.name], element_value(function_input(index)), errors)\n end\n errors\n end",
"def verify_foundation_place(test_data)\n errors = []\n text_values_match?(test_data[Org::FOUNDING_PLACE.name], element_value(foundation_place_input), errors)\n errors\n end",
"def corrector; end",
"def corrector; end",
"def corrector; end",
"def corrector; end",
"def verify_result()\n #puts \"{#@recode}\" \"return code\"\n #puts \"{#@expect_code}\" \"expect code\"\n # method to show object's type, include both basic type and class type.\n #puts @recode.class\n #puts @expect_code.class\n # to_i to interger\n # to_f to float\n # to_s to string\n \n if @recode == @expect_code.to_s\n @output.puts \"Verification Success\"\n puts \"Verification Success\"\n\n else\n @output.puts \"ERROR: Verification Failiure errorcode:\" + @recode + \" errormsg:\" + @remsg\n puts \"ERROR: Verification Failiure error code:\" + @recode + \" errormsg:\" + @remsg\n end\n\n end",
"def require_definition(identifier); end",
"def require_definition(identifier); end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def check_locations\n loc=0\n @compiled_definitions.each do |d|\n puts \"double-checking compiled location of #{d.definition.name}\" if Rake.verbose == true\n if d.definition.primitive?\n puts \"skipping primitive\" if Rake.verbose == true\n next\n end\n if loc != d.location\n raise \"unmatched location for '#{d.definition.name}': counted #{loc}, expected #{d.location}!\"\n end\n loc += d.code.length\n end\n end",
"def verify_types(test_data)\n test_types = test_data[Org::ORG_RECORD_TYPES.name]\n errors = []\n test_types = [{ Org::ORG_RECORD_TYPE.name => ''}] unless test_types\n test_types.each_with_index do |test_type, index|\n text_values_match?(test_type[Org::ORG_RECORD_TYPE.name], element_value(org_record_type_input(index)), errors)\n end\n errors\n end",
"def validate\r\n\r\n end",
"def check ; true ; end",
"def verify\n # nothing to do here, so just return\n end",
"def test_q11_b_c\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Number of permissions created is incorrect\"\n assert_equal 3, form_processor.permission_count, \"Permission count on processor is incorrect\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n end",
"def test_q11_b_ab\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def test_q11_b_a\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Number of permissions created is incorrect\"\n assert_equal 3, form_processor.permission_count, \"Permission count on processor is incorrect\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def precheck\n end",
"def verify#todo\n #if its a fault, then its a no for sure\n #otherwise make sure all the fields are the right type, and are initialized etc\n true\n end",
"def verification_flags; end",
"def test_q11_b_ac\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n end",
"def test_q11_b_bc\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n end",
"def test_q11_b_b\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_b] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Number of permissions created is incorrect\"\n assert_equal 3, form_processor.permission_count, \"Permission count on processor is incorrect\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def test_q11_b_all\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n end",
"def assert_def_equal(expected, str)\n assert_equal expected, cmd.parse_definition(outdent(str))\n end",
"def assert_def_equal(expected, str)\n assert_equal expected, cmd.parse_definition(outdent(str))\n end",
"def test_q11_b_none\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end",
"def validate\n\tvalidate_unexpected_assets_not_present && validate_expected_asset_present && validate_snippet_and_description\nend",
"def validation; end",
"def validation; end",
"def validate_gemspec; end",
"def validated; end",
"def literal_validation; end",
"def literal_validation; end",
"def test\n dict_list = make_list\n #make sure they're the same length\n if @word1.length != @word2.length\n puts \"Error: Words of different lengths\"\n false\n #make sure it is in the dictionary file\n elsif (!dict_list.include?(@word1)||!dict_list.include?(@word2))\n puts \"Error: Word does not exist\"\n false\n else\n true\n end\n end",
"def verify_signatures?; end",
"def test_validate_reason_code_with_valid_data\n reason_code1 = ReasonCode.new\n reason_code1.reason_code = \"RC.S-A_\"\n reason_code1.save\n assert reason_code1.valid?, reason_code1.errors.full_messages.to_s\n end",
"def check_integrity(tables, bits, asm_format, field_format)\n\n opcodes = {}\n\n tables.each{|name, tbl|\n\n tbl['list'] = tbl['table'].flatten\n tbl['list'].select {|x| islower(x[0]) }.each {|o|\n\n if (opcodes.include?(o))\n raise \"repeated opcode #{o} in table #{name}\"\n else\n opcodes[o] = 1\n end\n }\n }\n\n opcodes.each_key{|o|\n\n if (!bits.include?(o))\n raise \"opcode #{o} has no entry in bits file\"\n end\n\n if (!asm_format.include?(o))\n raise \"opcode #{o} has no entry in format file\"\n end\n }\n\n bits.each_key{|o|\n\n if (!opcodes.include?(o))\n raise \"unknown opcode #{o} in bits file\"\n end\n }\n\n ref_asm = {}\n\n asm_format.each{|o,args|\n\n if (!opcodes.include?(o))\n raise \"unknown opcode #{o} in asm_format file\"\n end\n\n args.each{|a|\n\n next if %w[( ) ,].include?(a)\n\n ref_asm[a] = 1\n\n if (!field_format.include?(a))\n raise \"asm format error #{o} #{a}\"\n end\n }\n }\n\n field_format.each_key{|o|\n\n if (!ref_asm.include?(o))\n raise \"unreferenced #{o} in field_format\"\n end\n }\nend",
"def valid; end",
"def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end",
"def verify_markup_options; end",
"def parse_def_file(filepath)\n\n $runParamsOpen = false; \n $runScopeOpen = false; \n $UpgradesOpen = false; \n \n $WildCardsInUse = false; \n \n rundefs = File.open(filepath, 'r') \n \n rundefs.each do | line |\n \n $defline = line\n $defline.strip! \n $defline.gsub!(/\\!.*$/, '')\n $defline.gsub!(/\\s*/, '')\n $defline.gsub!(/\\^/, '')\n \n if ( $defline !~ /^\\s*$/ ) \n\n case \n # Section star/end in the file \n when $defline.match(/RunParameters_START/i)\n $RunParamsOpen = true; \n \n when $defline.match(/RunParameters_END/i)\n $RunParamsOpen = false; \n \n when $defline.match(/RunScope_START/i)\n $RunScopeOpen = true; \n \n when $defline.match(/RunScope_END/i)\n $RunScopeOpen = false; \n \n when $defline.match(/Upgrades_START/i)\n $UpgradesOpen = true; \n \n when $defline.match(/Upgrades_END/i)\n $UpgradesOpen = false; \n \n else \n \n # definitions \n $token_values = Array.new\n $token_values = $defline.split(\"=\")\n \n\n \n if ( $RunParamsOpen && $token_values[0] =~ /archetype-dir/i ) \n # Where are our .h2k files located?\n \n $gArchetypeDir = $token_values[1] \n \n \n end\n \n \n if ( $RunParamsOpen && $token_values[0] =~ /run-mode/i ) \n # This does nothing only 'mesh' supported for now!!!\n $gRunDefMode = $token_values[1] \n \n if ( ! ( $gRunDefMode =~ /mesh/ || $gRunDefMode =~ /parametric/ ) ) then \n fatalerror (\" Run mode #{$gRunDefMode} is not supported!\") \n end \n \n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /rulesets/i ) \n # Rulesets that can be applied. \n $gRulesets = $token_values[1].to_s.split(\",\")\n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /archetypes/i ) \n \n # archetypes - \n $gArchetypes = $token_values[1].to_s.split(\",\")\n \n \n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /locations/i ) \n \n # locations - \n $gLocations = $token_values[1].to_s.split(\",\")\n \n end \n \n if ( $UpgradesOpen ) \n \n option = $token_values[0]\n choices = $token_values[1].to_s.split(\",\")\n \n debug_out \" #{option} len = #{choices.grep(/\\*/).length} \\n\" \n \n if ( choices.grep(/\\*/).length > 0 ) then \n \n $WildCardsInUse = true \n \n end \n \n $gRunUpgrades[option] = choices\n\n $gOptionList.push option \n \n \n end \n \n\n end #Case \n \n end # if ( $defline !~ /^\\s*$/ ) \n \n end # rundefs.each do | line |\n\n \n # Check to see if run options contians wildcards \n \n \n if ( $WildCardsInUse ) then \n \n if ( ! $gOptionFile =~ /\\.json/i ) then \n fatalerror (\"Wildcard matching is only supported with .json option files\") \n end \n \n fOPTIONS = File.new($gOptionFile, \"r\") \n if fOPTIONS == nil then\n fatalerror(\" Could not read #{filename}.\\n\")\n end\n \n $OptionsContents = fOPTIONS.read\n fOPTIONS.close \n \n $JSONRawOptions = JSON.parse($OptionsContents)\n $OptionsContents = nil\n \n $gRunUpgrades.keys.each do |key| \n debug_out( \" Wildcard search for #{key} => \\n\" )\n \n \n \n \n $gRunUpgrades[key].clone.each do |choice| \n \n debug_out (\" ? #{choice} \\n\") \n \n if ( choice =~ /\\*/ ) then \n \n $pattern = choice.gsub(/\\*/, \".*\") \n \n debug_out \" Wildcard matching on #{key}=#{$pattern}\\n\" \n \n # Matching \n \n $SuperSet = $JSONRawOptions[key][\"options\"].keys\n \n $gRunUpgrades[key].delete(choice) \n\n $gRunUpgrades[key].concat $SuperSet.grep(/#{$pattern}/)\n \n \n end \n \n end \n \n \n end \n \n $JSONRawOptions = nil \n \n end \n\n \n \n \n # What if archetypes are defined using a wildcard? \n \n \n \n \n \n\nend",
"def definition_line?(line)\n terms = line.split(' ')\n is_definition = terms.include?('class') || terms.include?('module')\n error_definition = line.include?('Error') || line.include?('Exception')\n is_definition && !error_definition\n end",
"def check_valid_codes(var, dump_file, *arg_code_pairs)\n if var.class == \"\".class\n var = getVariable(var)\n end\n\n if dump_file != \"\"\n if dump_file.class == \"\".class\n dump_file = open(dump_file, 'a')\n end\n end\n\n # Make the argument/code hash\n arg_code = Hash.new\n for i in 0...arg_code_pairs.length\n if i % 2 == 0\n if arg_code_pairs[i].class != \"\".class\n puts 'FATAL ERROR in argument/valid code array. Exiting. Please check to make sure it is in the format \"argumentname\", [\"valid\",\"codes\"]'\n exit\n end\n arg = arg_code_pairs[i]\n if [\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"].include?(arg[1].chr)\n arg = arg[1..arg.length]\n end\n arg = arg.gsub(/(\\W )+/,\"\").downcase\n\n arg_code[arg] = arg_code_pairs[i+1]\n end\n end\n\n errors = false\n for cell in var.cells\n for arg, code in arg_code\n val = eval \"cell.#{arg}\"\n if not code.include?(val)\n errors = true\n str = \"Code ERROR: Var: \" + var.name + \"\\tOrdinal: \" + cell.ordinal.to_s + \"\\tArg: \" + arg + \"\\tVal: \" + val + \"\\n\"\n print str\n if dump_file != \"\"\n dump_file.write(str)\n end\n end\n end\n end\n if not errors\n puts \"No errors found.\"\n end\nend",
"def test_existing_file\n assert verify_parameters(['verifier_tests.rb'])\n end",
"def validate(expectations, source, response)\n\t\texpectations.all? { |expectation|\n\t\t\tresponse[\"output\"].any? { |output| output.include? expectation.value }\n\t\t}\n\tend",
"def quick_verify!\n quick_verify or raise InvalidPackage, explain_error\n end",
"def can_code?(n)\n n[:languages].include?(\"Ruby\") || n[:languages].include?(\"Python\")#OR HE EXPLAINED IT AS : n[:languages].include?(\"Python\")\n #I want to make sure that it incliudes Ruby or python (or both/more)\nend",
"def verify(state) ; end",
"def check_marc; end",
"def test_one_leetcode\n str = 'leetcode'\n dictionary = [\"leet\",\"code\"]\n assert Validator.evaluate(str, dictionary)\n end",
"def test_define_item\n assert @definition.defines? :foo\n end",
"def is_valid?\n ((@original.reverse.chars.first.to_i == check_digit) && (gs1_prefix == '979') && @code.count == 13) || @code.count == 12\n end",
"def verify_iss=(_arg0); end",
"def verify_iss=(_arg0); end",
"def validate_definitions(lambda, defs, options)\n return unless options.force_deploy\n\n defs.each{|d|\n definition = d.def\n func = definition.func\n state = lambda.get_function_state(func)\n # haven't deployed this function yet\n next if state == LambdaAws::DOES_NOT_EXIST\n validate_state(state, definition)\n }\n end",
"def verify_source\n # subclasses must implement this method\n puts \"verify_source - not overloaded. file=#{filename}\"\n end",
"def verify_template\n verification_templates(main_only: true).each(&:verify)\n end",
"def test_exercise_113\n verify_method :exercise_113,\n :with => [{param: '1 2 3', expect: false},\n {param: '1 1 1', expect: true}]\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end",
"def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end",
"def validate_jurisdiction_definition(jurisdiction_definition)\n if (uids_exist?(\"jurisdiction\"))\n val_fatal(\"Pre-existing Jurisdiction UIDs\",\n self.uids[\"jurisdiction\"].keys.inspect)\n else\n uid_add(\"jurisdiction\", jurisdiction_definition[\"ident\"])\n end\n validate_precincts(jurisdiction_definition[\"precinct_list\"])\n validate_districts(jurisdiction_definition[\"district_list\"])\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def is_definition(exp)\n is_tagged_list(exp, 'define')\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end"
] |
[
"0.59838855",
"0.5980834",
"0.5912073",
"0.5912073",
"0.58902836",
"0.58552635",
"0.5796245",
"0.577791",
"0.5761025",
"0.5747396",
"0.57382065",
"0.5723976",
"0.57199097",
"0.566797",
"0.5651127",
"0.56187266",
"0.56187266",
"0.5617139",
"0.560949",
"0.5591947",
"0.5587925",
"0.5587925",
"0.55807203",
"0.554319",
"0.5538284",
"0.5538284",
"0.5538284",
"0.5538284",
"0.5506196",
"0.5456669",
"0.5456669",
"0.5444527",
"0.5444527",
"0.5444527",
"0.5444527",
"0.5439482",
"0.5416989",
"0.5414066",
"0.5407761",
"0.53828824",
"0.53808415",
"0.53733325",
"0.53723115",
"0.5368368",
"0.53600276",
"0.5351879",
"0.5346545",
"0.5330126",
"0.53279334",
"0.5325966",
"0.53186905",
"0.53186905",
"0.5318653",
"0.53183484",
"0.5302918",
"0.52902037",
"0.52902037",
"0.527106",
"0.5262563",
"0.5259809",
"0.5259809",
"0.525661",
"0.52552426",
"0.52463293",
"0.52412975",
"0.5234895",
"0.52332723",
"0.5222501",
"0.52147096",
"0.52086717",
"0.5189333",
"0.517328",
"0.516847",
"0.5166613",
"0.51655805",
"0.5160621",
"0.51384264",
"0.5135409",
"0.51273686",
"0.5122684",
"0.51192683",
"0.51192683",
"0.511318",
"0.5107714",
"0.5101155",
"0.5097738",
"0.5095664",
"0.5095664",
"0.5095664",
"0.509379",
"0.5085467",
"0.5085079",
"0.5084798",
"0.5084798",
"0.50821644",
"0.5081236",
"0.50797194",
"0.50789416",
"0.50707215",
"0.5069001",
"0.5064968"
] |
0.0
|
-1
|
human readable description of modeling approach
|
def modeler_description
return 'Find the exterior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high). Find the desing level and multiplier for each category of the exterior lighting definition. Apply the lighting upgrades by reducing the design level associated with each outdoor lighting category by a percent (depends on starting and target efficiency levels).'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end",
"def modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end",
"def modeler_description\n return 'shift or/and adjust heaing and cooling setpoint'\n end",
"def modeler_description\n return 'This model replaces the existing HVAC system with a VRF + DOAS system.'\n end",
"def modeler_description\n return \"This uses the OpenStudio::Model::Space::fromFloorPrint method, and is very much like the Create Spaaces From Diagram tool in the OpenStudio SketchUp plugin, but lets you draw teh diagram in the tool of your choice, and then imports it into the OpenStudio application via a measure.\"\n end",
"def modeler_description\n return 'This can be used in apply measure now, or can be used in a parametric workflow to load in any custom user profiles or floor/ceiling values.'\n end",
"def modeler_description\n return \"Any generators and electric load center distribution objects are removed. An electric load center distribution object is added with a track schedule equal to the hourly output from SAM. A micro turbine generator object is add to the electric load center distribution object. The fuel used to make the electricity is zeroed out.\"\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\r\n return \"For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.\"\r\n end",
"def modeler_description\n return 'Modify the cooling setpoint of the HVAC system during a DR event'\n end",
"def modeler_description\n return 'This a test measure in relation with https://github.com/NREL/OpenStudio/issues/4156'\n end",
"def modeler_description\n return \"When have existing OSM wanted to be able to grab geometry from model vs. trying to enter on website. This is useful when there is no built structures yet to use as reference on the website.\"\n end",
"def modeler_description\n return \"Grey water tank overflow will be dirrected to drainage. \"\n end",
"def modeler_description\n return \"NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.\"\n end",
"def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end",
"def description()\n\t\tself.namespaced_class(:ModelDescriptor).goal(self)\n\tend",
"def modeler_description\n 'NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.'\n end",
"def modeler_description\n return 'Not sure how I will handle arguments. Maybe lump together all spaces on same sotry that have the same multilier value. This will have variable number of arguments basd on the model pased in. Alternative is to either only allo w one group to be chosen at at time, or allow a comlex string that describes everything. Also need to see how to define shirting. There is an offset but it may be above and below and may not be equal. In Some cases a mid floor is halfway betwen floors which makes just copying the base surfaces as shading multiple times probemeatic, since there is overlap. It coudl be nice to stretch one surface over many stories. If I check for vertial adn orthogonal surface that may work fine. '\n end",
"def modeler_description\n return \"It does not even send anything related to the model. It just sends a simple pagkage at the end of every run, just to test if things really work.\"\n end",
"def modeler_description\n return ['Adds', 'the', 'properties', 'for', 'the', 'MoisturePenetrationDepthConductionTransferFunction', 'or', 'effective', 'moisture', 'penetration', 'depth', '(EMPD)', 'Heat', 'Balance', 'Model', 'with', 'inputs', 'for', 'penetration', 'depths.', \"\\n\\n\", 'Leaving', 'Change', 'heat', 'balance', 'algorithm?', 'blank', 'will', 'use', 'the', 'current', 'OpenStudio', 'heat', 'balance', 'algorithm', 'setting.', \"\\n\\n\", 'At', 'least', '1', 'interior', 'material', 'needs', 'to', 'have', 'moisture', 'penetration', 'depth', 'properties', 'set', 'to', 'use', 'the', 'EMPD', 'heat', 'balance', 'algorithm.'].join(' ')\n end",
"def modeler_description\n return \"Change water heater efficiency and fuel type.\"\n end",
"def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end",
"def modeler_description\n return 'For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.'\n end",
"def modeler_description\n return \"This measure will replicate the functionality described in the EnergyPlus Energy Management System Application Guide, Example 2., based on user input.\"\n end",
"def modeler_description\n return 'This measure assigns load and flow information to a selected plant loop load profile.'\n end",
"def modeler_description\n return \"This is intended to run on an empty model. It will create the proper model associate it with the proper weather file, and add in necessary output requests. Internally to the measure the test case argument will be mapped to the proper inputs needed to assemble the model. The measure will make some objects on the fly, other objects will be pulled from existing data resources. This measure creates cases described all of section 5.3.\"\n end",
"def modeler_description\n return \"Each DX cooling coil in the model is replaced by a membrane heat pump. To represent the membrane heat pump, the DX cooling coil COP is increased to 7.62 (26 EER). Additionally, add a water use equipment object to account for the 3 gallons of water used per ton*hr of sensible cooling process.\"\n end",
"def modeler_description\n 'For the most part consumption data comes from the tabular EnergyPlus results, however there are a few requests added for time series results. Space type and loop details come from the OpenStudio model. The code for this is modular, making it easy to use as a template for your own custom reports. The structure of the report uses bootstrap, and the graphs use dimple js.'\n end",
"def modeler_description\n return 'Adds typical refrigeration equipment to a building'\n end",
"def modeler_description\r\n return \"\"\r\n end",
"def modeler_description\n return \"E+ RESNET\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"A measure that will take Annual Building Utilty Performance tables, Demand End use Components summary table, Source Energy End Use Components Summary and produce an output Json\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as Warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return 'The goal of this measure is to create a single space type that represents the loads and schedules of a collection of space types in a model. When possible the measure will create mulitple load instances of a specific type in the resulting blended space type. This allows the original schedules to be used, and can allow for down stream EE measures on specific internal loads. Design Ventilation Outdoor Air objects will have to be merged into a single object. Will try to maintain the load design type (power, per area, per person) when possible. Need to account for zone multipliers when createding blended internal loads. Also address what happens to daylighting control objets. Original space types will be left in the model, some may still be assigned to spaces not included in the building area.'\n end",
"def modeler_description\n 'It will be used for calibration maximum flow rate, efficiency, pressure rise and motor efficiency. User can choose between a SINGLE Fan or ALL the Fans.'\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return 'This measure has optional arguments to apply recommendations from different sections of the Zero Energy Multifamily Design Guide.'\n end",
"def modeler_description\n 'It will be used for calibration of WaterHeaterMixed. User can choose between a SINGLE WaterHeaterMixed or ALL the WaterHeaterMixed objects.'\n end",
"def modeler_description\n return \"It will be used for calibration of inlet water temperatures, inlet and outlet air temperatures and design flowrates. User can choose between a SINGLE coil or ALL the Coils.\"\n end",
"def modeler_description\n return 'Change UrbanOpt Scenario CSV'\n end",
"def modeler_description\n return 'Calculate thermal capacitance and UA for surfaces, furniture, and spaces.'\n end",
"def modeler_description\n return 'Reports resilience metric(s) of interest.'\n end",
"def modeler_description\n return \"The default space types in the measure inputs are automatically filled by the spaces' standard space types. User can overwrite the default assumptions in the library.csv file in the measure's resources folder.\"\n end",
"def modeler_description\n return 'Find the interior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high, very high). Find the LPD and LPD fractions for each space type. Apply the lighting upgrades by reducing the LPD associated with compact lighting by a percent (depends on starting and target efficiency levels).'\n end",
"def modeler_description\n 'Run a simulation to autosize HVAC equipment and then apply these autosized values back to the model.'\n end",
"def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end",
"def modeler_description\n return 'This method calculates the annualized coefficient of performance (Btu out / Btu in) of equipment in the model from the annual simulation. This is used in Scout as the equipment efficiency for the technology competition categories.'\n end",
"def modeler_description\n return 'This will only impact schedule rulesets. It will use methods in openstudio-standards to infer hours of operation, develop a parametric formula for all of the ruleset schedules, alter the hours of operation inputs to that formula and then re-apply the schedules. Input is expose to set ramp frequency of the resulting schedules. If inputs are such that no changes are requested, bypass the measure with NA so that it will not be parameterized. An advanced option for this measure would be bool to use hours of operation from OSM schedule ruleset hours of operation instead of inferring from standards. This should allow different parts of the building to have different hours of operation in the seed model.'\n end",
"def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end",
"def modeler_description\n return \"Any supply components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. Any existing air/plant loops are also removed. A heating DX coil, cooling DX coil, electric supplemental heating coil, and an on/off supply fan are added to a unitary air loop. The unitary air loop is added to the supply inlet node of the air loop. This air loop is added to a branch for the living zone. A diffuser is added to the branch for the living zone as well as for the finished basement if it exists.\"\n end",
"def modeler_description\r\n return 'modify simulation timestep'\r\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects and associated schedule into the model.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Passes in all arguments from the options lookup, processes them, and then registers values to the runner to be used by other measures.'\n end",
"def modeler_description\n return 'Daylighting controls will physically add in daylighting controls to spaces in the building, while occupancy control will reduce lighting schedules by 10%.'\n end",
"def modeler_description\n return 'This measure is used to calibrate the BRICR baseline model.'\n end",
"def modeler_description\n return \"This EEM adds EMS logic to the model that actuates the infiltration, HVAC operation, cooling set point, and heating set point schedules. The measure first identifies the schedule HVAC stopping point by day of week (Saturday, Sunday, and Weekdays). Early HVAC system shutoff is determined entirely by the outdoor air temperature (OAT). If the OAT is less than or equal to 2C or greater than or equal to 18C, then no action is taken. The HVAC system is shut off one hour early when the OAT is between 12C and 18C. The HVAC system shut off time varies linearly with OAT from one hour to zero hours between 12C and 2C, and between 18C and 28C. AvailabilityManager:OptimumStart objects are inserted for each HVAC system in the model and use the AdaptiveASHRAE algorithm to dynamically adjust HVAC startup time each day.\"\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end",
"def modeler_description\n return \"Multipliers for LPD, EPD, and people densities.\"\n end",
"def modeler_description\n return \"This measure takes the user selected standards space type and sets the interior lighting and equipment load definitions subcategory to match the space type name. \"\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects into the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to override specified thermostat control logic and set alternate modes of operation. This EMS measure sets a specific (user defined) indoor VRF terminal unit to operate at a specific (user-defined) part load ratio, constrained by operate minimum and maximum outdoor temperature limits of the paired condenser unit. The main input objects that implement this example are the variable refrigerant flow actuators that control the VRF system and specific terminal unit. Note that the terminal unit PLR can be controlled without controlling the mode of the VRF condenser, however, the specific terminal unit will operate in whatever mode the existing operation control scheme chooses. This example program simply “sets” the operating mode and PLR, other more complex control algorithms can be developed by the user as needed\"\n end",
"def modeler_description\n return 'This measure swaps old cases with 2017 code compliant cases and more efficient ones.'\n end",
"def modeler_description\n return \"The example demonstrates the use of a thermostat schedule object as and EMS actuator object. The EMS program alters the scheduled values as a function of hour of day and day of week.\"\n end",
"def modeler_description\n 'This measure changes the Layer 0 properties of Thickness, Density, Thermal Absorptance, Solar Absorptance, Visible Absoptance, Thermal Conductivity, Specific Heat.'\n end",
"def modeler_description\n return \"The measure loops through the AirLoops associated with the model, and determines an occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent. The resulting occupancy schedule is applied to the airloop attribute for the availability schedule. The measure then loops through all thermal zones, examining if there are zone equipment objects attached. If there are one or more zone equipment object attached to the zone, a thermal zone occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent is generated. The schedule is then assigned to the availability schedule of the associated zone equipment. To prevent energy use by any corresponding plant loops, the pump control type attribute of Constant or Variable speed pump objects in the model are set to intermittent. The measure them adds heating and cooling unmet hours and Simplified ASHRAE Standard 55 warning reporting variable to each thermal zone. \"\n end",
"def modeler_description\r\n return \"This measure loops through the existing airloops, looking for loops that have a constant speed fan. (Note that if an object such as an AirloopHVAC:UnitarySystem is present in the model, that the measure will NOT identify that loop as either constant- or variable-speed, since the fan is located inside the UnitarySystem object.) The user can designate which constant-speed airloop they'd like to apply the measure to, or opt to apply the measure to all airloops. The measure then replaces the supply components on the airloop with an AirloopHVAC:UnitarySystem object. Any DX coils added to the UnitarySystem object are of the type CoilCoolingDXMultiSpeed / CoilHeatingDXMultiSpeed, with the number of stages set to either two or four, depending on user input. If the user opts for a gas furnace, an 80% efficient CoilHeatingGas object is added. Fan properties (pressure rise and total efficiency) are transferred automatically from the existing (but deleted) constant speed fan to the new variable-speed fan. Currently, this measure is only applicable to the Standalone Retail DOE Prototype building model, but it has been structured to facilitate expansion to other models with a minimum of effort.\"\r\n end",
"def modeler_description\n return \"The measure loops through the heating and cooling thermostat schedules associated each thermal zone. The existing heating and cooling schedules are cloned, and the all run period profiles are then modified by adding a +1.5 deg F shift to the all values of the cooling thermostat schedule and a -1.5 degree F shift to all values of the heating thermostat schedule. Design Day profiles are not modified. The modified thermostat schedules are then assigned to the thermal zone. For each Thermal Zone, ASHRAE 55 Thermal Comfort Warnings is also enabled. Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status output variables is also added to the model.\"\n end",
"def modeler_description\r\n return \"The Measure adds a Schedule Availability Manager to the Selected Plant Loop\"\r\n end",
"def modeler_description\n return 'Converts the OpenStudio model to vA3C JSON format and renders using Three.js, simulation data is applied to surfaces of the model'\n end",
"def make_and_model; end",
"def modeler_description\n return 'This energy efficiency measure (EEM) replaces all cooling tower objects in a model of the following types: (OS:CoolingTowerPerformanceCoolTools, OS:CoolingTowerPerformanceYorkCalc, OS:CoolingTowerSingleSpeed, OS:CoolingTowerTwoSpeed, or OS:CoolingTowerVariableSpeed) with a new OS:CoolingTower:VariableSpeed object. If an existing cooling tower is already configured for variable speed, the measure will inform the user. When replacing an existing tower object, the following values from the existing tower configuration will be reused: Design Inlet Air Wet Bulb Temp, Design Approach Temperature, Design Range Temperature, Design Water Flow Rate, Design Air Flow Rate, Design Fan Power, Fraction of Tower Capacity in the Free Convection Regime, Basin Heater Capacity, Basin Heater Setpoint Temperature, Basin Heater Operating Schedule, Number of Cells, Cell Control, Cell Minimum and Maximum Water Flow Rate Fractions and Sizing Factor. A performance curve relating fan power to tower airflow rates is used. The curve assumes the fan power ratio is directly proportional to the air flow rate ratio cubed. A Minimum Air Flow Rate Ratio of 20% will be set. To model minimal but realistic water consumption, the Evaporation Loss Mode for new Tower objects will be set to ?Saturated Exit? and Drift Loss Percent will be set to a value of 0.05% of the Design Water Flow. Blowdown water usage will be based on maintaining a Concentration Ratio of 3.0.'\n end",
"def modeler_description\n return 'Replaces exterior window constructions with a different construction from the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to investigate dynamic envelope technologies such as emulating thermochromic window performance using EMS actuators and control types. This measure will replace the construction description of a user-selected window based on the outside surface temperature of that window, evaluated at each timestep\"\n end",
"def modeler_description\n return \"This measure adds active or passive chilled beam units to selected conditioned thermal zones. In addition the user can select an existing air loop to serve active beams, or create a new Dual Wheel DOAS. Users can also select an existing chilled water loop to provide chilled water to beams, or create a new high temperature chiller water loop. Users are highly encouraged to review and modify the control strategies that this measure creates, such that it reflects their modeling scenario of interest.\"\n end",
"def modeler_description\n return \"The difference between actual spaces and effective spaces takes into account the zone multipliers. The goal was to get average floor area assuming that each space represents a room vs. a collection of rooms. This was used to help determine average space sizes of different space types from the prototype buildings. In some cases I had to manaually adjust for where a space didn't map to a single room.\"\n end",
"def modeler_description\n return \"Any heating components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. A boiler along with constant speed pump and water baseboard coils are added to a hot water plant loop.\"\n end",
"def modeler_description\n return 'Thermal zones will be named after the spac with a prefix added'\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.name} @relation_name=#{relation_name} @repository=#{self.class.repository}>\"\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.inspect} @name=#{name.inspect}>\"\n end",
"def modeler_description\n return \"Reduces runtime fraction of lights by user-specified amount during the user-specified time period (typically daytime). This is an attempt to represent the impact of using the light collected on the roof instead of electric lighting. This modeling approach does not capture the impact of using a PV cell to turn the IR spectrum of the captured light into electricity.\"\n end",
"def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end"
] |
[
"0.7709525",
"0.7614442",
"0.7592187",
"0.7401259",
"0.72999185",
"0.7295701",
"0.7278094",
"0.7190962",
"0.719084",
"0.719084",
"0.7099756",
"0.7096957",
"0.7061509",
"0.70443124",
"0.7042815",
"0.7039971",
"0.70394796",
"0.70316714",
"0.70253843",
"0.70177025",
"0.6986074",
"0.6979935",
"0.6949079",
"0.694122",
"0.6934992",
"0.6925869",
"0.69078314",
"0.69018614",
"0.68918335",
"0.6886642",
"0.6865295",
"0.68634737",
"0.6863034",
"0.6858679",
"0.6850372",
"0.6850372",
"0.6850372",
"0.6850372",
"0.6850372",
"0.6850372",
"0.6850372",
"0.68324554",
"0.68216956",
"0.6805515",
"0.6790661",
"0.67863274",
"0.67863274",
"0.67863274",
"0.67863274",
"0.67863274",
"0.67863274",
"0.67863274",
"0.6778351",
"0.6773749",
"0.6750412",
"0.6720624",
"0.6716119",
"0.6707411",
"0.67018443",
"0.66892225",
"0.66878414",
"0.66715044",
"0.6662106",
"0.66494966",
"0.66420275",
"0.66338664",
"0.66328686",
"0.66214895",
"0.66146255",
"0.66146255",
"0.6610029",
"0.65994054",
"0.6587694",
"0.6586788",
"0.65866035",
"0.6583386",
"0.6563384",
"0.6559525",
"0.65536445",
"0.6508629",
"0.649022",
"0.64754945",
"0.6466756",
"0.6462789",
"0.64494306",
"0.64436847",
"0.6438406",
"0.64321226",
"0.6431088",
"0.6425624",
"0.6420692",
"0.6420474",
"0.6418044",
"0.6415164",
"0.64083886",
"0.64063644",
"0.6405478",
"0.64044017",
"0.63998014",
"0.63691604"
] |
0.6723864
|
55
|
define the arguments that the user will input
|
def arguments(model)
args = OpenStudio::Measure::OSArgumentVector.new
# make choice argument for target_efficiency_level
choices = OpenStudio::StringVector.new
choices << 'Medium'
choices << 'High'
target_efficiency_level = OpenStudio::Measure::OSArgument.makeChoiceArgument('target_efficiency_level', choices, true)
target_efficiency_level.setDisplayName('Target Efficiency Level')
args << target_efficiency_level
return args
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end",
"def args(*) end",
"def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend",
"def args()\n #This is a stub, used for indexing\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for the variable name\n variable_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"variable_name\",true)\n variable_name.setDisplayName(\"Enter Variable Name.\")\n variable_name.setDescription(\"Valid values can be found in the eplusout.rdd file after a simulation is run.\")\n args << variable_name\n \n #make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Zone Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency.\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n\n #make an argument for the key_value\n key_value = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"key_value\",true)\n key_value.setDisplayName(\"Enter Key Name.\")\n key_value.setDescription(\"Enter * for all objects or the full name of a specific object to.\")\n key_value.setDefaultValue(\"*\")\n args << key_value\n \n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\n env.setDisplayName(\"availableEnvPeriods\")\n env.setDescription(\"availableEnvPeriods\")\n env.setDefaultValue(\"RUN PERIOD 1\")\n args << env\n \n return args\n end",
"def set_arguments (args)\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_name.setDescription('Valid values can be found in the eplusout.rdd file after a simulation is run.')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency.')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name.')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n env = OpenStudio::Measure::OSArgument.makeStringArgument('env', true)\n env.setDisplayName('availableEnvPeriods')\n env.setDescription('availableEnvPeriods')\n env.setDefaultValue('RUN PERIOD 1')\n args << env\n\n args\n end",
"def handle_arguments(args)\n if input_file.nil?\n print_usage\n true\n else\n args.help || args.version\n end\n end",
"def arguments=(_arg0); end",
"def command_line\r\n ARGV.each do |arg|\r\n if arg == \"instructions\"\r\n instructions\r\n elsif arg == \"calculator\"\r\n ask_for_digits\r\n else\r\n \r\n end\r\n end\r\n \r\n end",
"def prescreen_input(args)\n if ((args.nil?) || (args.empty?))\n ['-eq', Date.today.strftime('%Y-%m-%d')]\n elsif ((args.length == 1) && (args[0].is_date?))\n ['-eq', args[0]]\n else\n args\n end\nend",
"def varios_args(*args)\n puts \"Tamanho de args: #{args.size}\"\n args.each { |x| p x}\n end",
"def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # url of the city database\n city_db_url = OpenStudio::Measure::OSArgument.makeStringArgument('city_db_url', true)\n city_db_url.setDisplayName('City Database Url')\n city_db_url.setDescription('Url of the City Database')\n city_db_url.setDefaultValue('')\n args << city_db_url\n\n # project id to update\n project_id = OpenStudio::Measure::OSArgument.makeStringArgument('project_id', true)\n project_id.setDisplayName('Project ID')\n project_id.setDescription('Project ID to generate reports for.')\n project_id.setDefaultValue('0')\n args << project_id\n\n # datapoint id to update\n datapoint_id = OpenStudio::Measure::OSArgument.makeStringArgument('datapoint_id', true)\n datapoint_id.setDisplayName('Datapoint ID')\n datapoint_id.setDescription('Datapoint ID to generate reports for.')\n datapoint_id.setDefaultValue('0')\n args << datapoint_id\n\n return args\n end",
"def validate_args (args)\n\t# todo\nend",
"def args() return @args end",
"def input=(_arg0); end",
"def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end",
"def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end",
"def manage_args(*args)\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n user_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"user_name\",true)\n user_name.setDisplayName(\"What is your name?\")\n args << user_name\n\n #make an argument to add new space true/false\n add_space = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"add_space\",true)\n add_space.setDisplayName(\"Add a space to your model?\")\n add_space.setDefaultValue(true)\n args << add_space\n \n return args\n end",
"def greeting\n puts \"Hello, MTA rider! How can we help?\"\n puts \"please enter one of the following commands:\"\n puts \"lines / stops the_line / calculate Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"\n user_call, *user_args = gets.chomp\n user_args.to_s\n # user_args.split(\" \")\n # puts user_input\n\n if user_call == lines\n show_lines()\n elsif user_call == stops\n show_stops(user_args[0])\n elsif user_call == calculate\n if user_args.length < 4\n puts 'please enter \"Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"'\n puts 'or enter \"exit\" to return to the home screen' \n user_input = gets.chomp\n if user_input == \"exit\"\n greeting()\n end \n user_input = user_input.split(\" \")\n calculate(user_input[0], user_input[1], user_input[2], user_input[3])\n else\n calculate(user_args[0], user_args[1], user_args[2], user_args[3])\n end\n else\n \n end\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n\n\n # Make an argument for evap effectiveness\n input_csv_path = OpenStudio::Measure::OSArgument::makeStringArgument(\"input_csv_folder_path\",true)\n input_csv_path.setDisplayName(\"raw_data_input_folder_path\")\n input_csv_path.setDefaultValue(\"data_file\")\n args << input_csv_path\n\n test_numbers = OpenStudio::StringVector.new\n test_numbers << 'Test_3'\n test_numbers << 'Test_6'\n test_numbers << 'Test_8'\n \n test_names = OpenStudio::StringVector.new\n test_names << 'UA_test'\n test_names << 'Cooling_test'\n test_names << 'Plenum_test'\n\n test_selections = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('test_data',test_numbers,test_names,true)\n\n \n test_selections.setDisplayName(\"Experiment\")\n test_selections.setDefaultValue(\"Test_3\")\n args << test_selections\n\n \n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end",
"def arguments\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make choice argument for facade\r\n choices = OpenStudio::StringVector.new\r\n choices << \"MessagePack\"\r\n choices << \"CSV\"\r\n choices << \"Both\"\r\n output_format = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"output_format\", choices)\r\n output_format.setDisplayName(\"Output Format\")\r\n output_format.setDefaultValue(\"Both\")\r\n args << output_format\r\n\r\n args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\t\n #make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"afue\",true)\n afue.setDisplayName(\"Installed AFUE\")\n afue.setUnits(\"Btu/Btu\")\n afue.setDescription(\"The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.\")\n afue.setDefaultValue(1.0)\n args << afue\n\n #make an argument for entering furnace installed supply fan power\n fanpower = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"fan_power_installed\",true)\n fanpower.setDisplayName(\"Installed Supply Fan Power\")\n fanpower.setUnits(\"W/cfm\")\n fanpower.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.\")\n fanpower.setDefaultValue(0.5)\n args << fanpower\t\n\t\n #make a string argument for furnace heating output capacity\n furnacecap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n furnacecap.setDisplayName(\"Heating Capacity\")\n furnacecap.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n furnacecap.setUnits(\"kBtu/hr\")\n furnacecap.setDefaultValue(Constants.SizingAuto)\n args << furnacecap\n \n return args\n end",
"def greeting(args)\r\n greet = args[:greet] || \"Hi\"\r\n title = args[:title] || \"Citizen\"\r\n name = args[:name] \r\n puts \"#{greet} #{title} #{name}\"\r\nend",
"def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\t@args.each do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend",
"def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n \n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n \n # TODO: argument for subset of output meters\n \n return args\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"RunPeriod\"\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n arg.setDisplayName(\"Reporting Frequency\")\n arg.setDefaultValue(\"Hourly\")\n args << arg\n\n #make an argument for including optional output variables\n arg = OpenStudio::Measure::OSArgument::makeBoolArgument(\"inc_output_variables\", true)\n arg.setDisplayName(\"Include Output Variables\")\n arg.setDefaultValue(false)\n args << arg\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for entering furnace installed afue\n userdefined_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"userdefinedeff\",true)\n userdefined_eff.setDisplayName(\"Efficiency\")\n\tuserdefined_eff.setUnits(\"Btu/Btu\")\n\tuserdefined_eff.setDescription(\"The efficiency of the electric baseboard.\")\n userdefined_eff.setDefaultValue(1.0)\n args << userdefined_eff\n\n #make a choice argument for furnace heating output capacity\n cap_display_names = OpenStudio::StringVector.new\n cap_display_names << Constants.SizingAuto\n (5..150).step(5) do |kbtu|\n cap_display_names << \"#{kbtu} kBtu/hr\"\n end\n\n #make a string argument for furnace heating output capacity\n selected_baseboardcap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"selectedbaseboardcap\", cap_display_names, true)\n selected_baseboardcap.setDisplayName(\"Heating Output Capacity\")\n selected_baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << selected_baseboardcap\n\t\n return args\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for entering baseboard efficiency\n baseboardeff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"efficiency\",true)\n baseboardeff.setDisplayName(\"Efficiency\")\n baseboardeff.setUnits(\"Btu/Btu\")\n baseboardeff.setDescription(\"The efficiency of the electric baseboard.\")\n baseboardeff.setDefaultValue(1.0)\n args << baseboardeff\n\n #make a string argument for baseboard heating output capacity\n baseboardcap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n baseboardcap.setDisplayName(\"Heating Capacity\")\n baseboardcap.setDescription(\"The output heating capacity of the electric baseboard. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n baseboardcap.setUnits(\"kBtu/hr\")\n baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << baseboardcap\n\t\n return args\n end",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def check_inputs_g(args)\n raise TypeError, Ajaila::Messager.warning(\"Nothing to generate...\") if args == []\n raise TypeError, Ajaila::Messager.warning(\"Only miners, selectors, presenters supported\\n(ex. miner SomeMiner, selector SomeSelector,\\n presenter SomePresenter, table SomeTable)\") if KNOWN_INSTANCES.include?(args[0]) == false\n raise TypeError, Ajaila::Messager.warning(\"Your #{args[0]} needs a name!\") if args[1] == nil\n raise TypeError, Ajaila::Messager.warning(\"Wrong format of the #{args[0]} name (use only A-Z and a-z symbols)\") if args[1][/^[A-Z]+$/i] == nil\n return 0\n end",
"def arguments\n parser.arguments\n end",
"def valid_args(type)\n case type\n when 'search' then %i[q format addressdetails extratags namedetails viewbox bounded exclude_place_ids limit accept-language email]\n when 'reverse' then %i[format lat lon zoom addressdetails extratags namedetails accept-language email]\n else []\n end\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n id = OpenStudio::Measure::OSArgument.makeStringArgument('feature_id', false)\n id.setDisplayName('Feature unique identifier')\n id.setDefaultValue('1')\n args << id\n\n name = OpenStudio::Measure::OSArgument.makeStringArgument('feature_name', false)\n name.setDisplayName('Feature scenario specific name')\n name.setDefaultValue('name')\n args << name\n\n feature_type = OpenStudio::Measure::OSArgument.makeStringArgument('feature_type', false)\n feature_type.setDisplayName('URBANopt Feature Type')\n feature_type.setDefaultValue('Building')\n args << feature_type\n\n feature_location = OpenStudio::Measure::OSArgument.makeStringArgument('feature_location', false)\n feature_location.setDisplayName('URBANopt Feature Location')\n feature_location.setDefaultValue('0')\n args << feature_location\n\n # make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n # reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'BillingPeriod' # match it to utility bill object\n ## Utility report here to report the start and end for each fueltype\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDescription('The frequency at which to report timeseries output data.')\n reporting_frequency.setDefaultValue('Timestep')\n args << reporting_frequency\n\n return args\n end",
"def madlib_inputs\n print \"Enter a noun: \" \n noun = gets.chomp\n print \"Enter a verb: \" \n verb = gets.chomp\n print \"Enter an adjective: \" \n adjective = gets.chomp\n print \"Enter an adverb: \" \n adverb = gets.chomp\n madlib_line(noun, verb, adjective, adverb)\nend",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make a start date argument\n start_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"start_date\",true)\n start_date.setDisplayName(\"Start date\")\n args << start_date\n \n #make an end date argument\n end_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"end_date\",true)\n end_date.setDisplayName(\"End date\")\n args << end_date\n \n return args\n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def process_arguments\n # clean unsupport symbols, e.g. JieFang;\n # or error argument due to option typo, e.g. '-list' will put 'ist' into the array in this src.\n @support_newspapers = Array.new #TODO: move to elsewhere\n @support_newspapers << :XM\n @support_newspapers << :WHB\n @support_newspapers << :YZ\n # ATTENTION: command line input is an array of string, to be consistent, internally I use only symbol when using this symbol\n @options.newspapers = @options.newspapers.collect { | item | item.to_sym } & @support_newspapers\n \n if @options.newspapers.size == 0\n @support_newspapers.each do | sym |\n @options.newspapers << sym\n end\n end\n end",
"def args\n raw_args\n end",
"def argv; end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n code_choices = OpenStudio::StringVector.new \n code_choices << \"ASHRAE 90.1-2007\" \n code_choices << \"ASHRAE 90.1-2010\" \n energy_code = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('energy_code', code_choices, true)\n energy_code.setDisplayName(\"Code baseline\")\n energy_code.setDefaultValue(\"ASHRAE 90.1-2010\")\n args << energy_code\n \n #make an argument to add new space true/false\n leed_check = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"leed_check\",true)\n leed_check.setDisplayName(\"Perform typical LEED checks?\")\n leed_check.setDefaultValue(true)\n args << leed_check\n \n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \t\"os_object_type\"\t],\n [ \"weather_file_name\", \"STRING\", true, false, \"Weather File Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n #Default set for server weather folder.\n [ \"weather_directory\", \"STRING\", true, false, \"Weather Directory\", \"../../weather\", nil, nil, nil,\t nil\t\t\t\t\t]\n \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def inflamed _args\n \"inflamed _args;\" \n end",
"def more_options\n puts Rainbow(\"Specify your additional options for your search: 'release date', 'search history', or go back\").yellow.underline\n input = gets.chomp.downcase\n \n if input == \"release date\"\n option_release_date\n \n elsif input == \"search history\"\n game_history\n\n elsif input == \"go back\"\n continue_or_exit\n \n else \n puts \"Input not recognized please try again\"\n more_options\n end\n end",
"def cmd(options={})\n arguments\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure will require arguments, but at this time, they are not known\n geometry_profile = OpenStudio::Ruleset::OSArgument::makeStringArgument('geometry_profile', true)\n geometry_profile.setDefaultValue(\"{}\")\n os_model = OpenStudio::Ruleset::OSArgument::makeStringArgument('os_model', true)\n os_model.setDefaultValue('multi-model mode')\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id', true)\n user_id.setDefaultValue(\"00000000-0000-0000-0000-000000000000\")\n job_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('job_id', true)\n #job_id.setDefaultValue(SecureRandom.uuid.to_s)\n ashrae_climate_zone = OpenStudio::Ruleset::OSArgument::makeStringArgument('ashrae_climate_zone', false)\n ashrae_climate_zone.setDefaultValue(\"-1\")\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDefaultValue(\"BadDefaultType\")\n\n args << geometry_profile\n args << os_model\n args << user_id\n args << job_id\n args << ashrae_climate_zone\n args << building_type\n\n return args\n end",
"def user_input\n\tgets\nend",
"def input\n @input ||= args.dig(:input)\n end",
"def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # lat arg\n lat = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lat\", true)\n lat.setDisplayName(\"Latitude\")\n lat.setDefaultValue(39.7392000000)\n args << lat\n\n # long arg\n lon = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lon\", true)\n lon.setDisplayName(\"Longitude\")\n lon.setDefaultValue(-104.9903000000)\n args << lon\n\n return args\n end",
"def add args\n db = get_db\n if args.empty?\n print \"Enter a short summary: \"\n STDOUT.flush\n text = gets.chomp\n if text.empty?\n exit ERRCODE\n end\n else\n # if you add last arg as P1..P5, I'll update priority automatically\n if args.last =~ /P[1-5]/\n $default_priority = args.pop\n end\n text = args.join \" \"\n end\n # convert actual newline to C-a. slash n's are escapes so echo -e does not muck up.\n #atitle=$( echo \"$atitle\" | tr -cd '\\40-\\176' )\n text.tr! \"\\n\", '\u0001'\n title = text\n desc = nil\n if $prompt_desc\n # choice of vim or this XXX also how to store in case of error or abandon\n # and allow user to edit, so no retyping. This could be for mult fields\n message \"Enter a detailed description (. to exit): \"\n desc = Cmdapp.get_lines\n #message \"You entered #{desc}\"\n end\n type = $default_type || \"bug\"\n severity = $default_severity || \"normal\"\n status = $default_status || \"open\"\n priority = $default_priority || \"P3\"\n if $prompt_type\n type = Cmdapp._choice(\"Select type:\", %w[bug enhancement feature task] )\n #message \"You selected #{type}\"\n end\n if $prompt_priority\n #priority = Cmdapp._choice(\"Select priority:\", %w[normal critical moderate] )\n priority = ask_priority\n #message \"You selected #{severity}\"\n end\n if $prompt_severity\n severity = Cmdapp._choice(\"Select severity:\", %w[normal critical moderate] )\n #message \"You selected #{severity}\"\n end\n if $prompt_status\n status = Cmdapp._choice(\"Select status:\", %w[open started closed stopped canceled] )\n #message \"You selected #{status}\"\n end\n assigned_to = $default_assigned_to\n if $prompt_assigned_to\n message \"Assign to:\"\n #assigned_to = $stdin.gets.chomp\n assigned_to = Cmdapp._gets \"assigned_to\", \"assigned_to\", $default_assigned_to\n #message \"You selected #{assigned_to}\"\n end\n project = component = version = nil\n # project\n if $use_project\n project = Cmdapp.user_input('project', $prompt_project, nil, $valid_project, $default_project)\n end\n if $use_component\n component = Cmdapp.user_input('component', $prompt_component, nil, $valid_component, $default_component)\n end\n if $use_version\n version = Cmdapp.user_input('version', $prompt_version, nil, $valid_version, $default_version)\n end\n\n start_date = @now\n due_date = default_due_date\n comment_count = 0\n priority ||= \"P3\" \n description = desc\n fix = nil #\"Some long text\" \n #date_created = @now\n #date_modified = @now\n body = {}\n body[\"title\"]=title\n body[\"description\"]=description\n body[\"type\"]=type\n body[\"status\"]=status\n body[\"start_date\"]=start_date.to_s\n body[\"due_date\"]=due_date.to_s\n body[\"priority\"]=priority\n body[\"severity\"]=severity\n body[\"assigned_to\"]=assigned_to\n body[\"created_by\"] = $default_user\n # only insert if its wanted by user\n body[\"project\"]=project if $use_project\n body[\"component\"]=component if $use_component\n body[\"version\"]=version if $use_version\n\n rowid = db.table_insert_hash(\"bugs\", body)\n puts \"Issue #{rowid} created\"\n logid = db.sql_logs_insert rowid, \"create\", \"#{rowid} #{type}: #{title}\"\n body[\"id\"] = rowid\n mail_issue nil, body\n \n 0\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"Whole Building\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\t\t\n\n #Make a string argument for occupants (auto or number)\n num_occ = OpenStudio::Measure::OSArgument::makeStringArgument(\"num_occ\", false)\n num_occ.setDisplayName(\"Number of Occupants\")\n num_occ.setDescription(\"Specify the number of occupants. For a multifamily building, specify one value for all units or a comma-separated set of values (in the correct order) for each unit. A value of '#{Constants.Auto}' will calculate the average number of occupants from the number of bedrooms. Used to specify the internal gains from people only.\")\n num_occ.setDefaultValue(Constants.Auto)\n args << num_occ\n\n #Make a string argument for 24 weekday schedule values\n weekday_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekday_sch\", true)\n weekday_sch.setDisplayName(\"Weekday schedule\")\n weekday_sch.setDescription(\"Specify the 24-hour weekday schedule.\")\n weekday_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekday_sch\n \n #Make a string argument for 24 weekend schedule values\n weekend_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekend_sch\", true)\n weekend_sch.setDisplayName(\"Weekend schedule\")\n weekend_sch.setDescription(\"Specify the 24-hour weekend schedule.\")\n weekend_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekend_sch\n\n #Make a string argument for 12 monthly schedule values\n monthly_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"monthly_sch\", true)\n monthly_sch.setDisplayName(\"Month schedule\")\n monthly_sch.setDescription(\"Specify the 12-month schedule.\")\n monthly_sch.setDefaultValue(\"1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0\")\n args << monthly_sch\n\n return args\n end",
"def validate_arguments()\n usage unless ARGV.count > 0\nend",
"def input args\n if args.state.inputlist.length > 5\n args.state.inputlist.pop\n end\n\n should_process_special_move = (args.inputs.keyboard.key_down.j) ||\n (args.inputs.keyboard.key_down.k) ||\n (args.inputs.keyboard.key_down.a) ||\n (args.inputs.keyboard.key_down.d) ||\n (args.inputs.controller_one.key_down.y) ||\n (args.inputs.controller_one.key_down.x) ||\n (args.inputs.controller_one.key_down.left) ||\n (args.inputs.controller_one.key_down.right)\n\n if (should_process_special_move)\n if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"shield\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.inputlist[0] == \"forward-attack\") && ((args.state.tick_count - args.state.lastpush) <= 15)\n args.state.inputlist.unshift(\"dash-attack\")\n args.state.player.dx = 20\n elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)\n args.state.inputlist.unshift(\"back-attack\")\n elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)\n args.state.inputlist.unshift(\"forward-attack\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.player.y > 128)\n args.state.inputlist.unshift(\"dair\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"up-attack\")\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&\n (args.state.inputlist[0] == \"<\") &&\n ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.inputlist.unshift(\"<<\")\n args.state.player.dx = -15\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)\n args.state.inputlist.unshift(\"<\")\n args.state.timeleft = args.state.tick_count\n elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)\n args.state.inputlist.unshift(\">\")\n end\n\n args.state.lastpush = args.state.tick_count\n end\n\n if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.left # if left key is pressed\n if args.state.player.dx < -5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = -5\n end\n\n elsif args.inputs.right # if right key is pressed\n if args.state.player.dx > 5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = 5\n end\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\n\n if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.player.dx *= 0.95\n end\nend",
"def arguments(model = nil)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n chs = OpenStudio::StringVector.new\n chs << 'Last OSM'\n chs << 'Last IDF'\n file_source = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('file_source', chs, true)\n file_source.setDisplayName('Model Source')\n file_source.setDefaultValue('Last OSM')\n args << file_source\n\n chs = OpenStudio::StringVector.new\n chs << 'Timestep'\n chs << 'Hourly'\n reporting_frequency = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('reporting_frequency', chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n variable1_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable1_name', true)\n variable1_name.setDisplayName('Variable 1 Name')\n variable1_name.setDefaultValue('Surface Outside Face Temperature')\n args << variable1_name\n\n variable2_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable2_name', true)\n variable2_name.setDisplayName('Variable 2 Name')\n variable2_name.setDefaultValue('Surface Inside Face Temperature')\n args << variable2_name\n\n variable3_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable3_name', true)\n variable3_name.setDisplayName('Variable 3 Name')\n variable3_name.setDefaultValue('Zone Mean Radiant Temperature')\n args << variable3_name\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Create a list of the names and handles of space types\n # used in the building.\n used_space_type_handles = OpenStudio::StringVector.new\n used_space_type_names = OpenStudio::StringVector.new\n model.getSpaceTypes.sort.each do |space_type|\n if space_type.spaces.size > 0 # only show space types used in the building\n used_space_type_handles << space_type.handle.to_s\n used_space_type_names << space_type.name.to_s\n end\n end\n\t\n # Make an argument for plenum space type\n ceiling_return_plenum_space_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"ceiling_return_plenum_space_type\", used_space_type_handles, used_space_type_names,false)\n ceiling_return_plenum_space_type.setDisplayName(\"This space type should be part of a ceiling return air plenum.\")\n args << ceiling_return_plenum_space_type\n\t\n # Make a bool argument to edit/not edit each space type\n\t\tmodel.getSpaceTypes.sort.each do |space_type|\n\t\t\tif space_type.spaces.size > 0 # only show space types used in the building\n\t\t\t\tspace_type_to_edit = OpenStudio::Ruleset::OSArgument::makeBoolArgument(space_type.name.get.to_s,false)\n\t\t\t\t# Make a bool argument for this space type\n\t\t\t\tspace_type_to_edit.setDisplayName(\"Add #{space_type.name.get} space type to GSHP system?\")\n\t\t\t\tspace_type_to_edit.setDefaultValue(false)\t\t\n\t\t\t\targs << space_type_to_edit\n\t\t\tend\n\t\tend\n\t \n\t\t# Heating COP of GSHP\n\t\tgshp_htg_cop = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_htg_cop\",false)\n\t\tgshp_htg_cop.setDisplayName(\"GSHP DX Heating Coil Heating COP\")\n\t\tgshp_htg_cop.setDefaultValue(4.0)\n\t\targs << gshp_htg_cop\n\t\t\n\t\t# Cooling EER of GSHP\n\t\tgshp_clg_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_clg_eer\",false)\n\t\tgshp_clg_eer.setDisplayName(\"GSHP DX Cooling Coil Cooling EER\")\n\t\tgshp_clg_eer.setDefaultValue(14)\n\t\targs << gshp_clg_eer\n\t\t\n\t\t# GSHP Fan Type PSC or ECM\n\t\tfan_choices = OpenStudio::StringVector.new\n\t\tfan_choices << \"PSC\"\n\t\tfan_choices << \"ECM\"\n\t\tgshp_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"gshp_fan_type\",fan_choices,true) # note ECM fan type may correspond to different set of heat pump performance curves\n\t\tgshp_fan_type.setDisplayName(\"GSHP Fan Type: PSC or ECM?\")\n\t\tgshp_fan_type.setDefaultValue(\"PSC\")\n args << gshp_fan_type\n\t\t\n\t\t# Condenser Loop Cooling Temperature\n\t\t# condLoopCoolingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopCoolingTemp\",false)\n\t\t# condLoopCoolingTemp.setDisplayName(\"Condenser Loop Cooling Temperature (F)\")\n\t\t# condLoopCoolingTemp.setDefaultValue(90)\n\t\t# args << condLoopCoolingTemp\n\t\t\n\t\t# Condenser Loop Heating Temperature\n\t\t# condLoopHeatingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopHeatingTemp\",false)\n\t\t# condLoopHeatingTemp.setDisplayName(\"Condenser Loop Heating Temperature (F)\")\n\t\t# condLoopHeatingTemp.setDefaultValue(60)\t\n\t\t# args << condLoopHeatingTemp\n\t\t\n\t\t# Vertical Bore HX\n\t\tbuilding_area = model.getBuilding.floorArea \n\t\tbuilding_cool_ton = building_area*10.7639/500\t\t# 500sf/ton estimated\n\t\tbore_hole_no = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"bore_hole_no\",false)\n\t\tbore_hole_no.setDisplayName(\"Number of Bore Holes\")\n\t\tbore_hole_no.setDefaultValue(building_cool_ton.to_i) \n\t\targs << bore_hole_no\n\n\t\t\n\t\tbore_hole_length = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_length\",false)\n\t\tbore_hole_length.setDisplayName(\"Bore Hole Length (ft)\")\n\t\tbore_hole_length.setDefaultValue(200)\n\t\targs << bore_hole_length\n\n\t\tbore_hole_radius = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_radius\",false)\n\t\tbore_hole_radius.setDisplayName(\"Bore Hole Radius (inch)\")\n\t\tbore_hole_radius.setDefaultValue(6.0)\n\t\targs << bore_hole_radius\n\t\t\n\t\tground_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ground_k_value\",false)\n\t\tground_k_value.setDisplayName(\"Ground Conductivity (Btu/hr.F.R\")\n\t\tground_k_value.setDefaultValue(0.75)\n\t\targs << ground_k_value\n\t\t\n\t\tgrout_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"grout_k_value\",false)\n\t\tgrout_k_value.setDisplayName(\"Grout Conductivity (Btu/hr.F.R\")\n\t\tgrout_k_value.setDefaultValue(0.75)\n\t\targs << grout_k_value\n\t\t\n\t\tchs = OpenStudio::StringVector.new\n\t\tchs << \"Yes\"\n\t\tchs << \"No\"\n\t\tsupplemental_boiler = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"supplemental_boiler\",chs, true)\n\t\tsupplemental_boiler.setDisplayName(\"Supplemental Heating Boiler?\")\n\t\tsupplemental_boiler.setDefaultValue(\"No\")\n\t\targs << supplemental_boiler\n\t\t\n\t\t# Boiler Capacity\n\t\tboiler_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_cap\",false)\n\t\tboiler_cap.setDisplayName(\"boiler normal capacity (MBtuh)\")\n\t\tboiler_cap.setDefaultValue(500.0)\n\t\targs << boiler_cap\n\t\t\t\t\n\t\t# Boiler Efficiency\n\t\tboiler_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_eff\",false)\n\t\tboiler_eff.setDisplayName(\"Boiler Thermal Efficiency\")\n\t\tboiler_eff.setDefaultValue(0.9)\n\t\targs << boiler_eff\n\t\t\n\t\t# Boiler fuel Type\n\t\tfuel_choices = OpenStudio::StringVector.new\n\t\tfuel_choices << \"NaturalGas\"\n\t\tfuel_choices << \"PropaneGas\"\n\t\tfuel_choices << \"FuelOil#1\"\n\t\tfuel_choices << \"FuelOil#2\"\n\t\tfuel_choices << \"Electricity\"\n\t\tboiler_fuel_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"boiler_fuel_type\",fuel_choices,false) \n\t\tboiler_fuel_type.setDisplayName(\"Boiler Fuel Type\")\n\t\tboiler_fuel_type.setDefaultValue(\"NaturalGas\")\n\t\targs << boiler_fuel_type\n\t\t\n\t\t# boiler Hot water supply temperature\n\t\tboiler_hw_st = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_hw_st\",false)\n\t\tboiler_hw_st.setDisplayName(\"Boiler Design Heating Water Outlet Temperature (F)\")\n\t\tboiler_hw_st.setDefaultValue(120)\t\n\t\targs << boiler_hw_st\n\t\t\n\t\t# DOAS Fan Type\n\t\tdoas_fan_choices = OpenStudio::StringVector.new\n\t\tdoas_fan_choices << \"Constant\"\n\t\tdoas_fan_choices << \"Variable\"\n\t\tdoas_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_fan_type\",doas_fan_choices,true)\n\t\tdoas_fan_type.setDisplayName(\"DOAS Fan Flow Control - Variable means DCV controls\")\n\t\tdoas_fan_type.setDefaultValue(\"Variable\")\n\t\targs << doas_fan_type\n\t\t\n\t\t# DOAS Energy Recovery\n\t\terv_choices = OpenStudio::StringVector.new\n\t\terv_choices << \"plate w/o economizer lockout\"\n\t\terv_choices << \"plate w/ economizer lockout\"\n\t\terv_choices << \"rotary wheel w/o economizer lockout\"\n\t\terv_choices << \"rotary wheel w/ economizer lockout\"\n\t\terv_choices << \"none\"\n\t\tdoas_erv = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_erv\",erv_choices,true)\n\t\tdoas_erv.setDisplayName(\"DOAS Energy Recovery?\")\n\t\tdoas_erv.setDefaultValue(\"none\")\n\t\targs << doas_erv\n\t\t\n\t\t# DOAS Evaporative Cooling\n\t\tevap_choices = OpenStudio::StringVector.new\n\t\tevap_choices << \"Direct Evaporative Cooler\"\n\t\tevap_choices << \"none\"\n\t\tdoas_evap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_evap\",evap_choices,true)\n\t\tdoas_evap.setDisplayName(\"DOAS Direct Evaporative Cooling?\")\n\t\tdoas_evap.setDefaultValue(\"none\")\n\t\targs << doas_evap\n\t\t\n\t\t# DOAS DX Cooling\n\t\tdoas_dx_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"doas_dx_eer\",false)\n\t\tdoas_dx_eer.setDisplayName(\"DOAS DX Cooling EER\")\n\t\tdoas_dx_eer.setDefaultValue(10.0)\n\t\targs << doas_dx_eer\n\t\n # make an argument for material and installation cost\n # todo - I would like to split the costing out to the air loops weighted by area of building served vs. just sticking it on the building\n cost_total_hvac_system = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cost_total_hvac_system\",true)\n cost_total_hvac_system.setDisplayName(\"Total Cost for HVAC System ($).\")\n cost_total_hvac_system.setDefaultValue(0.0)\n args << cost_total_hvac_system\n \n #make an argument to remove existing costs\n remake_schedules = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"remake_schedules\",true)\n remake_schedules.setDisplayName(\"Apply recommended availability and ventilation schedules for air handlers?\")\n remake_schedules.setDefaultValue(true)\n args << remake_schedules\n\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n stp = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"stp\", true)\r\n stp.setDisplayName(\"Timeseries Timestep\")\r\n stp.setDescription(\"Timeseries Timestep\")\r\n stp.setDefaultValue(\"Zone Timestep\")\r\n args << stp\r\n \r\n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\r\n env.setDisplayName(\"availableEnvPeriods\")\r\n env.setDescription(\"availableEnvPeriods\")\r\n env.setDefaultValue(\"RUN PERIOD 1\")\r\n args << env\r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n scale = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"scale\", true)\r\n scale.setDisplayName(\"scale factor to apply to the difference\")\r\n scale.setDescription(\"scale factor to apply to the difference\")\r\n scale.setDefaultValue(1)\r\n args << scale \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n \r\n algorithm_download = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"algorithm_download\", true)\r\n algorithm_download.setDisplayName(\"algorithm_download\")\r\n algorithm_download.setDescription(\"algorithm_download\")\r\n algorithm_download.setDefaultValue(false)\r\n args << algorithm_download \r\n \r\n plot_flag = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"plot_flag\", true)\r\n plot_flag.setDisplayName(\"plot_flag timeseries data\")\r\n plot_flag.setDescription(\"plot_flag timeseries data\")\r\n plot_flag.setDefaultValue(true)\r\n args << plot_flag\r\n \r\n plot_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"plot_name\", true)\r\n plot_name.setDisplayName(\"Plot name\")\r\n plot_name.setDescription(\"Plot name\")\r\n plot_name.setDefaultValue(\"\")\r\n args << plot_name\r\n \r\n warning_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"warning_messages\", true)\r\n warning_messages.setDisplayName(\"warning_messages\")\r\n warning_messages.setDescription(\"warning_messages\")\r\n warning_messages.setDefaultValue(false)\r\n args << warning_messages\r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # the name of the space to add to the model\n setpoint = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"setpoint_temperature\", true)\n setpoint.setUnits(\"Degrees Celsius\")\n setpoint.setDisplayName(\"Ambient Loop Temperature\")\n setpoint.setDefaultValue(20)\n setpoint.setDescription(\"Temperature setpoint for the ambient loop\")\n args << setpoint\n\n delta = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"design_delta\", true)\n delta.setUnits(\"Delta Temperature\")\n delta.setDefaultValue(5.55) # 10 Deg F default delta\n delta.setDisplayName(\"Delta Design Loop Temperature\")\n delta.setDescription(\"Delta design temperature for the ambient loop\")\n args << delta\n\n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end",
"def print_two_again(arg1, arg2) # Non-variable list of inputs it will accept\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def commander _args\n \"commander _args;\" \n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for furnace fuel type\n fuel_display_names = OpenStudio::StringVector.new\n fuel_display_names << Constants.FuelTypeGas\n fuel_display_names << Constants.FuelTypeOil\n fuel_display_names << Constants.FuelTypePropane\n fuel_display_names << Constants.FuelTypeElectric\n fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('fuel_type', fuel_display_names, true)\n fuel_type.setDisplayName('Fuel Type')\n fuel_type.setDescription('Type of fuel used for heating.')\n fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << fuel_type\n\n # make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument('afue', true)\n afue.setDisplayName('Installed AFUE')\n afue.setUnits('Btu/Btu')\n afue.setDescription('The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.')\n afue.setDefaultValue(0.78)\n args << afue\n\n # make an argument for entering furnace installed supply fan power\n fan_power_installed = OpenStudio::Measure::OSArgument::makeDoubleArgument('fan_power_installed', true)\n fan_power_installed.setDisplayName('Installed Supply Fan Power')\n fan_power_installed.setUnits('W/cfm')\n fan_power_installed.setDescription('Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.')\n fan_power_installed.setDefaultValue(0.5)\n args << fan_power_installed\n\n # make a string argument for furnace heating output capacity\n capacity = OpenStudio::Measure::OSArgument::makeStringArgument('capacity', true)\n capacity.setDisplayName('Heating Capacity')\n capacity.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n capacity.setUnits('kBtu/hr')\n capacity.setDefaultValue(Constants.SizingAuto)\n args << capacity\n\n # make a string argument for distribution system efficiency\n dse = OpenStudio::Measure::OSArgument::makeStringArgument('dse', true)\n dse.setDisplayName('Distribution System Efficiency')\n dse.setDescription('Defines the energy losses associated with the delivery of energy from the equipment to the source of the load.')\n dse.setDefaultValue('NA')\n args << dse\n\n # make a bool argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument('has_hvac_flue', true)\n has_hvac_flue.setDisplayName('Air Leakage: Has Open HVAC Flue')\n has_hvac_flue.setDescription('Specifies whether the building has an open flue associated with the HVAC system.')\n has_hvac_flue.setDefaultValue(true)\n args << has_hvac_flue\n\n return args\n end",
"def args\n @args\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end",
"def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n \t#Make a string argument for 24 weekday cooling set point values\n clg_wkdy = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wkdy\", false)\n clg_wkdy.setDisplayName(\"Weekday Setpoint\")\n clg_wkdy.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekdays.\")\n clg_wkdy.setUnits(\"degrees F\")\n clg_wkdy.setDefaultValue(\"76\")\n args << clg_wkdy \n \n \t#Make a string argument for 24 weekend cooling set point values\n clg_wked = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wked\", false)\n clg_wked.setDisplayName(\"Weekend Setpoint\")\n clg_wked.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekend.\")\n clg_wked.setUnits(\"degrees F\")\n clg_wked.setDefaultValue(\"76\")\n args << clg_wked\t\n\t\n return args\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n # this measure does not require any user arguments, return an empty list\n return args\n end"
] |
[
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.68296087",
"0.6826596",
"0.67602986",
"0.67480284",
"0.6589929",
"0.6581451",
"0.6579882",
"0.65468127",
"0.6503042",
"0.647451",
"0.64706385",
"0.64699155",
"0.6469245",
"0.64641875",
"0.64103556",
"0.6389132",
"0.637863",
"0.6374086",
"0.6373223",
"0.63639134",
"0.6358853",
"0.6347805",
"0.63475585",
"0.63470906",
"0.6329135",
"0.63280094",
"0.62932867",
"0.6289945",
"0.6271416",
"0.6257277",
"0.6257238",
"0.6239814",
"0.6235555",
"0.62354916",
"0.6221531",
"0.6221531",
"0.6221531",
"0.62026656",
"0.61958784",
"0.61795026",
"0.61696565",
"0.6168981",
"0.6167551",
"0.6165484",
"0.6161183",
"0.6146112",
"0.6128867",
"0.611614",
"0.6099537",
"0.609091",
"0.608763",
"0.6082464",
"0.60754794",
"0.6075173",
"0.60703015",
"0.6069249",
"0.6053929",
"0.60461015",
"0.6037139",
"0.6037139",
"0.603555",
"0.6028014",
"0.60276234",
"0.6026254",
"0.6021278",
"0.6006005",
"0.60050625",
"0.60002536",
"0.5998068",
"0.5990844",
"0.5986098",
"0.59826887",
"0.59739846",
"0.59692407",
"0.59684443",
"0.5966365",
"0.59595567"
] |
0.0
|
-1
|
define what happens when the measure is run
|
def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end
# get arguments
target_efficiency_level = runner.getStringArgumentValue('target_efficiency_level', user_arguments)
# get interior lighting template for model to determine starting efficiency level
properties = model.getBuilding.additionalProperties
ext_lighting_template = properties.getFeatureAsString('exterior_lighting_template').to_s
case ext_lighting_template
when 'DOE Ref Pre-1980', 'DOE Ref 1980-2004', 'ComStock DOE Ref Pre-1980', 'ComStock DOE Ref 1980-2004'
starting_efficiency_level = 'Very Low'
old_large_fixture_type = 'Metal Halide Fixture (458W)'
old_large_fixture_w = 458.0
old_small_fixture_type = 'Incandescent Fixture (114W)'
old_small_fixture_w = 114.0
when '90.1-2004', '90.1-2007', 'ComStock 90.1-2004', 'ComStock 90.1-2007'
starting_efficiency_level = 'Low'
old_large_fixture_type = 'Metal Halide Fixture (458W)'
old_large_fixture_w = 458.0
old_small_fixture_type = 'Halogen Fixture (82W)'
old_small_fixture_w = 82.0
when '90.1-2010', '90.1-2013', 'ComStock 90.1-2010', 'ComStock 90.1-2013'
starting_efficiency_level = 'Medium'
old_large_fixture_type = 'Pulse Start Metal Halide Fixture (365W)'
old_large_fixture_w = 365.0
old_small_fixture_type = 'CFL Fixture (28W)'
old_small_fixture_w = 28.0
else
runner.registerError("interior_lighting_template '#{ext_lighting_template}' not recognized")
return false
end
runner.registerInitialCondition("Starting efficiency level is '#{starting_efficiency_level}' and target efficiency level is '#{target_efficiency_level}'.")
# determine if the target efficiency level exceeds the starting efficiency level
case target_efficiency_level
when 'Medium'
new_large_fixture_type = 'Pulse Start Metal Halide Fixture (365W)'
new_large_fixture_w = 365.0
new_small_fixture_type = 'CFL Fixture (28W)'
new_small_fixture_w = 28.0
when 'High'
new_large_fixture_type = 'LED Fixture (220W)'
new_large_fixture_w = 220.0
new_small_fixture_type = 'LED Fixture (20W)'
new_small_fixture_w = 20.0
end
if old_small_fixture_w <= new_small_fixture_w
runner.registerAsNotApplicable("The target efficiency level '#{target_efficiency_level}' is the same or lower than the starting efficiency level '#{starting_efficiency_level}' in the model. Lighting upgrade is not applicable.")
return false
end
runner.registerInitialCondition("Starting efficiency level is '#{starting_efficiency_level}' and target efficiency level is '#{target_efficiency_level}'.")
# make variable to track total number of fixtures changed when looping through space types
total_num_large_fixtures_changed = 0
total_num_small_fixtures_changed = 0
# loop through exterior lights definitions and get design level and multiplier
model.getFacility.exteriorLights.each do |ext_lights|
old_design_level = ext_lights.exteriorLightsDefinition.designLevel
multiplier = ext_lights.multiplier
next if multiplier.zero?
lighting_power_w = old_design_level * multiplier
# determine old and new bulbs by separate exterior lighting categories by units
if ['Parking Areas and Drives'].include?(ext_lights.name.to_s)
old_fixture_type = old_large_fixture_type
old_fixture_w = old_large_fixture_w
new_fixture_type = new_large_fixture_type
new_fixture_w = new_large_fixture_w
fixture_class = 'large'
elsif ['Building Facades', 'Entry Canopies', 'Emergency Canopies', 'Main Entries', 'Other Doors', 'Drive Through Windows'].include?(ext_lights.name.to_s)
old_fixture_type = old_small_fixture_type
old_fixture_w = old_small_fixture_w
new_fixture_type = new_small_fixture_type
new_fixture_w = new_small_fixture_w
fixture_class = 'small'
else
runner.registerWarning("Exterior lights '#{ext_lights.name}' is not a recognized exterior lighting type. Cannot determine if large or small fixture.")
next
end
# calculate power reduction
num_fixtures = (lighting_power_w / old_fixture_w).ceil
total_num_large_fixtures_changed += num_fixtures if fixture_class == 'large'
total_num_small_fixtures_changed += num_fixtures if fixture_class == 'small'
reduction_fraction = (old_fixture_w - new_fixture_w) / old_fixture_w
new_design_level = old_design_level * (1 - reduction_fraction)
ext_lights.exteriorLightsDefinition.setDesignLevel(new_design_level)
runner.registerInfo("For '#{ext_lights.name}' exterior lighting, #{num_fixtures} fixtures were changed from #{old_fixture_type} to #{new_fixture_type}. The exterior lighting design level for #{ext_lights.name} was reduced from #{old_design_level.round(4)} to #{new_design_level.round(4)}.")
end
runner.registerValue('light_outdoor_num_large_fixtures_changed', total_num_large_fixtures_changed)
runner.registerValue('light_outdoor_num_small_fixtures_changed', total_num_small_fixtures_changed)
runner.registerFinalCondition("A total of #{total_num_large_fixtures_changed} large and #{total_num_small_fixtures_changed} small outdoor fixtures and were upgraded.")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def measure\n Measure.new(1, self)\n end",
"def measurement(n)\n @options[:before_hook].call(n)\n measure = measure(n, &@options[:fn])\n @options[:after_hook].call(n)\n measure\n end",
"def measure\n Measure.new(@counter+=1)\n end",
"def communicate_measure_result(_ = nil, _ = nil)\r\n end",
"def benchmark\nend",
"def calculated; end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def run()\n\t\tputs \"#{@name} ran for #{@meters} meters in #{self.getTimeLapse} seconds\"\n\t\t# chiama funzione per stampare quante volte ha respirato\n\t\tself.breathe\n\tend",
"def runs; end",
"def statistics; end",
"def medical_use; end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if call_measurement_enabled? && above_threshold?\n self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0)\n end\n\n retval\n end",
"def stats; end",
"def stats; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n\n \n \n # Check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n # Find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n\n # Make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n # Copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n new_sch.setName(\"#{new_sch.name.get} with occ sensor\")\n # Reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n end\n \n # Replace the old schedules with the new, reduced schedules\n spaces_sensors_added_to = []\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n \n # Report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the building.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Added occupancy sensors to #{num_sensors_added} spaces in the building.\")\n\n return true\n\n end",
"def run\n\t\t\tsummary\n\t\tend",
"def quick_stats\n\tend",
"def stats\n \n end",
"def benchmark(reporter); end",
"def stats\n end",
"def stats\n end",
"def measure(name, &block)\n if self.running? name\n yield\n else\n result = nil\n self.results[name] ||= 0\n self.running << name\n self.results[name] += Benchmark.measure{result = yield}.real\n self.running.delete(name)\n result\n end\n end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if above_threshold?\n self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)\n end\n\n retval\n end",
"def measure_code(model,runner)\n measure_folder = \"#{File.dirname(__FILE__)}/\"\n baseline_spreadsheet = \"#{File.dirname(__FILE__)}/baseline.csv\"\n #Note: place output folder locally to run faster! (e.g. your C drive)\n output_folder = \"#{File.dirname(__FILE__)}/tests/output\"\n create_models = true\n simulate_models = true\n create_annual_outputs = true\n create_hourly_outputs = true\n #This creates the measures object and collects all the csv information for the\n # measure_id variant.\n csv_measures = BTAP::Measures::CSV_OS_Measures.new(\n baseline_spreadsheet,\n measure_folder#script root folder where all the csv relative paths are used.\n )\n csv_measures.create_cold_lake_vintages(output_folder) unless create_models == false\n BTAP::SimManager::simulate_all_files_in_folder(output_folder) unless simulate_models == false\n BTAP::Reporting::get_all_annual_results_from_runmanger(output_folder) unless create_annual_outputs == false\n #convert eso to csv then create terminus file.\n BTAP::FileIO::convert_all_eso_to_csv(output_folder, output_folder).each {|csvfile| BTAP::FileIO::terminus_hourly_output(csvfile)} unless create_hourly_outputs == false\n\n end",
"def cpu_metrics\n super\n end",
"def instrument; end",
"def profiler; end",
"def profiler; end",
"def setup\n\t\n # create an instance of the measure\n @measure = VentilationQAQC.new\n \n #create an instance of the runner\n @runner = OpenStudio::Ruleset::OSRunner.new\t\n\t\n # get arguments \n @arguments = @measure.arguments()\n\n # make argument map\n make_argument_map\n\t\n # Make an empty model\n @model = OpenStudio::Model::Model.new\n\t@runner.setLastOpenStudioModel(@model)\n\t\n\t# Create a fake sql file - our measure will crash if @runner has no sql file set.\n\t# We don't get data from this file because we get data from our patched SqlFile class instead (see above)\n\tsqlFile = OpenStudio::SqlFile.new(OpenStudio::Path.new(sqlPath))\n\t@runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sqlPath))\n\t\n\t$serieses[\"Zone Mechanical Ventilation Mass Flow Rate|ZONE1\"] = OpenStudio::TimeSeries.new(OpenStudio::Date.new, OpenStudio::Time.new(1.0), (0..364).to_a.to_vector, \"m^3/s\")\n end",
"def monitor(*args, &bl)\n result = nil\n took = Benchmark.realtime {\n result = bl.call\n }\n Tools.info(args, op_took: took)\n result\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n \n #Check weather directory Weather File\n unless (Pathname.new @lib_directory).absolute?\n @lib_directory = File.expand_path(File.join(File.dirname(__FILE__), @lib_directory))\n end\n lib_file = File.join(@lib_directory, @lib_file_name)\n if File.exists?(lib_file) and @lib_file_name.downcase.include? \".osm\"\n BTAP::runner_register(\"Info\",\"#{@lib_file_name} Found!.\", runner)\n else\n BTAP::runner_register(\"Error\",\"#{lib_file} does not exist or is not an .osm file.\", runner)\n return false\n end\n \n #load model and test.\n construction_set = BTAP::Resources::Envelope::ConstructionSets::get_construction_set_from_library( lib_file, @construction_set_name )\n #Set Construction Set.\n unless model.building.get.setDefaultConstructionSet( construction_set.clone( model ).to_DefaultConstructionSet.get )\n BTAP::runner_register(\"Error\",\"Could not set Default Construction #{@construction_set_name} \", runner)\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Default Construction set to #{@construction_set_name} from #{lib_file}\",runner)\n ##########################################################################\n return true\n end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n # use the built-in error checking \n if !runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n # Report that this is an anti-measure\n runner.registerValue('anti_measure',true) \n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n\t# Initialize counter variables\n\tno_economizer = 0\n\tfixed_dry_bulb = 0\n\tdifferential_dry_bulb = 0\t\n\tfixed_enthalpy = 0\n\tdifferential_enthalpy = 0\n\tfixed_dew_point_and_dry_bulb = 0\n\telectronic_enthalpy = 0\n\tdifferential_dry_bulb_and_enthalpy = 0\n\t\n\t# Retrieve all Controller:Outdoor air objects in the idf \t\n\toa_controllers = workspace.getObjectsByType(\"Controller:OutdoorAir\".to_IddObjectType)\n\t\n\t# Get the names of each Controller:Outdoor Air object\n\toa_controllers.each do |oa_controller|\n\n\t\toa_controller_name = oa_controller.getString(0).to_s #(0) is field Name\n\t\toa_controller_economizer_control_type = oa_controller.getString(7).to_s #(7) is field Economizer Control Type\n\t\n\t\t# test for presence No economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"NoEconomizer\" # or empty\n\t\t\trunner.registerInfo(\"The Controller:Outdoor air object named #{oa_controller_name} has a disabled airside economizer. Economizer sensor faults will not be added.\")\n\t\t\tno_economizer = no_economizer + 1\n\t\tend\n\t\t\n\t\t# test for presence of differential dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir \n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\tdifferential_dry_bulb = differential_dry_bulb + 1\n\t\t\t# info message\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\t\n\n\t\tend # OA Controller Type DifferentialDryBulb\n\n\t\t# test for presence of fixed dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dry_bulb = fixed_dry_bulb + 1\n\t\t\t\n\t\tend # OA Controller Type = FixedDryBulb \t\t\n\t\t\n\t\t# test for presence of fixed enthalpy economizer controller setting \t\t\t\t\n\t\tif oa_controller_economizer_control_type == \"FixedEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\twworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_enthalpy = fixed_enthalpy + 1\n\t\tend # OA Controller Type = FixedEnthalpy \n\t\t\n\t\t# test for presence of differential enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_enthalpy = differential_enthalpy + 1\n\t\t\t\n\t\tend # OA Controller Type =\"Differential Enthalpy\"\t\t\n\t\t\n\t\n\t\t# test for presence of electronic enthalpy economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"ElectronicEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\telectronic_enthalpy = electronic_enthalpy + 1\n\n\t\tend # OA Controller Type = \"ElectronicEnthalpy\" \t\t\n\t\t\n\t\t# test for presence of fixed dew point and dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDewPointAndDryBulb\" \n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dew_point_and_dry_bulb = fixed_dew_point_and_dry_bulb + 1\n\n\t\tend # OA Controller Type = \"FixedDewPointAndDryBulb\" \n\t\n\t\t# test for presence of differential dry bulb and enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulbAndEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_dry_bulb_and_enthalpy = differential_dry_bulb_and_enthalpy + 1\n\t\tend # OA Controller Type \"DifferentialDryBulbAndEnthalpy\"\n\t\t\n\t\t\t\t\n\tend # end loop through oa controller objects\n\n\t# reporting when N/A condition is appropriate\n\tif fixed_dry_bulb +\tdifferential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb +\telectronic_enthalpy + differential_dry_bulb_and_enthalpy == 0\n\t\trunner.registerAsNotApplicable(\"Measure not applicable because the model contains no OutdoorAir:Controller objects with operable economizers.\")\n\tend \n\t\n\ttotal = fixed_dry_bulb + differential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb + electronic_enthalpy + differential_dry_bulb_and_enthalpy\n\t\n\t# reporting initial condition of model\n\trunner.registerInitialCondition(\"The measure started with #{total} Outdoor Air Controllers configured for operational airside economizers. #{no_economizer} Outdoor Air Controller had the Economizer Contrrol Type set to 'NoEconomizer'.\")\n\t# reporting final condition of model\n\trunner.registerFinalCondition(\"The measure finished by adding outdoor and return air temperature and enthalpy sensor faults to #{total} economizer configurations.\")\n \n return true\n \n end",
"def calculation\n end",
"def monitor; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n # initialize variables\n affected_space_types = []\n affected_flag = false\n power_tot = 0\n power_tot_new = 0\n control_factor = 0.05 #90.1-2010 Table 9.6.2\n\n # standards space types\n affected_space_types << \"BreakRoom\"\n affected_space_types << \"Conference\"\n affected_space_types << \"Office\"\n affected_space_types << \"Restroom\"\n affected_space_types << \"Stair\"\n\n # get model objects\n space_types = model.getSpaceTypes\n\n # DO STUFF\n #TODO account for zone multipliers?\n space_types.each do |st|\n\n std_spc_typ = st.standardsSpaceType.to_s\n area = st.floorArea\n people = st.getNumberOfPeople(area)\n power = st.getLightingPower(area, people)\n power_tot += power\n\n #calcualte LPD\n lpd_area = power / area\n lpd_people = power / people\n\n affected_space_types.each do |ast|\n\n if ast == std_spc_typ\n\n #calculate adjustment and new power\n power_adj = power * control_factor\n power_new = power - power_adj\n\n lpd_area_new = power_new / area\n lpd_people_new = power_new / people\n\n #set new power\n if st.lightingPowerPerFloorArea.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerFloorArea(lpd_area_new)\n\n lpd_area_ip = OpenStudio.convert(lpd_area,\"ft^2\",\"m^2\").get\n lpd_area_new_ip = OpenStudio.convert(lpd_area_new,\"ft^2\",\"m^2\").get\n lpd_area_change = (1 - (lpd_area_new / lpd_area)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_area_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_area_new_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_area_change.round(0)}%\")\n\n elsif st.lightingPowerPerPerson.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerPerson(lpd_people_new)\n\n lpd_people_change = (1 - (lpd_people_new / lpd_people)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_people} W/person\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_people_new} W/person\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_people_change.round(0)}%\")\n\n else\n\n runner.registerWarning(\"Lighting power is specified using Lighting Level (W) for affected space type: #{st.name}\")\n\n end #set new power\n\n affected_flag = true\n\n end\n\n end #affected space types\n\n # calculate new total lighting power\n power = st.getLightingPower(area, people)\n power_tot_new += power\n\n end #space types\n\n # report not applicable\n if affected_flag == false\n runner.registerAsNotApplicable(\"No affected space types found\")\n end\n\n # report initial condition\n runner.registerInitialCondition(\"Total interior lighting power = #{power_tot.round(0)} W\")\n\n # report final condition\n runner.registerFinalCondition(\"Total interior lighting power = #{power_tot_new.round(0)} W\")\n\n return true\n\n end",
"def measure key,value\n @context= {}\n @path = \"#{key}\" \n @context[:callcount] = 1\n @context[:firsttimestampoffset] = Time.now.to_f*1000 - value\n @context[:name] = @path\n @context[:responsetime] = value\n @context_list << @context\n end",
"def total_time=(_arg0); end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n #use the built-in error checking \n if not runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n require 'json'\n \n # Get the last openstudio model\n model = runner.lastOpenStudioModel\n if model.empty?\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\n return false\n end\n model = model.get\n \n results = {}\n \n #get all DX coils in model\n dx_single = workspace.getObjectsByType(\"Coil:Cooling:DX:SingleSpeed\".to_IddObjectType)\n dx_two = workspace.getObjectsByType(\"Coil:Cooling:DX:TwoSpeed\".to_IddObjectType)\n \n dx_single.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial COP: #{dx.getDouble(4).get}\")\n dx.setDouble(4,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final COP: #{dx.getDouble(4).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n\n dx_two.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial High COP: #{dx.getDouble(4).get}, Initial Low COP: #{dx.getDouble(16).get}\")\n dx.setDouble(4,7.62)\n dx.setDouble(16,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final High COP: #{dx.getDouble(4).get}, Final Low COP: #{dx.getDouble(16).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n end\n \n #save airloop parsing results to ems_results.json\n runner.registerInfo(\"Saving ems_results.json\")\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\n ems_string = \"\"\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n return true\n end\n \n timeStep = model.getTimestep.numberOfTimestepsPerHour\n \n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\n #start making the EMS code\n ems_string = \"\" #clear out the ems_string\n ems_string << \"\\n\" \n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\n ems_string << \"\\n\" \n \n results.each_with_index do |(key, value), i| \n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"Schedule:Constant,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\n ems_string << \" Schedule:Constant,\" + \"\\n\"\n ems_string << \" Schedule Value;\" + \"\\n\"\n ems_string << \"\\n\" \n end\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\n ems_string << \"\\n\"\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\n results.each_with_index do |(key, value), i|\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\n end \n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\n \n #save EMS snippet\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n \n #unique initial conditions based on\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\n\n #reporting final condition of model\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\n \n ems_path = '../MembraneHeatPumpCoolingOnly/ems_membrane_heat_pump_cooling_only.ems'\n json_path = '../MembraneHeatPumpCoolingOnly/ems_results.json'\n if File.exist? ems_path\n ems_string = File.read(ems_path)\n if File.exist? json_path\n json = JSON.parse(File.read(json_path))\n end\n else\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\n ems_path1 = ems_path2[0]\n json_path2 = Dir.glob('../../**/ems_results.json')\n json_path1 = json_path2[0]\n if ems_path2.size > 1\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\n end\n if !ems_path1.nil? \n if File.exist? ems_path1\n ems_string = File.read(ems_path1)\n if File.exist? json_path1\n json = JSON.parse(File.read(json_path1))\n else\n runner.registerError(\"ems_results.json file not located\") \n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \n end\n end\n if json.nil?\n runner.registerError(\"ems_results.json file not located\")\n return false\n end\n \n if json.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n return true\n end\n \n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\n runner.registerInfo(\"Adding EMS code to workspace\")\n workspace.addObjects(idf_file.objects)\n \n return true\n\n end",
"def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)\n # create an instance of the measure\n measure = ChangeBuildingLocation.new\n\n # create an instance of a runner with OSW\n osw_path = OpenStudio::Path.new(File.dirname(__FILE__) + '/test.osw')\n osw = OpenStudio::WorkflowJSON.load(osw_path).get\n runner = OpenStudio::Measure::OSRunner.new(osw)\n\n # get model\n if model_name.nil?\n # make an empty model\n model = OpenStudio::Model::Model.new\n else\n # load the test model\n translator = OpenStudio::OSVersion::VersionTranslator.new\n path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)\n model = translator.loadModel(path)\n assert(!model.empty?)\n model = model.get\n end\n\n # get arguments\n arguments = measure.arguments(model)\n argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)\n\n # populate argument with specified hash value if specified\n arguments.each do |arg|\n temp_arg_var = arg.clone\n if args.key?(arg.name)\n assert(temp_arg_var.setValue(args[arg.name]))\n end\n argument_map[arg.name] = temp_arg_var\n end\n\n # temporarily change directory to the run directory and run the measure (because of sizing run)\n start_dir = Dir.pwd\n begin\n unless Dir.exist?(run_dir(test_name))\n Dir.mkdir(run_dir(test_name))\n end\n Dir.chdir(run_dir(test_name))\n\n # run the measure\n measure.run(model, runner, argument_map)\n result = runner.result\n ensure\n Dir.chdir(start_dir)\n\n # delete sizing run dir\n FileUtils.rm_rf(run_dir(test_name))\n end\n\n # show the output\n puts \"measure results for #{test_name}\"\n show_output(result)\n\n # assert that it ran correctly\n if result_value.nil? then result_value = 'Success' end\n assert_equal(result_value, result.value.valueName)\n\n # check count of warning and info messages\n unless info_count.nil? then assert(result.info.size == info_count) end\n unless warnings_count.nil? then assert(result.warnings.size == warnings_count) end\n\n # if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)\n if result_value == 'Fail' then assert(result.errors.size >= 1) end\n\n # save the model to test output directory\n output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + \"/output/#{test_name}_test_output.osm\")\n model.save(output_file_path, true)\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n # Argument will be passed as instance variable. So if your argument was height, your can access it using @height. \n\n # report initial condition\n site = model.getSite\n initial_design_days = model.getDesignDays\n if site.weatherFile.is_initialized\n weather = site.weatherFile.get\n runner.registerInitialCondition(\"The initial weather file path was '#{weather.path.get}' and the model had #{initial_design_days.size} design days.\")\n else\n runner.registerInitialCondition(\"The initial weather file has not been set and the model had #{initial_design_days.size} design days.\")\n end\n\n\n #Check form weather directory Weather File\n unless (Pathname.new @weather_directory).absolute?\n @weather_directory = File.expand_path(File.join(File.dirname(__FILE__), @weather_directory))\n end\n weather_file = File.join(@weather_directory, @weather_file_name)\n if File.exists?(weather_file) and @weather_file_name.downcase.include? \".epw\"\n BTAP::runner_register(\"Info\", \"The epw weather file #{weather_file} was found!\", runner)\n else\n BTAP::runner_register(\"Error\",\"'#{weather_file}' does not exist or is not an .epw file.\", runner)\n return false\n end\n\n begin\n weather = BTAP::Environment::WeatherFile.new(weather_file)\n #Set Weather file to model.\n weather.set_weather_file(model)\n #Store information about this run in the runner for output. This will be in the csv and R dumps.\n runner.registerValue( 'city',weather.city )\n runner.registerValue( 'state_province_region ',weather.state_province_region )\n runner.registerValue( 'country',weather.country )\n runner.registerValue( 'hdd18',weather.hdd18 )\n runner.registerValue( 'cdd18',weather.cdd18 )\n runner.registerValue( 'necb_climate_zone',BTAP::Compliance::NECB2011::get_climate_zone_name(weather.hdd18).to_s)\n runner.registerFinalCondition( \"Model ended with weatherfile of #{model.getSite.weatherFile.get.path.get}\" )\n rescue\n BTAP::runner_register(\"Error\",\"'#{weather_file}' could not be loaded into model.\", runner)\n\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Weather file set to #{weather_file}\",runner)\n return true\n end",
"def run(workspace, runner, user_arguments)\r\n super(workspace, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(workspace), user_arguments)\r\n return false\r\n end\r\n \r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n # Get the last openstudio model\r\n model = runner.lastOpenStudioModel\r\n if model.empty?\r\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\r\n return false\r\n end\r\n model = model.get\r\n \r\n results = {}\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(7.62))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(7.62)\r\n dx.setRatedLowSpeedCOP(7.62)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #save airloop parsing results to ems_results.json\r\n runner.registerInfo(\"Saving ems_results.json\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\r\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\r\n ems_string = \"\"\r\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n return true\r\n end\r\n \r\n timeStep = model.getTimestep.numberOfTimestepsPerHour\r\n \r\n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\r\n #start making the EMS code\r\n ems_string = \"\" #clear out the ems_string\r\n ems_string << \"\\n\" \r\n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n \r\n results.each_with_index do |(key, value), i| \r\n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\r\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\r\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\r\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\r\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\r\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\r\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\r\n ems_string << \" Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" Schedule Value;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n end\r\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\r\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\r\n ems_string << \"\\n\"\r\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\r\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\r\n results.each_with_index do |(key, value), i|\r\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\r\n end \r\n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\r\n \r\n #save EMS snippet\r\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\r\n \r\n ems_path = '../MembraneHeatPumpCoolingOnlyEms/ems_membrane_heat_pump_cooling_only.ems'\r\n json_path = '../MembraneHeatPumpCoolingOnlyEms/ems_results.json'\r\n if File.exist? ems_path\r\n ems_string = File.read(ems_path)\r\n if File.exist? json_path\r\n json = JSON.parse(File.read(json_path))\r\n end\r\n else\r\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\r\n ems_path1 = ems_path2[0]\r\n json_path2 = Dir.glob('../../**/ems_results.json')\r\n json_path1 = json_path2[0]\r\n if ems_path2.size > 1\r\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\r\n end\r\n if !ems_path1.nil? \r\n if File.exist? ems_path1\r\n ems_string = File.read(ems_path1)\r\n if File.exist? json_path1\r\n json = JSON.parse(File.read(json_path1))\r\n else\r\n runner.registerError(\"ems_results.json file not located\") \r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \r\n end\r\n end\r\n if json.nil?\r\n runner.registerError(\"ems_results.json file not located\")\r\n return false\r\n end\r\n \r\n if json.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n return true\r\n end\r\n \r\n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\r\n runner.registerInfo(\"Adding EMS code to workspace\")\r\n workspace.addObjects(idf_file.objects)\r\n \r\n return true\r\n\r\n end",
"def modeler_description\n return 'The measure performs the following functions: (1) IDs all chillers, (2) Locates their performance curves and outputs the data, (3) Adds reporting variables for chiller-related data.'\n end",
"def build_timing; end",
"def measure_gc\n return unless enabled?\n\n @raw_data << { fake: true }\n @total_time += 1.1\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # define if the measure should run to a specific time period or whole day\n apply_to_time = true\n\n # assign the user inputs to variables\n object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)\n single_space_type = runner.getDoubleArgumentValue('single_space_type', user_arguments)\n occupied_space_type = runner.getDoubleArgumentValue('occupied_space_type', user_arguments)\n unoccupied_space_type = runner.getDoubleArgumentValue('unoccupied_space_type', user_arguments)\n starttime_winter2 = runner.getStringArgumentValue('starttime_winter2', user_arguments)\n endtime_winter2 = runner.getStringArgumentValue('endtime_winter2', user_arguments)\n starttime_winter1 = runner.getStringArgumentValue('starttime_winter1', user_arguments)\n endtime_winter1 = runner.getStringArgumentValue('endtime_winter1', user_arguments)\n starttime_summer = runner.getStringArgumentValue('starttime_summer', user_arguments)\n endtime_summer = runner.getStringArgumentValue('endtime_summer', user_arguments)\n auto_date = runner.getBoolArgumentValue('auto_date', user_arguments)\n alt_periods = runner.getBoolArgumentValue('alt_periods', user_arguments)\n demo_cost_initial_const=false\n\n winter_start_month1 = 1\n winter_end_month1 = 5\n summer_start_month = 6\n summer_end_month = 9\n winter_start_month2 = 10\n winter_end_month2 = 12\n\n######### GET CLIMATE ZONES ################\n if auto_date\n ashraeClimateZone = ''\n #climateZoneNUmber = ''\n climateZones = model.getClimateZones\n climateZones.climateZones.each do |climateZone|\n if climateZone.institution == 'ASHRAE'\n ashraeClimateZone = climateZone.value\n runner.registerInfo(\"Using ASHRAE Climate zone #{ashraeClimateZone}.\")\n end\n end\n\n if ashraeClimateZone == '' # should this be not applicable or error?\n runner.registerError(\"Please assign an ASHRAE Climate Zone to your model using the site tab in the OpenStudio application. The measure can't make AEDG recommendations without this information.\")\n return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # else\n # climateZoneNumber = ashraeClimateZone.split(//).first\n end\n # #runner.registerInfo(\"CLIMATE ZONE #{ashraeClimateZone}. Right now does not do anything.\")\n # if !['1', '2', '3', '4', '5', '6', '7', '8'].include? climateZoneNumber\n # runner.registerError('ASHRAE climate zone number is not within expected range of 1 to 8.')\n # return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # end\n\n if alt_periods\n if ashraeClimateZone == '3A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '14:01:00'\n endtime_summer = '17:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '13:01:00'\n endtime_summer = '16:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n end\n else\n if ashraeClimateZone == '2A'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '2B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3A'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3B'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '19:01:00'\n endtime_winter1 = '22:59:00'\n starttime_winter2 = '19:01:00'\n endtime_winter2 = '22:59:00'\n elsif ashraeClimateZone == '3C'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '12:01:00'\n endtime_summer = '15:59:00'\n starttime_winter1 = '16:01:00'\n endtime_winter1 = '19:59:00'\n starttime_winter2 = '16:01:00'\n endtime_winter2 = '19:59:00'\n elsif ashraeClimateZone == '4B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '20:01:00'\n endtime_summer = '23:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '7A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n end\n end\n end \n\n # check the lighting power reduction percentages and for reasonableness\n if occupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif occupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (occupied_space_type < 1) && (occupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally low.\")\n elsif occupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally high.\")\n elsif occupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if unoccupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif unoccupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (unoccupied_space_type < 1) && (unoccupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally low.\")\n elsif unoccupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally high.\")\n elsif unoccupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if single_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif single_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (single_space_type < 1) && (single_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally low.\")\n elsif single_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally high.\")\n elsif single_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the time periods for reasonableness\n if (starttime_winter1.to_f > endtime_winter1.to_f) && (starttime_winter2.to_f > endtime_winter2.to_f) && (starttime_summer.to_f > endtime_summer.to_f)\n runner.registerError('The end time should be larger than the start time.')\n return false\n end\n\n # check the space_type for reasonableness\n space_type = nil\n if object.empty?\n handle = runner.getStringArgumentValue('space_type', user_arguments)\n if handle.empty?\n runner.registerError('No space type was chosen.')\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !object.get.to_SpaceType.empty?\n space_type = object.get.to_SpaceType.get\n elsif !object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError('Script Error - argument not showing up as space type or building.')\n return false\n end\n end\n\n\n ############################################\n\n # assign the time duration when DR strategy is applied, from shift_time1 to shift_time2, only applied when apply_to_time is ture\n shift_time1 = OpenStudio::Time.new(starttime_winter1)\n shift_time2 = OpenStudio::Time.new(endtime_winter1)\n shift_time3 = OpenStudio::Time.new(0, 24, 0, 0)\n shift_time4 = OpenStudio::Time.new(starttime_summer)\n shift_time5 = OpenStudio::Time.new(endtime_summer)\n shift_time6 = OpenStudio::Time.new(starttime_winter2)\n shift_time7 = OpenStudio::Time.new(endtime_winter2)\n \n \n # get space types in model\n if apply_to_building\n space_types = model.getSpaceTypes\n else\n space_types = []\n space_types << space_type # only run on a single space type\n end\n\n # make a hash of old defs and new equipments and luminaire defs\n cloned_equi_defs = {}\n # loop through space types\n space_types.each do |space_type|\n\n equi_set_schs = {}\n if apply_to_building # measure will be applied differently to space types, based on whether the space type is occupied\n if !space_type.people.empty?\n equipment_power_reduction_percent = 1 - (occupied_space_type/100)\n else\n equipment_power_reduction_percent = 1 - (unoccupied_space_type/100)\n end\n runner.registerInitialCondition(\"Equipment power will be reduced by #{occupied_space_type}% in occupied spaces, and reduced by #{unoccupied_space_type}% in unoccupied spaces\")\n\n else\n equipment_power_reduction_percent = 1 - (single_space_type/100) # measure will be applied evenly to all zones\n runner.registerInitialCondition(\"Equipment power will be reduced by #{single_space_type}% to '#{space_type.name}'.\")\n end\n\n space_type_equipments = space_type.electricEquipment\n space_type_equipments.each do |space_type_equipment|\n #clone of not already in hash\n equi_set_sch = space_type_equipment.schedule\n if !equi_set_sch.empty?\n # clone of not already in hash\n if equi_set_schs.key?(equi_set_sch.get.name.to_s)\n new_equi_set_sch = equi_set_schs[equi_set_sch.get.name.to_s]\n else\n new_equi_set_sch = equi_set_sch.get.clone(model)\n new_equi_set_sch = new_equi_set_sch.to_Schedule.get\n new_equi_set_sch_name = new_equi_set_sch.setName(\"#{new_equi_set_sch.name} adjusted #{equipment_power_reduction_percent}\")\n # add to the hash\n equi_set_schs[new_equi_set_sch.name.to_s] = new_equi_set_sch\n end\n # hook up clone to equipment\n \n if space_type_equipment.name.to_s != \"OfficeLarge Data Center Elec Equip\" && space_type_equipment.name.to_s != \"OfficeLarge Main Data Center Elec Equip\"\n space_type_equipment.setSchedule(new_equi_set_sch)\n runner.registerInfo(\"#{space_type_equipment.name} has a new electric equipment schedule\")\n end\n else\n runner.registerWarning(\"#{space_type.equipments.name} doesn't have a schedule.\")\n end\n end\n \n if apply_to_time\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time1} to #{shift_time2}.\")\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time4} to #{shift_time5} during special between month #{summer_start_month} and #{summer_end_month}\")\n else\n runner.registerFinalCondition(\" equipment power is reduced all day.\")\n end\n\n \n # make equipment schedule adjustments and rename.\n equi_set_schs.each do |k, v| # old name and new object for schedule\n if !v.to_ScheduleRuleset.empty?\n\n schedule = v.to_ScheduleRuleset.get\n default_rule = schedule.defaultDaySchedule\n rules = schedule.scheduleRules\n\n days_covered = Array.new(7, false)\n\n if rules.length > 0\n rules.each do |rule|\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = rule.clone(model).to_ScheduleRule.get\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = rule.daySchedule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = rule #rule.clone(model).to_ScheduleRule.get\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n\n cloned_day_winter = rule.daySchedule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n end\n #runner.registerInfo(\"BEFORE #{days_covered}\")\n if days_covered.include?(false)\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = OpenStudio::Model::ScheduleRule.new(schedule)\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n coverSomeDays(summer_rule, days_covered)\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = default_rule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = summer_rule.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n #coverSomeDays(winter_rule1, days_covered)\n #allDaysCovered(summer_rule, days_covered)\n\n cloned_day_winter = default_rule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n\n\n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n #runner.registerInfo(\"AFTER Summer #{days_covered}\")\n else\n runner.registerWarning(\"Schedule '#{k}' isn't a ScheduleRuleset object and won't be altered by this measure.\")\n v.remove # remove un-used clone\n end\n end\n\n end\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assume the occ sensors will last the full analysis\n expected_life = 25\n \n #assign the user inputs to variables\n space_type_object = runner.getOptionalWorkspaceObjectChoiceValue(\"space_type\",user_arguments,model)\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n material_and_installation_cost_per_space = runner.getDoubleArgumentValue(\"material_and_installation_cost_per_space\",user_arguments)\n\n #check the space_type for reasonableness and see if measure should run on space type or on the entire building\n apply_to_building = false\n space_type = nil\n if space_type_object.empty?\n handle = runner.getStringArgumentValue(\"space_type\",user_arguments)\n if handle.empty?\n runner.registerError(\"No space type was chosen.\")\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if not space_type_object.get.to_SpaceType.empty?\n space_type = space_type_object.get.to_SpaceType.get\n elsif not space_type_object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError(\"Script Error - argument not showing up as space type or building.\")\n return false\n end\n end\n \n #check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n #find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n if apply_to_building #apply to the whole building\n \n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n space_type.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n space.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n end\n end\n \n #make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n #TODO skip non-schedule-ruleset schedules\n \n #copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n #reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n #runner.registerInfo(\"***\")\n end\n \n #replace the old schedules with the new schedules\n spaces_sensors_added_to = []\n if apply_to_building #apply to the whole building\n runner.registerInfo(\"Adding occupancy sensors to whole building\")\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n runner.registerInfo(\"Adding occupancy sensors to space type '#{space_type.name}'\")\n space_type.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n runner.registerInfo(\"Adding occupancy sensors to space '#{space.name}\")\n space.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end \n end\n end \n \n #report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the specified areas of the building.\")\n return true\n end\n \n #report initial condition\n runner.registerInitialCondition(\"The building has several areas where occupancy sensors could be used to reduce lighting energy by turning off the lights while no occupants are present.\") \n \n #add cost of adding occ sensors\n if material_and_installation_cost_per_space != 0\n cost = OpenStudio::Model::LifeCycleCost.createLifeCycleCost(\"Add #{material_and_installation_cost_per_space} Occ Sensors to the Building\", model.getBuilding, material_and_installation_cost_per_space * num_sensors_added, \"CostPerEach\", \"Construction\", expected_life, 0)\n if cost.empty?\n runner.registerError(\"Failed to add costs.\")\n end\n end \n \n #report final condition\n if apply_to_building\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n else\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} #{space_type.name} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n end\n \n return true\n \n end",
"def run(model, runner, user_arguments)\r\n super(model, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(model), user_arguments)\r\n return false\r\n end\r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n results = {}\r\n dx_name = []\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n dx_heat = model.getCoilHeatingDXSingleSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(6.0))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(6.0)\r\n dx.setRatedLowSpeedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_heat.empty?\r\n dx_heat.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP}\")\r\n dx.setRatedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n \r\n if dx_name.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{dx_name.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The COP of the following coils was increased to 6: #{dx_name}\")\r\n return true\r\n\r\n end",
"def around_perform_stats(*args)\n start = Time.now\n yield\n time_taken = Time.now - start\n statsd.timing(\"duration:#{self}\", time_taken)\n statsd.increment(\"total_successful:#{self}\")\n statsd.increment(\"total_successful\")\n run_hooks(:duration, :duration, args) {|key| statsd.timing(key, time_taken)}\n end",
"def defMeasurement(name,&block)\n mp = {:mp => name, :fields => []}\n @fields = []\n # call the block with ourserlves to process its 'defMetric' statements\n block.call(self) if block\n @fields.each { |f| mp[:fields] << f }\n define_measurement_point(mp)\n end",
"def measure(heading)\n start_time = Time.now\n print heading\n result = yield\n end_time = Time.now - start_time\n puts \" (#{end_time} s)\"\n result\nend",
"def measure() @measure ||= (nb_weight == 0.0 ? 0.0 : sum_weight / nb_weight) end",
"def record_measure(label)\n $logger.debug(\n tms = Benchmark.measure(label) do\n yield\n end.format(\"%n: %10.6rreal %10.6u user %10.6y sys\")\n )\nend",
"def run_examination\n true\n end",
"def update\n if @clock1_measure.nil?\n discipline_freq\n else\n elapsed = @clock1.time - @clock1_measure.local_time\n discipline_freq if elapsed > @frequency_discipline_interval\n end\n if @clock2_measure.nil?\n discipline_phase\n else\n elapsed = @clock2.time - @clock2_measure.local_time\n discipline_phase if elapsed > @phase_discipline_interval\n end\n end",
"def benchmark!\n @benchmark = true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n pct_red = runner.getDoubleArgumentValue(\"pct_red\",user_arguments)\n start_hr = runner.getDoubleArgumentValue(\"start_hr\",user_arguments)\n end_hr = runner.getDoubleArgumentValue(\"end_hr\",user_arguments)\n \n\n\n #check the fraction for reasonableness\n if not 0 <= pct_red and pct_red <= 100\n runner.registerError(\"Percent reduction value needs to be between 0 and 100.\")\n return false\n end\n\n #check start_hr for reasonableness and round to 15 minutes\n start_red_hr = nil\n start_red_min = nil\n if not 0 <= start_hr and start_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24\")\n return false\n else\n rounded_start_hr = ((start_hr*4).round)/4.0\n if not start_hr == rounded_start_hr\n runner.registerInfo(\"Start time rounded to nearest 15 minutes: #{rounded_start_hr}\")\n end\n start_red_hr = rounded_start_hr.truncate\n start_red_min = (rounded_start_hr - start_red_hr)*60\n start_red_min = start_red_min.to_i\n end\n\n #check end_hr for reasonableness and round to 15 minutes\n end_red_hr = nil\n end_red_min = nil \n if not 0 <= end_hr and end_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24.\")\n return false\n elsif end_hr > end_hr\n runner.registerError(\"Please enter an end time later in the day than end time.\")\n return false\n else\n rounded_end_hr = ((end_hr*4).round)/4.0\n if not end_hr == rounded_end_hr\n runner.registerInfo(\"End time rounded to nearest 15 minutes: #{rounded_end_hr}\")\n end\n end_red_hr = rounded_end_hr.truncate\n end_red_min = (rounded_end_hr - end_red_hr)*60\n end_red_min = end_red_min.to_i\n end\n\n # Translate the percent reduction into a multiplier\n red_mult = pct_red/100\n\n # Get schedules from all lights.\n original_lights_schs = []\n model.getLightss.each do |lights|\n if lights.schedule.is_initialized\n lights_sch = lights.schedule.get\n original_lights_schs << lights_sch\n end\n end\n\n # loop through the unique list of lights schedules, cloning\n # and reducing schedule fraction during the specified time range.\n original_lights_schs_new_schs = {}\n original_lights_schs.uniq.each do |lights_sch|\n if lights_sch.to_ScheduleRuleset.is_initialized\n new_lights_sch = lights_sch.clone(model).to_ScheduleRuleset.get\n new_lights_sch.setName(\"#{lights_sch.name} with Solar Cogeneration and Daylighting\")\n original_lights_schs_new_schs[lights_sch] = new_lights_sch\n new_lights_sch = new_lights_sch.to_ScheduleRuleset.get\n \n # method to adjust the values in a day schedule by a \n # specified percentage during a range of hours.\n def reduce_schedule(day_sch, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n start_time = OpenStudio::Time.new(0, start_red_hr, start_red_min, 0)\n end_time = OpenStudio::Time.new(0, end_red_hr, end_red_min, 0)\n\n # Get the original values at the desired start and end times\n # and put points into the schedule at those times.\n day_sch.addValue(start_time, day_sch.getValue(start_time))\n day_sch.addValue(end_time, day_sch.getValue(end_time))\n \n # Store the original time/values then clear the schedule\n times = day_sch.times\n values = day_sch.values\n day_sch.clearValues\n\n # Modify the time/values and add back to the schedule\n for i in 0..(values.length - 1)\n if times[i] > start_time and times[i] <= end_time # Inside range\n day_sch.addValue(times[i], values[i] * red_mult)\n else\n day_sch.addValue(times[i], values[i])\n end\n end\n\n end #end reduce schedule\n\n # Reduce default day schedule\n if new_lights_sch.scheduleRules.size == 0\n runner.registerWarning(\"Schedule '#{new_lights_sch.name}' applies to all days. It has been treated as a Weekday schedule.\")\n end\n reduce_schedule(new_lights_sch.defaultDaySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n \n # Reduce all other schedule rules\n new_lights_sch.scheduleRules.each do |sch_rule|\n reduce_schedule(sch_rule.daySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n end\n \n end \n end #end of original_lights_schs.uniq.each do\n\n #loop through all lights instances, replacing old lights schedules with the reduced schedules\n model.getLightss.each do |lights|\n if lights.schedule.empty?\n runner.registerWarning(\"There was no schedule assigned for the lights object named '#{lights.name}. No schedule was added.'\")\n else\n old_lights_sch = lights.schedule.get\n lights.setSchedule(original_lights_schs_new_schs[old_lights_sch])\n runner.registerInfo(\"Schedule for the lights object named '#{lights.name}' was reduced to simulate the application of Solar Cogeneration and Daylighting.\")\n end\n end\n\n # NA if the model has no lights\n if model.getLightss.size == 0\n runner.registerNotAsApplicable(\"Not Applicable - There are no lights in the model.\")\n end\n\n # Reporting final condition of model\n runner.registerFinalCondition(\"#{original_lights_schs.uniq.size} schedule(s) were edited to reflect the addition of Solar Cogeneration and Daylighting to the building.\")\n \n return true\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n\n\t#initialize variables\n\ttz_count = 0\n\tclg_tstat_schedule = []\n\tthermal_zone_array = []\n\t\t\n\t# get the thermal zones and loop through them \n\tmodel.getThermalZones.each do |thermal_zone|\n\t\n\t\tthermal_zone_array << thermal_zone\n\t\t\n\t\t# test to see if thermal zone has a thermostat object assigned or is unconditioned. \n\t\tif thermal_zone.thermostatSetpointDualSetpoint.is_initialized\n\t\t\tzone_thermostat = thermal_zone.thermostatSetpointDualSetpoint.get\n\t\t\ttz_count += 1\n\t\t\t\n\t\t\tif zone_thermostat.coolingSetpointTemperatureSchedule.is_initialized\n\t\t\t\tclg_tstat_schedule = zone_thermostat.coolingSetpointTemperatureSchedule.get\n\t\t\t\t\n\t\t\t\t# clone the existing cooling T-stat schedule in case it is used somewhere else in the model\n\t\t\t\tcloned_clg_tstat_schedule = clg_tstat_schedule.clone\n\t\t\t\t@new_clg_tstat_schedule_name = (\"#{clg_tstat_schedule.name}+1.5F\")\n\t\t\t\n\t\t\t\tif cloned_clg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_clg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles = []\n\t\t\t\t\tcooling_thermostat_array = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\n\t\t\t\t\tprofiles << defaultProfile\n\t\t\t\t\trules = schedule.scheduleRules\n\t\t\t\t\n\t\t\t\t\trules.each do |rule|\n\t\t\t\t\t\tprofiles << rule.daySchedule\n\t\t\t\t\tend # end the do loop through the rulesetsdo\n\n\t\t\t\t\t#adjust profiles of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles.each do |profile|\n\t\t\t\t\t\ttime = profile.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile.values.each do |value|\n\t\t\t\t\t\t\tdelta = 0.8333\n\t\t\t\t\t\t\tnew_value = value + delta # Note this is where the cooling setpoint is raised\n\t\t\t\t\t\t\tprofile.addValue(time[i], new_value)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\t\tcloned_clg_tstat_schedule.setName(@new_clg_tstat_schedule_name)\n\t\t\t\t\t\t\tcooling_thermostat_array << cloned_clg_tstat_schedule\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setCoolingSetpointTemperatureSchedule(cloned_clg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing cooling thermostat '#{clg_tstat_schedule.name}' has been changed to #{cloned_clg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying cooling tstat schedule object\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a cooling setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for cooling Setpoint Temperature is initialized\n\t\t\t\n\t\t\tif zone_thermostat.heatingSetpointTemperatureSchedule.is_initialized\n\t\t\t\thtg_tstat_schedule = zone_thermostat.heatingSetpointTemperatureSchedule.get\n\t\t\t\t\t\t\n\t\t\t\t# clone the existing heating T-stat schedule in case it is used somewhere else\n\t\t\t\tcloned_htg_tstat_schedule = htg_tstat_schedule.clone\n\t\t\t\t\n\t\t\t\t#name cloned heating t-stat schedule\n\t\t\t\tcloned_htg_tstat_schedule.setName(\"#{htg_tstat_schedule.name}-1.5F\")\n\n\t\t\t\tif cloned_htg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_htg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles_h = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\t\n\t\t\t\t\tprofiles_h << defaultProfile\n\t\t\t\t\trules_h = schedule.scheduleRules\n\t\t\t\t\trules_h.each do |rule_h|\n\t\t\t\t\t\tprofiles_h << rule_h.daySchedule\n\t\t\t\t\tend # end the rule_h do\n\n\t\t\t\t\t#adjust profiles_h of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles_h.each do |profile_h|\n\t\t\t\t\t\ttime_h = profile_h.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile_h.values.each do |value_h|\n\t\t\t\t\t\t\tdelta_h = 0.8333\n\t\t\t\t\t\t\tnew_value_h = value_h - delta_h # Note this is where the heating setpoint is lowered \n\t\t\t\t\t\t\tprofile_h.addValue(time_h[i], new_value_h)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile_h\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setHeatingSetpointTemperatureSchedule(cloned_htg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing heating thermostat '#{htg_tstat_schedule.name}' has been changed to #{cloned_htg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying heating tstat schedule object\t\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a heating setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for heating Setpoint Temperature is initialized\n\t\tend\t# end if statement for zone_thermstat cooling schedule\n\t\t\n\tend # end loop through thermal zones\t\t\t\n\t\t\t\n\t# Add ASHRAE 55 Comfort Warnings are applied to people objects\n\t# get people objects and people definitions in model\n\tpeople_defs = model.getPeopleDefinitions\n\tpeople_instances = model.getPeoples\n\n\t# loop through people objects\n\tpeople_def_counter = 0\n\tpeople_defs.sort.each do |people_def|\n\t next if not people_def.instances.size > 0\n\t people_def_counter += 1\n\t people_def.setEnableASHRAE55ComfortWarnings(true)\n\tend\n\t\t\t\n\treporting_frequency = \"Timestep\"\n\toutputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n\toutputVariable.setReportingFrequency(reporting_frequency)\n\trunner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting '#{reporting_frequency}'\")\n\n\t# write As Not Applicable message\n\tif tz_count == 0\n\t\trunner.registerAsNotApplicable(\"Measure is not applicable. There are no conditioned thermal zones in the model.\")\n\t\treturn true\n\tend\n\n\t# report initial condition of model\n\trunner.registerInitialCondition(\"The initial model contained #{tz_count} thermal zones with #{thermal_zone_array.length} 'Cooling Thermostat Schedule' and #{thermal_zone_array.length} 'Heating Thermostat Schedule' objects for which this measure is applicable.\")\n\n\t# report final condition of model\n\trunner.registerFinalCondition(\"The #{thermal_zone_array.length} Heating and #{thermal_zone_array.length} Cooling Thermostats schedules for #{thermal_zone_array.length} Thermal Zones were altered to reflect a additional deadband width of 3 Deg F . \")\n\treturn true\n\n end",
"def stat(*args)\n @recorder.call(*args) if @recorder\n end",
"def measure (n=1)\n cnt=0\nelapsed_time=Time.now\n\nn.times {\n cnt+=1\n yield} \nelapsed_time=(Time.now-elapsed_time)/cnt\n\nend",
"def run() end",
"def running_test_step; end",
"def stat() end",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n #initialize variables\n zone_hvac_count = 0\n pump_count = 0\n air_loop_count = 0\n \n #loop through each air loop in the model\n model.getAirLoopHVACs.sort.each do |air_loop|\n\n # call the method to generate a new occupancy schedule based on a 5% threshold\n occ_sch = air_loop.get_occupancy_schedule(0.15)\n old_sch = air_loop.availabilitySchedule\n next unless compare_eflh(runner, old_sch, occ_sch)\n # set the availability schedule of the airloop to the newly generated schedule\n air_loop.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_sch.name} for #{air_loop.name} was replaced with a new schedule named #{occ_sch.name} which tracks the occupancy profile of the thermal zones on this airloop.\")\n air_loop_count +=1\n \n end\n\n #loop through each thermal zone\n model.getThermalZones.sort.each do |thermal_zone|\n \n # zone equipments assigned to thermal zones\n thermal_zone_equipment = thermal_zone.equipment \n \n if thermal_zone_equipment.size >= 1\n # run schedule method to create a new schedule ruleset, routines \n occ_sch = thermal_zone.get_occupancy_schedule(0.15)\n \n #loop through Zone HVAC Equipment\n thermal_zone_equipment.each do |equip|\n \n # getting the fan exhaust object & getting relevant information for it. \n if equip.to_FanZoneExhaust.is_initialized\n zone_equip = equip.to_FanZoneExhaust.get\n old_schedule = zone_equip.availabilitySchedule.get\n next unless compare_eflh(runner, old_schedule, occ_sch)\n #assign the 'occ_sch' here as exhaust's availability schedule\n zone_equip.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_schedule.name} for the OS_Fan_ZoneExhaust named #{zone_equip.name} was replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\n zone_hvac_count += 1 \t\n elsif equip.to_RefrigerationAirChiller.is_initialized\n zone_equip = equip.to_RefrigerationAirChiller.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_WaterHeaterHeatPump.is_initialized\n zone_equip = equip.to_WaterHeaterHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACDehumidifierDX.is_initialized\n zone_equip = equip.to_ZoneHVACDehumidifierDX.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACEnergyRecoveryVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACEnergyRecoveryVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACFourPipeFanCoil.is_initialized\n zone_equip = equip.to_ZoneHVACFourPipeFanCoil.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACHighTemperatureRadiant.is_initialized\n zone_equip = equip.to_ZoneHVACHighTemperatureRadiant.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACIdealLoadsAirSystem.is_initialized\n zone_equip = equip.to_ZoneHVACIdealLoadsAirSystem.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t \n elsif equip.to_ZoneHVACLowTemperatureRadiantElectric.is_initialized\n zone_equip = equip.to_ZoneHVACLowTemperatureRadiantElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACLowTempRadiantConstFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantConstFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t \t\n elsif equip.to_ZoneHVACLowTempRadiantVarFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantVarFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalAirConditioner.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACPackagedTerminalHeatPump.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.is_initialized\n next unless compare_eflh(runner, old_schedule, occ_sch) \n equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get.setTerminalUnitAvailabilityschedule(occ_sch)\n runner.registerInfo(\"The availability schedule for the Zone HVAC Terminal Unit Variable Refrigerant Flow Object has been replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\t\t\t\t\t\n zone_hvac_count += 1 \n elsif equip.to_ZoneHVACUnitHeater.is_initialized\n zone_equip = equip.to_ZoneHVACUnitHeater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\n elsif equip.to_ZoneHVACUnitVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACUnitVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneVentilationDesignFlowRate.is_initialized\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has a Zone Ventilation Design Flow Rate object attacjhed as a ZoneHVACEquipment object. No modification were made to this object.\")\t\t\n end \t\n \n end # end loop through Zone HVAC Equipment\n \n else\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has no Zone HVAC Equipment objects attached - therefore no schedule objects have been altered.\")\t\n end # end of if statement\n \n end # end loop through thermal zones\n\n # Change pump control status if any airloops or\n # zone equipment were changed.\n if air_loop_count > 0 || zone_hvac_count > 0\n model.getPlantLoops.each do |plantLoop|\n #Loop through each plant loop demand component\n plantLoop.demandComponents.each do |dc|\n if dc.to_PumpConstantSpeed.is_initialized\n cs_pump = dc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n \n if dc.to_PumpVariableSpeed.is_initialized\n vs_pump = dc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Demand side Pump Control Type attribute of Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n end\n \n #Loop through each plant loop supply component\n plantLoop.supplyComponents.each do |sc|\n if sc.to_PumpConstantSpeed.is_initialized\n cs_pump = sc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Supply Side Pump Control Type atteribute of Constant Speed Pump named #{cs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component constant speed pump objects\n \n if sc.to_PumpVariableSpeed.is_initialized\n vs_pump = sc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Variable Speed Pump object named #{vs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Supply Side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component variable speed pump objects\n \n end # end loop throught plant loop supply side components\n \n end # end loop through plant loops\n end\n \n #Write N/A message\n if air_loop_count == 0 && zone_hvac_count == 0 && pump_count == 0 \n runner.registerAsNotApplicable(\"The model did not contain any Airloops, Thermal Zones having ZoneHVACEquipment objects or associated plant loop pump objects to act upon. The measure is not applicable.\")\n return true\n end\t\n \n #report initial condition of model\n runner.registerInitialCondition(\"The model started with #{air_loop_count} AirLoops, #{zone_hvac_count} Zone HVAC Equipment Object and #{pump_count} pump objects subject to modifications.\")\n \n # report final condition of model\n runner.registerFinalCondition(\"The measure modified the availability schedules of #{air_loop_count} AirLoops and #{zone_hvac_count} Zone HVAC Equipment objects. #{pump_count} pump objects had control settings modified.\")\n \n # Add ASHRAE Standard 55 warnings\n reporting_frequency = \"Timestep\"\n outputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n outputVariable.setReportingFrequency(reporting_frequency)\n runner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting at the model timestep.\")\n \n return true\n\t\n end",
"def calc_next_run\n nil\n end",
"def calc_next_run\n nil\n end",
"def running_test_case; end",
"def estimate\n # (native code) \n end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def tick; end",
"def tick; end",
"def tick; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n verbose_info_statements = runner.getBoolArgumentValue(\"verbose_info_statements\",user_arguments)\n fixed_window_subsurface = runner.getOptionalWorkspaceObjectChoiceValue('fixed_window_subsurface', user_arguments, model) # model is passed in because of argument type\n internal_variable_availability_dictionary_reporting = runner.getStringArgumentValue('internal_variable_availability_dictionary_reporting', user_arguments)\n ems_runtime_language_debug_output_level = runner.getStringArgumentValue('ems_runtime_language_debug_output_level', user_arguments) \n actuator_availability_dictionary_reporting = runner.getStringArgumentValue('actuator_availability_dictionary_reporting', user_arguments) \n \n runner.registerInitialCondition(\"Measure began with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n \n # declare arrys for scope\n array_of_21_sets = []\n material_property_glazing_spectral_data_vector = []\n standard_glazing_layer_array = []\n construction_array = []\n ems_window_construction_array = []\n \n # load idf into workspace\n workspace = OpenStudio::Workspace::load(OpenStudio::Path.new(\"#{File.dirname(__FILE__)}/resources/EMSThermochromicWindow.idf\")).get\n \n # get all MaterialPropertyGlazingSpectralData objects from within the idf\n # material_property_glazing_spectral_datas = source_idf.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n material_property_glazing_spectral_datas = workspace.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n if verbose_info_statements == true\n runner.registerInfo(\"The model has #{material_property_glazing_spectral_datas.size} material_property_glazing_spectral_datas objects.\")\n end\n \n material_property_glazing_spectral_datas.each do |material_property_glazing_spectral_data|\n \n spectral_data = {\"name\" => \"\",\"properties\" => []}\n spectral_data[\"name\"] = material_property_glazing_spectral_data.getString(0).to_s\n \n # Note: EnergyPlus file MaterialProperty:GlazingSpectralData objects have 1764 /4 = 441 sets of 4 values each \n n = material_property_glazing_spectral_data.numFields\n (1..n).each do |i| \n spectral_data[\"properties\"] << material_property_glazing_spectral_data.getString(i).to_s \n end\n array_of_21_sets << spectral_data\n end\n \n array_of_21_sets.each do |set|\n \n props = set[\"properties\"]\n material_property_glazing_spectral_data = OpenStudio::Model::MaterialPropertyGlazingSpectralData.new(model)\n material_property_glazing_spectral_data.setName(\"#{set[\"name\"]}\")\n \n k = (props.length / 4) - 1\n (0..k).each do |i| # note 440 uniques (a, b, c, d) pairs of attributes for each spectral data field object\n material_property_glazing_spectral_data.addSpectralDataField(props[(i*4)+0].to_f, props[(i*4)+1].to_f, props[(i*4)+2].to_f, props[(i*4)+3].to_f)\t\n end\n \n material_property_glazing_spectral_data_vector << material_property_glazing_spectral_data\n end \n \n # create (2) required new air gas materials to used by all EMS window constructions \n air_gas_3mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.003) \n air_gas_3mm_material.setName(\"AIR 3MM\")\n \n air_gas_8mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.008) \n air_gas_8mm_material.setName(\"AIR 8MM\")\n \n # loop through array of OS MaterialPropertyGlazingSpectralData objects and create 21 new Standard Glazing objects \n material_property_glazing_spectral_data_vector.each do |spec_data_obj|\n spec_data_obj_name = spec_data_obj.name\n layer_name = spec_data_obj_name.to_s.slice(\"sp\")\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.0075)\n else\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.003276)\n end\n layer.setName(\"#{layer_name}\")\n layer.setWindowGlassSpectralDataSet(spec_data_obj)\n layer.setInfraredTransmittanceatNormalIncidence(0) # same for all 21 constructions\n layer.setFrontSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n layer.setBackSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer.setConductivity(1.0) \n else\n layer.setConductivity(0.6) \n end\n layer.setDirtCorrectionFactorforSolarandVisibleTransmittance(1) # same for all 21 constructions\n layer.setSolarDiffusing(false)\n standard_glazing_layer_array << layer\n end\n\n # Create (2) unique standard glazing layers not used for Thermochromatic performance \n sb60_clear_3_ppg_layer = standard_glazing_layer_array[0]\n clear_3ppg_layer = standard_glazing_layer_array[1]\n remaining_standard_glazing_layer_array = standard_glazing_layer_array.drop(2)\n \n # create (19) new arrays of layered constructions representing thermochromatic layers\n remaining_standard_glazing_layer_array.each do |remaining_standard_glazing_layer|\n construction = [sb60_clear_3_ppg_layer, air_gas_3mm_material, remaining_standard_glazing_layer, air_gas_8mm_material, sb60_clear_3_ppg_layer]\n construction_array << construction\n end\n \n # create 19 new OS:Construction objects representing EMS thermochromatic windows\n name_index_array = [25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 50, 55, 60, 65, 70, 75, 80, 85]\n index = 0\n \n construction_array.each do |const|\n ems_window_construction = OpenStudio::Model::Construction.new(const)\n ems_window_construction.setName(\"TCwindow_#{name_index_array[index]}\")\n if verbose_info_statements == true\n runner.registerInfo(\"Created a new Construction named #{ems_window_construction.name} representing a thermochromatic window construction.\")\n end\n ems_window_construction_array << ems_window_construction\n index +=1\n end\n\n # check the user argument of the fixed window subsurface for reasonableness\n if fixed_window_subsurface.empty?\n handle = runner.getStringArgumentValue('fixed_window_subsurface', user_arguments)\n if handle.empty?\n runner.registerError('No fixed window subsurface was chosen.')\n else\n runner.registerError(\"The selected fixed window subsurface with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !fixed_window_subsurface.get.to_SubSurface.empty?\n fixed_window_subsurface = fixed_window_subsurface.get.to_SubSurface.get\n else\n runner.registerError('Script Error - argument not showing up as construction.')\n return false\n end\n end\n \n # Create a new EnergyManagementSystem:Sensor object representing the Surface Outside Face temp of the EMS thermochromatic window subsurface\n ems_win_Tout_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, \"Surface Outside Face Temperature\")\n ems_win_Tout_sensor.setName(\"Win1_Tout\")\n ems_win_Tout_sensor.setKeyName(\"#{fixed_window_subsurface.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Sensor object named '#{ems_win_Tout_sensor.name}' representing the Surface Outside Face temp of the EMS thermochromatic window subsurface was added to the model.\") \n end\n \n # Create a new EMS Actuator Object representing the construction state of the EMS generated thermochromatic window \n ems_win_construct_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fixed_window_subsurface, \"Surface\", \"Construction State\")\n ems_win_construct_actuator.setName(\"Win1_Construct\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Actuator object named '#{ems_win_construct_actuator.name}' representing construction state of the EMS generated thermochromatic window was added to the model.\") \n end\n \n # Create 19 EnergyManagementSystem:ConstructionIndexVariable objects for each unique thermochromatic construction\n ems_window_construction_array.each do |ems_window_construction|\n ems_constr_index_var = OpenStudio::Model::EnergyManagementSystemConstructionIndexVariable.new(model, ems_window_construction ) \n ems_constr_index_var.setName(\"#{ems_window_construction.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS SystemConstructionIndexVariable object named '#{ems_constr_index_var.name}' representing the the EMS construction state of the thermochromatic window was added to the model.\") \n end\n end\n \n # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface \n ems_apply_thermochromatic_constructions_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)\n ems_apply_thermochromatic_constructions_prgm.setName(\"#{fixed_window_subsurface.name}_Control\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"IF #{ems_win_Tout_sensor.name} <= 26.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_25\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 28.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_27\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 30.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_29\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 32.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_31\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 34.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_33\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 36.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_35\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 38.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_37\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 40.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_39\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 42.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_41\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 44.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_43\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 47.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_45\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 52.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_50\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 57.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_55\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 62.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_60\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 67.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_65\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 72.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_70\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 77.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_75\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 82.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_80\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSE\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_85\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ENDIF\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Program Object named '#{ems_apply_thermochromatic_constructions_prgm.name}' for dynamically assigning different window constructions based on the exterior surface temp was added to the model.\") \n end\n \n # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs\n ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n ems_prgm_calling_mngr.setName(\"My thermochromic window emulator\")\n ems_prgm_calling_mngr.setCallingPoint(\"BeginTimestepBeforePredictor\")\n ems_prgm_calling_mngr.addProgram(ems_apply_thermochromatic_constructions_prgm)\n if verbose_info_statements == true\n runner.registerInfo(\"EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call EMS program for dynamically applying a thermochromatic window.\") \n end\n \n # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting\n outputEMS = model.getOutputEnergyManagementSystem\n outputEMS.setInternalVariableAvailabilityDictionaryReporting(\"internal_variable_availability_dictionary_reporting\")\n outputEMS.setEMSRuntimeLanguageDebugOutputLevel(\"ems_runtime_language_debug_output_level\")\n outputEMS.setActuatorAvailabilityDictionaryReporting(\"actuator_availability_dictionary_reporting\")\n if verbose_info_statements == true\n runner.registerInfo(\"EMS OutputEnergyManagementSystem object configured per user arguments.\") \n end\n \n runner.registerFinalCondition(\"Measure finished with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n\n end",
"def bench(action, msg = nil)\n @t ||= Time.now\n @total ||= 0\n @step ||= 0\n case action\n when :start\n @step = 0\n @total = 0\n @t = Time.now\n when :step\n @step += 1\n int = Time.now - @t\n @total += int\n @t = Time.now\n dbg(\"Benchmark #{msg.nil? ? (\"%02d\" % @step) : msg}: #{\"%8.3fms\" % (int * 1000)} (Total: #{\"%8.3fms\" % (@total * 1000)}).\")\n end\nend",
"def apply_measure_and_run(test_name, measure, argument_map, osm_path, epw_path, run_model: false)\n assert(File.exist?(osm_path))\n assert(File.exist?(epw_path))\n\n # create run directory if it does not exist\n if !File.exist?(run_dir(test_name))\n FileUtils.mkdir_p(run_dir(test_name))\n end\n assert(File.exist?(run_dir(test_name)))\n\n # change into run directory for tests\n start_dir = Dir.pwd\n Dir.chdir run_dir(test_name)\n\n # remove prior runs if they exist\n if File.exist?(model_output_path(test_name))\n FileUtils.rm(model_output_path(test_name))\n end\n if File.exist?(report_path(test_name))\n FileUtils.rm(report_path(test_name))\n end\n\n # copy the osm and epw to the test directory\n new_osm_path = \"#{run_dir(test_name)}/#{File.basename(osm_path)}\"\n FileUtils.cp(osm_path, new_osm_path)\n new_epw_path = \"#{run_dir(test_name)}/#{File.basename(epw_path)}\"\n FileUtils.cp(epw_path, new_epw_path)\n # create an instance of a runner\n runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)\n\n # load the test model\n model = load_model(new_osm_path)\n\n # set model weather file\n epw_file = OpenStudio::EpwFile.new(OpenStudio::Path.new(new_epw_path))\n OpenStudio::Model::WeatherFile.setWeatherFile(model, epw_file)\n assert(model.weatherFile.is_initialized)\n\n # run the measure\n puts \"\\nAPPLYING MEASURE...\"\n measure.run(model, runner, argument_map)\n result = runner.result\n\n # show the output\n show_output(result)\n\n # save model\n model.save(model_output_path(test_name), true)\n\n errs = []\n if run_model && (result.value.valueName == 'Success')\n puts \"\\nRUNNING ANNUAL SIMULATION...\"\n\n std = Standard.build('NREL ZNE Ready 2017')\n std.model_run_simulation_and_log_errors(model, run_dir(test_name))\n\n # check that the model ran successfully and generated a report\n assert(File.exist?(model_output_path(test_name)))\n assert(File.exist?(sql_path(test_name)))\n assert(File.exist?(report_path(test_name)))\n\n # set runner variables\n runner.setLastEpwFilePath(epw_path)\n runner.setLastOpenStudioModelPath(OpenStudio::Path.new(model_output_path(test_name)))\n runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sql_path(test_name)))\n sql = runner.lastEnergyPlusSqlFile.get\n model.setSqlFile(sql)\n\n # test for unmet hours\n unmet_heating_hrs = std.model_annual_occupied_unmet_heating_hours(model)\n unmet_cooling_hrs = std.model_annual_occupied_unmet_cooling_hours(model)\n unmet_hrs = std.model_annual_occupied_unmet_hours(model)\n max_unmet_hrs = 550\n if unmet_hrs\n if unmet_hrs > 550\n errs << \"For #{test_name} there were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}), more than the limit of #{max_unmet_hrs}.\" if unmet_hrs > max_unmet_hrs\n else\n puts \"There were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}).\"\n end\n else\n errs << \"For #{test_name} could not determine unmet hours; simulation may have failed.\"\n end\n end\n\n # change back directory\n Dir.chdir(start_dir)\n\n assert(errs.empty?, errs.join(\"\\n\"))\n\n return result\n end",
"def after_assumption(name); end",
"def call\n result = while_measuring_memory_usage { action.call }\n\n Measurement.from_result(result)\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n retrofit_month = runner.getStringArgumentValue('retrofit_month', user_arguments).to_i\n retrofit_day = runner.getStringArgumentValue('retrofit_day', user_arguments).to_i\n\n # report initial condition of model\n runner.registerInitialCondition(\"Measure started successfully.\")\n\n # TODO: check the month and day for reasonableness\n runner.registerInfo(\"User entered retrofit month: #{retrofit_month}\")\n runner.registerInfo(\"User entered retrofit day: #{retrofit_day}\")\n\n prog_calling_manager = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n prog_calling_manager.setCallingPoint('BeginTimestepBeforePredictor')\n\n # Remove old and add new equip with EMS by spaces\n hash_space_epd = Hash.new\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n current_space_equip = space.electricEquipment[0]\n unless current_space_equip.nil?\n\n # Get equipment power density for each space type\n new_space_epd = runner.getOptionalDoubleArgumentValue(\"new_#{space.name.to_s}_epd\", user_arguments)\n if new_space_epd.is_initialized\n hash_space_epd[\"new_#{space.name.to_s}_epd\"] = new_space_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space.name.to_s} is #{new_space_epd} W/m2\")\n # Set ems\n current_space_equip_def = current_space_equip.electricEquipmentDefinition\n equip_sch_name = current_space_equip.schedule.get.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n runner.registerInfo(\"Delete old equip object for #{space.name}\")\n current_space_equip.remove\n\n new_equip = add_equip_space(space, current_space_equip_def)\n equip_level_w = new_space_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n else\n # Get equipment power ratio for each space type\n new_space_ratio = runner.getDoubleArgumentValue(\"new_#{space.name.to_s}_ratio\", user_arguments)\n\n old_equip_sch = current_space_equip.schedule.get\n ems_equip_program = add_equip_ems_w_occ_var(model, current_space_equip, old_equip_sch, new_space_ratio, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n # runner.registerInfo(\"Delete old equip object for #{space.name}\")\n # current_space_equip.remove\n end\n\n end\n end\n\n # Remove old and add new equip with EMS by space types\n hash_space_type_epd = Hash.new\n v_space_types = model.getSpaceTypes\n v_space_types.each do |space_type|\n current_spaces = space_type.spaces\n current_space_type_equip = space_type.electricEquipment[0]\n unless current_space_type_equip.nil?\n # Get equipment power density for each space type\n current_space_type_epd = runner.getStringArgumentValue(\"new_#{space_type.name.to_s}_epd\", user_arguments)\n hash_space_type_epd[\"new_#{space_type.name.to_s}_epd\"] = current_space_type_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space_type.name.to_s} is #{current_space_type_epd} W/m2\")\n\n # Set ems\n current_space_type_equip_def = current_space_type_equip.electricEquipmentDefinition\n current_space_type_sch_set = space_type.defaultScheduleSet.get\n current_space_type_equip_sch_set = current_space_type_sch_set.electricEquipmentSchedule.get\n\n equip_sch_name = current_space_type_equip_sch_set.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n\n puts \"Delete old equip object for #{space_type.name}\"\n current_space_type_equip.remove\n\n current_spaces.each do |space|\n # Calculate equipemtn electric power for each space\n new_equip = add_equip_space_type(model, space, space_type, current_space_type_equip_def)\n equip_level_w = current_space_type_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n end\n end\n end\n\n # echo the model updates back to the user\n runner.registerInfo(\"The electric equipment retrofit measure is applied.\")\n\n # report final condition of model\n runner.registerFinalCondition(\"Measure ended successfully.\")\n\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n runner.registerInfo(\"Start to create lighting measure from occupant schedule\")\n\n ### Get user selected lighting space assumptions for each space\n v_space_types = model.getSpaceTypes\n i = 1\n lght_space_type_arg_vals = {}\n # Loop through all space types, group spaces by their types\n v_space_types.each do |space_type|\n # Loop through all spaces of current space type\n v_current_spaces = space_type.spaces\n next if not v_current_spaces.size > 0\n v_current_spaces.each do |current_space|\n lght_space_type_val = runner.getStringArgumentValue(@@v_space_args[current_space.nameString], user_arguments)\n lght_space_type_arg_vals[current_space.nameString] = lght_space_type_val\n i += 1\n end\n end\n\n puts lght_space_type_arg_vals\n\n ### Start creating new lighting schedules based on occupancy schedule\n occ_schedule_dir = runner.getStringArgumentValue('occ_schedule_dir', user_arguments)\n model_temp_run_path = Dir.pwd + '/'\n measure_root_path = File.dirname(__FILE__)\n\n puts '=' * 80\n puts measure_root_path\n\n if File.file?(occ_schedule_dir)\n # Check if user provided a occupancy schedule CSV file\n csv_file = occ_schedule_dir\n puts 'Use user provided occupancy schedule file at: ' + csv_file.to_s\n runner.registerInitialCondition('Location check:' + File.expand_path(\"../..\", measure_root_path))\n # runner.registerInitialCondition('Use user provided occupancy schedule file at: ' + csv_file.to_s)\n else\n # Check if schedule file at several places\n # 1. Default fils path when run with OSW in CLI\n csv_path_lookup_1 = File.expand_path(\"../..\", measure_root_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"First lookup location: \" + csv_path_lookup_1\n runner.registerInfo(\"First lookup location: \" + csv_path_lookup_1)\n # 2. Default path when run with OpenStudio CLI\n csv_path_lookup_2 = File.expand_path(\"../..\", model_temp_run_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Second lookup location: \" + csv_path_lookup_2\n runner.registerInfo(\"Second lookup location: \" + csv_path_lookup_2)\n # 3. Default path when run with OpenStudio GUI\n csv_path_lookup_3 = File.expand_path(\"../../..\", model_temp_run_path) + \"/resources/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Third lookup location: \" + csv_path_lookup_3\n runner.registerInfo(\"Third lookup location: \" + csv_path_lookup_3)\n # 4. Generated files folder when run with rspec\n csv_path_lookup_4 = File.expand_path(\"..\", model_temp_run_path) + \"/generated_files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Forth lookup location: \" + csv_path_lookup_4\n runner.registerInfo(\"Forth lookup location: \" + csv_path_lookup_4)\n # 5. Generated files folder with OpenStudio V2.9.0+\n csv_path_lookup_5 = File.join(File.expand_path(\"../..\", model_temp_run_path), 'generated_files', @@default_occupant_schedule_filename)\n puts '#' * 80\n puts \"Fifth lookup location: \" + csv_path_lookup_5\n runner.registerInfo(\"Fifth lookup location: \" + csv_path_lookup_5)\n\n if File.file?(csv_path_lookup_1)\n csv_file = csv_path_lookup_1\n elsif File.file?(csv_path_lookup_2)\n csv_file = csv_path_lookup_2\n elsif File.file?(csv_path_lookup_3)\n csv_file = csv_path_lookup_3\n elsif File.file?(csv_path_lookup_4)\n csv_file = csv_path_lookup_4 \n elsif File.file?(csv_path_lookup_5)\n csv_file = csv_path_lookup_5\n else\n csv_file = ''\n end\n puts 'Use default occupancy schedule file at: ' + csv_file.to_s\n runner.registerInfo('Use default occupancy schedule file at: ' + csv_file.to_s)\n end\n\n # Get the spaces with occupancy count schedule available\n v_spaces_occ_sch = File.readlines(csv_file)[3].split(',') # Room ID is saved in 4th row of the occ_sch file\n v_headers = Array.new\n v_spaces_occ_sch.each do |space_occ_sch|\n if !['Room ID', 'Outdoor', 'Outside building'].include? space_occ_sch and !space_occ_sch.strip.empty?\n v_headers << space_occ_sch\n end\n end\n v_headers = [\"Time\"] + v_headers\n\n # report initial condition of model\n runner.registerInfo(\"The building has #{v_headers.length - 1} spaces with available occupant schedule file.\")\n\n # Read the occupant count schedule file and clean it\n clean_csv = File.readlines(csv_file).drop(6).join\n csv_table_sch = CSV.parse(clean_csv, headers: true)\n new_csv_table = csv_table_sch.by_col!.delete_if do |column_name, column_values|\n !v_headers.include? column_name\n end\n\n runner.registerInfo(\"Successfully read occupant count schedule from CSV file.\")\n runner.registerInfo(\"Creating new lighting schedules...\")\n\n # Create lighting schedule based on the occupant count schedule\n v_cols = Array.new\n v_ts = new_csv_table.by_col!['Time']\n v_headers.each do |header|\n if header != 'Time'\n space_name = header\n v_occ_n = new_csv_table.by_col![space_name]\n v_light = create_lighting_sch_from_occupancy_count(space_name, v_ts, v_occ_n, @@off_delay)\n v_cols << v_light\n end\n end\n\n runner.registerInfo(\"Writing new lighting schedules to CSV file.\")\n # Write new lighting schedule file to CSV\n file_name_light_sch = \"#{model_temp_run_path}/#{@@lighting_schedule_CSV_name}\"\n vcols_to_csv(v_cols, file_name_light_sch)\n\n # Add new lighting schedule from the CSV file created\n runner.registerInfo(\"Removing old OS:Lights and OS:Lights:Definition for office and conference rooms.\")\n # Remove old lights definition objects for office and conference rooms\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights definition object: ' + lght.lightsDefinition.name.to_s\n lght.lightsDefinition.remove\n end\n end\n end\n end\n\n # Remove old lights objects for office and conference rooms\n # Caution: the order of deletion matters\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights object: ' + lght.name.to_s\n lght.remove\n end\n end\n end\n end\n\n puts '---> Create new lighting schedules from CSV.'\n\n runner.registerInfo(\"Adding new OS:Schedule:File objects to the model....\")\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n v_headers.each_with_index do |s_space_name, i|\n if s_space_name == space.name.to_s\n col = i\n temp_file_path = file_name_light_sch\n sch_file_name = space.name.to_s + ' lght sch'\n schedule_file = get_os_schedule_from_csv(model, temp_file_path, sch_file_name, col, skip_row = 1)\n schedule_file.setMinutesperItem(@@minute_per_item.to_s)\n model = add_light(model, space, schedule_file)\n end\n end\n end\n\n # report final condition of model\n runner.registerFinalCondition(\"Finished creating and adding new lighting schedules for #{v_headers.length - 1} spaces.\")\n\n return true\n end",
"def span\n measure\n @span\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # System Type 2: PTHP, Residential\n # This measure creates:\n # a constant volume packaged terminal heat pump unit with DX heating \n # and cooling for each zone in the building\n \n always_on = model.alwaysOnDiscreteSchedule\n\n # Make a PTHP for each zone\n model.getThermalZones.each do |zone|\n \n fan = OpenStudio::Model::FanConstantVolume.new(model,always_on)\n fan.setPressureRise(300)\n\n supplemental_htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model,always_on)\n\n clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_cap_f_of_temp.setCoefficient1Constant(0.942587793)\n clg_cap_f_of_temp.setCoefficient2x(0.009543347)\n clg_cap_f_of_temp.setCoefficient3xPOW2(0.0018423)\n clg_cap_f_of_temp.setCoefficient4y(-0.011042676)\n clg_cap_f_of_temp.setCoefficient5yPOW2(0.000005249)\n clg_cap_f_of_temp.setCoefficient6xTIMESY(-0.000009720)\n clg_cap_f_of_temp.setMinimumValueofx(17.0)\n clg_cap_f_of_temp.setMaximumValueofx(22.0)\n clg_cap_f_of_temp.setMinimumValueofy(13.0)\n clg_cap_f_of_temp.setMaximumValueofy(46.0)\n\n clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_cap_f_of_flow.setCoefficient1Constant(0.718954)\n clg_cap_f_of_flow.setCoefficient2x(0.435436)\n clg_cap_f_of_flow.setCoefficient3xPOW2(-0.154193)\n clg_cap_f_of_flow.setMinimumValueofx(0.75)\n clg_cap_f_of_flow.setMaximumValueofx(1.25)\n\n clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(0.342414409)\n clg_energy_input_ratio_f_of_temp.setCoefficient2x(0.034885008)\n clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(-0.000623700)\n clg_energy_input_ratio_f_of_temp.setCoefficient4y(0.004977216)\n clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.000437951)\n clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.000728028)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofx(17.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofx(22.0)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofy(13.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofy(46.0)\n\n clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.1552)\n clg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.1808)\n clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0256)\n clg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.5)\n clg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.5)\n\n clg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n clg_part_load_fraction.setCoefficient1Constant(0.75)\n clg_part_load_fraction.setCoefficient2x(0.25)\n clg_part_load_fraction.setCoefficient3xPOW2(0.0)\n clg_part_load_fraction.setMinimumValueofx(0.0)\n clg_part_load_fraction.setMaximumValueofx(1.0)\n\n clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(model,\n always_on,\n clg_cap_f_of_temp,\n clg_cap_f_of_flow,\n clg_energy_input_ratio_f_of_temp,\n clg_energy_input_ratio_f_of_flow,\n clg_part_load_fraction)\n\n htg_cap_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_temp.setCoefficient1Constant(0.758746)\n htg_cap_f_of_temp.setCoefficient2x(0.027626)\n htg_cap_f_of_temp.setCoefficient3xPOW2(0.000148716)\n htg_cap_f_of_temp.setCoefficient4xPOW3(0.0000034992)\n htg_cap_f_of_temp.setMinimumValueofx(-20.0)\n htg_cap_f_of_temp.setMaximumValueofx(20.0)\n\n htg_cap_f_of_flow = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_flow.setCoefficient1Constant(0.84)\n htg_cap_f_of_flow.setCoefficient2x(0.16)\n htg_cap_f_of_flow.setCoefficient3xPOW2(0.0)\n htg_cap_f_of_flow.setCoefficient4xPOW3(0.0)\n htg_cap_f_of_flow.setMinimumValueofx(0.5)\n htg_cap_f_of_flow.setMaximumValueofx(1.5)\n\n htg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_energy_input_ratio_f_of_temp.setCoefficient1Constant(1.19248)\n htg_energy_input_ratio_f_of_temp.setCoefficient2x(-0.0300438)\n htg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(0.00103745)\n htg_energy_input_ratio_f_of_temp.setCoefficient4xPOW3(-0.000023328)\n htg_energy_input_ratio_f_of_temp.setMinimumValueofx(-20.0)\n htg_energy_input_ratio_f_of_temp.setMaximumValueofx(20.0)\n\n htg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n htg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.3824)\n htg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.4336)\n htg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0512)\n htg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.0)\n htg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.0)\n\n htg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n htg_part_load_fraction.setCoefficient1Constant(0.75)\n htg_part_load_fraction.setCoefficient2x(0.25)\n htg_part_load_fraction.setCoefficient3xPOW2(0.0)\n htg_part_load_fraction.setMinimumValueofx(0.0)\n htg_part_load_fraction.setMaximumValueofx(1.0)\n\n htg_coil = OpenStudio::Model::CoilHeatingDXSingleSpeed.new( model,\n always_on,\n htg_cap_f_of_temp,\n htg_cap_f_of_flow,\n htg_energy_input_ratio_f_of_temp,\n htg_energy_input_ratio_f_of_flow,\n htg_part_load_fraction ) \n\n pthp = OpenStudio::Model::ZoneHVACPackagedTerminalHeatPump.new(model,\n always_on, \n fan,\n htg_coil,\n clg_coil,\n supplemental_htg_coil)\n\n pthp.setName(\"#{zone.name} PTHP\")\n pthp.addToThermalZone(zone)\n\n end\n\n \n return true\n \n end"
] |
[
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.62425435",
"0.62203735",
"0.6198304",
"0.6196627",
"0.6196627",
"0.61319697",
"0.6107745",
"0.60714525",
"0.60513526",
"0.601827",
"0.6008391",
"0.6008391",
"0.60008335",
"0.5976995",
"0.59641606",
"0.5962238",
"0.5958165",
"0.59570605",
"0.59570605",
"0.59439784",
"0.5934565",
"0.5928137",
"0.5920926",
"0.5916211",
"0.59129107",
"0.5911706",
"0.59022516",
"0.5872101",
"0.5865909",
"0.58645797",
"0.5847354",
"0.583844",
"0.58373237",
"0.57887447",
"0.5772885",
"0.57687855",
"0.5756301",
"0.5745138",
"0.5740855",
"0.5723286",
"0.57180965",
"0.5713821",
"0.5698708",
"0.5697907",
"0.56978434",
"0.56891346",
"0.5688938",
"0.5685465",
"0.56740844",
"0.5662743",
"0.5649326",
"0.56483626",
"0.5646554",
"0.56390476",
"0.56390476",
"0.5633756",
"0.56218606",
"0.56218606",
"0.5608723",
"0.5608213",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.559522",
"0.559522",
"0.559522",
"0.55878526",
"0.558349",
"0.55677843",
"0.5567233",
"0.5564496",
"0.55636495",
"0.55590993",
"0.5556679",
"0.5547891"
] |
0.0
|
-1
|
Build the url to be called using this class' +base_url+ and a +word+. Returns an url to where +word+'s synonyms can be obtained.
|
def build_call_url(word)
URI.parse(URI.escape(base_url + word))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_lesson_word_synonym\n begin\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n @lesson_word_synonym = LessonWordSynonym.find_by!(synonym_id: params[:synonym_id], lesson_word_id: params[:lesson_word_id])\n end\n end",
"def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end",
"def fetch_adword_url_top(adword)\n\t\t\"http://#{adword.text}\"\n\tend",
"def initialize(word)\n @url = \"https://www.google.com/search?q=define%3A+#{word}\"\n @noko = correct_site()\n @word_info = get_definition()\n end",
"def generate_url\n\t\tself.url ||= name.parameterize\n\tend",
"def synonyms; end",
"def fetch_adword_url_right(adword)\n\t\tadword.text\n\tend",
"def search_url(term='')\n param = URI.encode_www_form('term' => term)\n \"http://api.urbandictionary.com/v0/define?#{param}\"\n end",
"def search_url(term, opts = {})\n param = URI.encode_www_form(\"term\" => term)\n\n if opts[:api] != false\n \"#{API_ROOT}/define?#{param}\"\n else\n \"#{WWW_ROOT}/define.php?#{param}\"\n end\n end",
"def full_shortened_url(base)\n base + '/' + short_url\n end",
"def ward_url\n \"/ward/\"+self.name.sub(/^St\\./,'St').gsub(' ','_')\n end",
"def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end",
"def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end",
"def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end",
"def make_url\n # This works for most of the twitter calls\n \"http://ws.audioscrobbler.com/2.0/?method=#{resource_path}&artist=#{identifier}&limit=100&page=#{page}&api_key=#{api_key}&format=json\"\n end",
"def url\n \"http://twitter.com/search/?q=\" + self.query\n end",
"def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[no negative incorrect false],\n /^update$/i => %w[update change modify revise alter edit adjust],\n /^updated$/i => %w[updated changed modified revised altered edited adjusted],\n /^add$/i => %w[add create],\n /^added$/i => %w[added created],\n /^what|how$/i => %w[how what]\n }\n end",
"def url(prefix, stem)\n if prefix == ''\n \"/#{stem}/#{self.id}\"\n else\n \"#{prefix}/#{stem}/#{self.id}\"\n end\n end",
"def get_synonym_for(word, country = nil, age_from = nil, age_to = nil,\n gender = nil, education = nil)\n keyword = Keyword.find_by_name(word)\n\n if keyword.blank?\n Keyword.add_keyword_to_database(word)\n return nil\n end\n\n if self.project.present?\n prefered_synonym = PreferedSynonym\n .where(keyword_id: keyword.id, project_id: self.project.id).first\n return prefered_synonym.synonym if prefered_synonym.present?\n\n country = self.project.country unless country.present?\n age_from = self.project.minAge unless age_from.present?\n age_to = self.project.maxAge unless age_to.present?\n gender = self.project.gender unless gender.present?\n education = self.project.education_level unless education.present?\n end\n\n synonym_list, votes_count =\n keyword.retrieve_synonyms(country, age_from, age_to, gender, education)\n synonym_list.first\n end",
"def lesson_word_synonym_params\n params.require(:lesson_word_synonym).permit(:lesson_word_id, :synonym_id)\n end",
"def to_url\n return if nil?\n\n s = downcase.tr(\"\\\"'\", \"\")\n s = s.gsub(/\\P{Word}/, \" \")\n s.strip.tr_s(\" \", \"-\").tr(\" \", \"-\").sub(/^$/, \"-\")\n end",
"def fetch_nonadword_url(adword)\n\t\tadword.text\n\tend",
"def set_word\n @word = Word.friendly.find(params[:id])\n end",
"def create\n\n @word = Word.new(word_params)\n word_params[:meanings_attributes][:word_id] = @word.id\n\n if word_params[:synonymous_attributes]!=nil\n word_params[:synonymous_attributes][:word_id] = @word.id\n end\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def construct_url\n @@API_URL + city + @@API_KEY\n end",
"def create_url(keyword)\n base_url = 'https://yandex.ru/search/xml?'\n tail_url = '&groupby=attr%3Dd.mode%3Ddeep.groups-on-page%3D100.docs-in-group%3D1'\n query_url = URI.encode_www_form([['user', @user], ['key', @key], ['query', keyword], ['lr', @region]])\n\n base_url + query_url + tail_url\n end",
"def build_url(params)\n \"#{@base_url}?#{params.to_query}\"\n end",
"def bp_ont_link(ont_acronym)\n return \"/ontologies/#{ont_acronym}\"\n end",
"def generate_search_url\n begin\n if self.search_url.blank? && job.county.search_template_url.present?\n params = generate_search_params.to_s\n if job.county.search_method == \"GET\"\n self.search_url = job.county.search_template_url.gsub(/\\{\\{params\\}\\}/, \"?#{params}\")\n end\n end\n rescue\n # don't worry if something went wrong generating the url\n end\n end",
"def build_request_url(params)\n \"http://api.nytimes.com/svc/search/v2/articlesearch.json?\"+params\n end",
"def build_url(url_suffix)\n return @base_url+url_suffix\nend",
"def replacer\n lambda do |resource_id, _graph|\n parent_id = Hyrax.config.translate_uri_to_id.call(parent_url)\n return parent_url + resource_id.sub(parent_id, '') if resource_id.start_with?(parent_id)\n Rails.application.routes.url_helpers.solr_document_url(resource_id, host: hostname)\n end\n end",
"def url_for_taxon(taxon)\n new_url = self.url.sub('[NAME]', taxon.name)\n if taxon.species_or_lower? && pieces = taxon.name.split\n new_url.sub!('[GENUS]', pieces.first)\n new_url.sub!('[SPECIES]', pieces[1] || '')\n else\n new_url.sub!(/\\[GENUS\\].*\\[SPECIES\\]/, taxon.name)\n end\n new_url\n end",
"def htlal_wiki_url\n \"http://learnanylanguage.wikia.com/wiki/#{name.gsub(' ', '_')}\"\n end",
"def build_slug\n return unless new_slug_needed?\n self.slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self)\n end",
"def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end",
"def synonyms(word, options = {})\r\n\t\t\tresponse = call(word)\r\n\t\t\tdoc = Nokogiri.HTML(response)\r\n\t\t\tsynonyms = Array.new\r\n\t\t\tdoc.css('#wordcloud1 > span').each do |synonym|\r\n\t\t\t\tscore = Integer(synonym.values[0])\r\n\r\n\t\t\t\tsynonyms.push({\r\n\t\t\t\t\tword: synonym.inner_html,\r\n\t\t\t\t\tscore: score\r\n\t\t\t\t}) unless score < 75\r\n\t\t\t\t# A minimum score of 75 is considered because educalingo\r\n\t\t\t\t# tends to have completely unrelated words around this score\r\n\t\t\tend\r\n\r\n\t\t\treturn synonyms\r\n\t\tend",
"def generate_short_url(base_url)\n build_shorten_url.update( uniq_id: shorten, expired_at: Time.now.utc + 1.year ) unless shorten_url\n shorten_url.link(base_url)\n end",
"def api_url\n @api_url ||= URI.parse(\"#{super}?#{URI.encode_www_form(query_params)}\")\n end",
"def synonym(existing_word, *synonyms)\n existing_word = existing_word.to_s\n raise \"'#{existing_word}' is not in the vocabulary\" if type(existing_word).nil?\n reduced_form = reduce(existing_word)\n [synonyms].flatten.each do |syn|\n syn = syn.to_s\n existing_definition = @type_map[syn]\n if existing_definition.nil?\n @type_map[syn] = reduced_form\n elsif existing_definition != reduced_form\n raise \"'#{syn}' is already defined and is incompatible as a synonym of #{existing_word}\"\n end\n end\n end",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def wikipedia\n uri = nil\n @artist_data[\"relations\"].each do |rel|\n if rel[\"type\"] == \"wikipedia\"\n uri = rel[\"url\"][\"resource\"]\n end\n end\n return uri\n end",
"def url_for_taxon(taxon)\n new_url = url.sub('[NAME]', taxon.name)\n new_url = new_url.sub('[RANK]', taxon.rank)\n new_url = new_url.sub('[NAME_WITH_RANK]', taxon.name_with_rank)\n if taxon.species_or_lower? && pieces = taxon.name.split\n new_url.sub!('[GENUS]', pieces.first)\n new_url.sub!('[SPECIES]', pieces[1] || '')\n else\n new_url.sub!(/\\[GENUS\\].*\\[SPECIES\\]/, taxon.name)\n end\n new_url\n end",
"def word_string_short(word)\n \"#{word.morphword} #{word.input}->#{word.output}\"\n end",
"def url\n URL_MAPPING[@docid]\n end",
"def get_related_words(word, *args)\n http_method = :get\n path = '/word/{word}/relatedWords'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def gen_url url, text\n return super unless url =~ /\\Ardoc-ref:/\n\n name = $'\n cross_reference name, text, name == text\n end",
"def build_uri\n url = \"https://maps.googleapis.com/maps/api/directions/json\"\n uri = URI(url)\n uri.query = \"\"\n @params.each {|k, v| uri.query << \"#{k}=#{v}&\" }\n uri.query = uri.query.chop\n return uri\n end",
"def show\n @meanings = Meaning.where(word_id: @word.id)\n @synonymous = Synonymou.all\n end",
"def url_was\n \"#{self.class.url}/#{slug_was}\"\n end",
"def set_search_base_distinguished_name(opts)\n opts = check_params(opts,[:search_base_dns])\n super(opts)\n end",
"def make_url(params) #:nodoc:\n super params.merge(:output => \"xml\", :oe => 'utf8', :ll => @ll, :spn => @spn, :sensor => false)\n end",
"def build_path(target_word)\n # debugger\n source_to_target_path = [target_word]\n current_word = target_word\n prev_word = @all_seen_words[current_word]\n\n until prev_word.nil?\n source_to_target_path.unshift(prev_word)\n current_word = prev_word\n prev_word = @all_seen_words[current_word]\n end\n @path = source_to_target_path\n @path\n end",
"def build_url(action)\n \"#{@base_url}#{action}\"\n end",
"def add_word_view(word, *args)\n http_method = :post\n path = '/word/{word}/wordView'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def wikipedia_link\n\t\tp = localized_page\n\t\tbase = \"https://#{langtag(I18n.locale)}.wikipedia.org\"\n\t\treturn base unless p && p.title\n\t\t\"#{base}/wiki/#{p.title}\"\n\tend",
"def build_query_url(q)\n escaped_query = clean_query_string q\n index = AssignFast.index_for_authority(subauthority)\n return_data = \"#{index}%2Cidroot%2Cauth%2Ctype\"\n num_rows = 20 # max allowed by the API\n \"http://fast.oclc.org/searchfast/fastsuggest?&query=#{escaped_query}&queryIndex=#{index}&queryReturn=#{return_data}&suggest=autoSubject&rows=#{num_rows}\"\n end",
"def build_tiny_url\n self.tiny_url = Token.generate_url\n end",
"def build_uri(resource)\n URI(\"#{API_URL}/#{resource}\")\n end",
"def synonyms\n @synonyms ||= self.class.synonyms\n @synonyms\n end",
"def word_params\n params.require(:word).permit(:text, :meanings_attributes => [:id, :text, :word_id, :category_id, :_destroy], :synonymous_attributes => [:id, :word_2_id, :_destroy])\n end",
"def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end",
"def complete_url(url, base)\n if url.start_with?(\"/\")\n resource_uri = base + url\n else\n resource_uri = url\n end \n return resource_uri\n end",
"def add_synonym(synonym)\n synonyms << synonym\n end",
"def shorten_link\n # http://stackoverflow.com/questions/88311/how-best-to-generate-a-random-string-in-ruby\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n string = (0...6).map { o[rand(o.length)] }.join\n self.short_url = \"http://www.sho.rt/#{string}\"\n end",
"def link_wikipedia(term, desc)\n # query = Rack::Utils.escape(\"site:wikipedia.org #{term}\")\n # href = \"http://google.com/?q=#{query}\"\n term = Rack::Utils.escape(term)\n tag(:a, desc, :href => \"http://en.wikipedia.org/w/#{term}\", :class => 'wiki-link-external')\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def morphword=(mw)\n @morphword = mw\n end",
"def word_params\n params.require(:word).permit(:word, :tag_list, definitions_attributes: [:definition, :URL])\n end",
"def []( word, *args )\n\t\tif word.is_a?( Integer )\n\t\t\t# :TODO: Assumes Synset IDs are all >= 100_000_000\n\t\t\tif word.to_s.length > 8\n\t\t\t\treturn WordNet::Synset[ word ]\n\t\t\telse\n\t\t\t\treturn WordNet::Word[ word ]\n\t\t\tend\n\t\telse\n\t\t\treturn self.lookup_synsets( word, 1, *args ).first\n\t\tend\n\tend",
"def search(wd)\n\tpage = Query::Engine::Baidu.query(wd)\n\t#page.seo_rank #it seems that the seo_rank of baidu is not complete crawled the search page\n\trelated_keywords_baidu = page.related_keywords \n\trelated_keywords_baidu.each do |keywords| # save each keywords into database unless the word is exist already.\n\t\tnext unless RelateWorld.find_by_keyword(keywords) == nil\n\t\trelate = RelateWorld.new\n\t\trelate.keyword = keywords\n\t\trelate.save\n\tend \nend",
"def wikipedia_url\n \"http://en.wikipedia.org/wiki/ISO_639:#{iso_639}\"\n end",
"def research_sites(search_str)\n search_sites = link_to \"Google\", 'http://www.google.com/search?q=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Yahoo\", 'http://search.yahoo.com/search?p=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Technorati\", 'http://www.technorati.com/search' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Wikipedia\", 'http://en.wikipedia.org/w/wiki.phtml?search=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"del.icio.us\", 'http://del.icio.us/search/?all=' + search_str, :target => '_blank'\n end",
"def url_create(state_code, city_name)\n 'http://en.m.wikipedia.org/wiki/' + self.url_suffix_create(state_code, city_name)\n end",
"def _url\n URI.join(domain, path_gen.for_uri)\n end",
"def build_url(input)\n url = \"#{GOOGLE_BOOKS_API_BASE_URL}#{input}\"\n url\nend",
"def shorten_urls\n @status = (@status.split(\" \").collect do |word|\n if word =~ URI::regexp and word.length > 30 then\n # using tinyurl\n # NOTE: look into retwt.me, they have a simple api (w/o auth) and provide analysis\n (Net::HTTP.post_form URI.parse('http://tinyurl.com/api-create.php'),{\"url\" => word}).body\n else\n word\n end\n end).join(\" \")\n end",
"def build_url\n unless key && key.length > 0\n raise ArgumentError, 'Missing API key parameter. Visit http://developer.oodle.com/request-api-key/ to get one.'\n end\n\n unless region && region.length > 0\n raise ArgumentError, 'Missing region paramter. Visit http://developer.oodle.com/regions-list/ for possible regions.'\n end\n\n unless (category && category.length > 0) || (q && q.length > 0)\n raise ArgumentError, 'You must supply a category or query parameter. Visit http://developer.oodle.com/categories-list/ for possible categories.'\n end\n\n unless num.to_i >= 1 && num.to_i <= 50\n warn \"num parameter is #{num.to_i} but should be between 1 and 50\"\n end\n\n url = VERSION_URLS[self.version]\n url += \"?\" unless url && url[-1] == '?'\n # must CGI escape each param value\n url = \"#{url}key=#{CGI::escape(self.key)}\"\n url = \"#{url}®ion=#{CGI::escape(self.region)}\" if self.region\n url = \"#{url}&category=#{CGI::escape(self.category)}\" if self.category\n url = \"#{url}&q=#{CGI::escape(self.q)}\" if self.q\n url = \"#{url}&attributes=#{CGI::escape(self.attributes_as_string)}\" if self.attributes.size > 0\n url = \"#{url}&location=#{CGI::escape(self.location)}\" if self.location\n url = \"#{url}&radius=#{CGI::escape(self.radius.to_s)}\" if self.radius\n url = \"#{url}&start=#{CGI::escape(self.start.to_s)}\" if self.start\n url = \"#{url}&num=#{CGI::escape(self.num.to_s)}\" if self.num\n url = \"#{url}&sort=#{CGI::escape(self.sort)}\" if self.sort\n url = \"#{url}&refinements=#{CGI::escape(self.refinements_as_string)}\" if self.refinements.size > 0\n url = \"#{url}&ctime_low=#{CGI::escape(self.ctime_low)}\" if self.ctime_low\n url = \"#{url}&ctime_high=#{CGI::escape(self.ctime_high)}\" if self.ctime_high\n url = \"#{url}&exclude_sources=#{CGI::escape(self.exclude_sources_as_string)}\" if self.exclude_sources.size > 0\n url = \"#{url}&assisted_search=#{CGI::escape(self.assisted_search)}\" if self.assisted_search\n url = \"#{url}&format=#{CGI::escape(self.format)}&jsoncallback=none\" if self.format\n url\n end",
"def makeURL(path)\n \"#{self.api_endpt + path}?token=#{self.token}\"\n end",
"def url() \n\t #'http://' << ENV['DOMAIN'] << \n\t '/' << self.author.username.to_s << '/' << self.name.to_s\n end",
"def build_url(wonder)\n google_api_key = \"AIzaSyBP30mYnbwKpZ0lCHtp6FuvcNSjNG0GsGM\"\n geocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{wonder}&key=#{google_api_key}\"\n encoded_url = URI.encode(geocode_url)\n return encoded_url\nend",
"def url\n return @url if @url\n\n url = permalink ?\n if site.config['relative_permalinks']\n File.join(@dir, permalink)\n else\n permalink\n end :\n {\n 'lang' => self.lang,\n 'categories' => self.categories,\n 'basename' => self.basename,\n }.inject(template) { |result, token|\n result.gsub(/:#{token.first}/, token.last)\n }.gsub(/\\/\\//, '/')\n\n # sanitize url\n @url = url.split('/').reject { |part| part =~ /^\\.+$/ }.join('/')\n @url += '/' if url =~ /\\/$/\n @url.gsub!(/\\A([^\\/])/, '/\\1')\n @url\n end",
"def build(words)\n words.each do |word|\n self.add(word)\n end\n end",
"def generate_short_url\n new_short = \"/\" + Faker::Lorem.characters(7)\n until short_url_unique?(new_short)\n new_short = \"/\" + Faker::Lorem.characters(7)\n end\n self.short_url = new_short\n end",
"def direct_hypernyms(word, part_of_speech)\n if Relations.map.keys.include? word\n return [word]\n else\n # look in wordnet\n synsets = @wordnet.lookup_synsets(word, part_of_speech) \n \n hypernyms = Set.new\n \n # get all hypernyms from wordnet\n synsets.each { |ss|\n ss.hypernyms.each { |synset|\n synset.words.each { |w|\n hypernyms << w.lemma\n }\n }\n }\n \n #check these with the mappings\n return hypernyms.to_a & Relations.map.keys.to_a\n end\n end",
"def build_uri\n URI.parse(base_url + \"?\" + query_params)\n end",
"def base_url\n \"https://api.twitter.com\"\n end",
"def build_url(path, params={})\n full_path = @uri.path + path\n\n super full_path, params, @uri.query\n end",
"def lookup_synsets( word, *args )\n\t\tdataset = WordNet::Synset.filter( :words => WordNet::Word.filter(lemma: word.to_s) )\n\t\tself.log.debug \"Looking up synsets for %p\" % [ word.to_s ]\n\n\t\t# Add filters to the dataset for each argument\n\t\targs.each do |arg|\n\t\t\tself.log.debug \" constraint arg: %p\" % [ arg ]\n\t\t\tcase arg\n\n\t\t\twhen Integer\n\t\t\t\tself.log.debug \" limiting to sense %d\" % [ arg ]\n\t\t\t\tdataset = dataset.limit( 1, arg-1 )\n\n\t\t\twhen Range\n\t\t\t\tself.log.debug \" limiting to range of senses: %p\" % [ arg ]\n\t\t\t\tdataset = dataset.limit( arg.end - arg.begin, arg.begin - 1 )\n\n\t\t\twhen Regexp\n\t\t\t\tself.log.debug \" filter: definition =~ %p\" % [ arg ]\n\t\t\t\tdataset = dataset.filter( definition: arg )\n\n\t\t\twhen Symbol, String\n\t\t\t\t# Lexical domain, e.g., \"verb.motion\"\n\t\t\t\tif domain = WordNet::Synset.lexdomains[ arg.to_s ]\n\t\t\t\t\tself.log.debug \" filter: lex domain: %s (%d)\" % [ arg, domain[:lexdomainid] ]\n\t\t\t\t\tdataset = dataset.filter( lexdomainid: domain[:lexdomainid] )\n\n\t\t\t\t# Part of speech symbol, e.g., \"v\"\n\t\t\t\telsif WordNet::Synset.postype_table.key?( arg.to_sym )\n\t\t\t\t\tself.log.debug \" filter: part of speech: %s\" % [ arg ]\n\t\t\t\t\tdataset = dataset.filter( pos: arg.to_s )\n\n\t\t\t\t# Part of speech name, e.g., \"verb\"\n\t\t\t\telsif pos = WordNet::Synset.postypes[ arg.to_s ]\n\t\t\t\t\tself.log.debug \" filter: part of speech: %s\" % [ pos.to_s ]\n\t\t\t\t\tdataset = dataset.filter( pos: pos.to_s )\n\n\t\t\t\t# Assume it's a definition match\n\t\t\t\telse\n\t\t\t\t\tpattern = \"%%%s%%\" % [ arg ]\n\t\t\t\t\tself.log.debug \" filter: definition LIKE %p\" % [ pattern ]\n\t\t\t\t\tdataset = dataset.filter { :definition.like(pattern) }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn dataset.all\n\tend",
"def shorten\n request = {\n body: { longUrl: url }.to_json,\n headers: { 'Content-Type' => 'application/json' },\n query: { key: api_key, \n access_token: access_token }\n }\n\n request.merge!({ http_proxyaddr: proxy.host, \n http_proxyport: proxy.port, \n http_proxyuser: proxy.user, \n http_proxypass: proxy.password }) if proxy\n\n Timeout::timeout(timeout) do\n # submit the url to Goo.gl\n result = self.class.post(\"/urlshortener/v1/url\", request)\n # return the response id or the url\n result.parsed_response[\"id\"] || url\n end\n # if a problem occurs\n rescue Timeout::Error, JSON::ParserError => e\n # just return the original url\n url\n end",
"def get_related(word, *args)\n http_method = :get\n path = '/word/{word}/related'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def full_url\n if school_site.start_with? 'http://'\n school_site\n else\n \"http://#{school_site}\"\n end\n end",
"def get_wiki_url(query)\n search_keywords = query.strip.gsub(/\\s+/,'+')\n url = \"http://www.google.com/search?q=#{search_keywords}+site%3Aen.wikipedia.org&safe=active\"\n begin\n doc = Hpricot(open(url, \"UserAgent\" => \"reader\"+rand(10000).to_s).read)\n result = doc.search(\"//div[@id='ires']\").search(\"//li[@class='g']\").first.search(\"//a\").first\n rescue\n return ''\n end\n if result\n return result.attributes[\"href\"]\n else\n return ''\n end\n end",
"def build_slug\n return unless new_slug_needed?\n @slug = slugs.new(:name => slug_text, :scope => friendly_id_config.scope_for(self))\n raise FriendlyId::BlankError unless @slug.valid?\n @new_friendly_id = @slug.to_friendly_id\n @slug\n end",
"def canonical_url(*args)\n http_prefix + args.join('/')\n end",
"def build_request_url\n \"http://snipr.com/site/snip?r=simple&link=#{ensure_http}\"\n end",
"def generate_slug\n self.slug = name.parameterize if name.present?\n end",
"def conceptwiki_ep_search\n\t\tOPS_API_FREETEXT_SEARCH_URL\n\tend",
"def url\n\t\t\"#{base}/wiki/#{page}\"\n\tend",
"def short_url\n @short_url ||= client.shorten(long_url: url).link\n rescue => e\n Rails.logger.warn(\"Could not shorten bit.ly url #{e.message}\")\n url\n end"
] |
[
"0.5757154",
"0.57283103",
"0.55813503",
"0.55706763",
"0.545224",
"0.54491234",
"0.54320055",
"0.53744864",
"0.5324914",
"0.5320462",
"0.5312278",
"0.52938926",
"0.52938926",
"0.52938926",
"0.5291178",
"0.52752894",
"0.5244829",
"0.5220654",
"0.5218501",
"0.5127033",
"0.51208216",
"0.5106093",
"0.50875926",
"0.50728136",
"0.50594586",
"0.50505126",
"0.5038886",
"0.5034818",
"0.5029971",
"0.5024839",
"0.5009029",
"0.50078833",
"0.49996373",
"0.4998719",
"0.49879193",
"0.4984256",
"0.49763688",
"0.496497",
"0.4946699",
"0.4938338",
"0.49362707",
"0.49203777",
"0.49134117",
"0.49133006",
"0.48988536",
"0.4893171",
"0.48892707",
"0.4884376",
"0.48661998",
"0.4862676",
"0.48510432",
"0.48457262",
"0.48439902",
"0.48400545",
"0.48397258",
"0.482772",
"0.48253572",
"0.48221985",
"0.48206046",
"0.48190174",
"0.48177618",
"0.48068473",
"0.47933435",
"0.478813",
"0.4784742",
"0.4773415",
"0.47707623",
"0.4766702",
"0.4743128",
"0.4737558",
"0.47348967",
"0.4723805",
"0.47164637",
"0.47125348",
"0.47032428",
"0.46961784",
"0.4694998",
"0.4693611",
"0.4691743",
"0.4691371",
"0.46885943",
"0.468629",
"0.4683268",
"0.46813214",
"0.46809897",
"0.46808365",
"0.4680394",
"0.46796164",
"0.46673182",
"0.46669823",
"0.46666026",
"0.46627024",
"0.46601522",
"0.4659255",
"0.4653445",
"0.46499354",
"0.46452102",
"0.4643796",
"0.46431884",
"0.4638023"
] |
0.6646363
|
0
|
Obtain synonyms of a +word+ from Educalingo.
|
def synonyms(word, options = {})
response = call(word)
doc = Nokogiri.HTML(response)
synonyms = Array.new
doc.css('#wordcloud1 > span').each do |synonym|
score = Integer(synonym.values[0])
synonyms.push({
word: synonym.inner_html,
score: score
}) unless score < 75
# A minimum score of 75 is considered because educalingo
# tends to have completely unrelated words around this score
end
return synonyms
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[no negative incorrect false],\n /^update$/i => %w[update change modify revise alter edit adjust],\n /^updated$/i => %w[updated changed modified revised altered edited adjusted],\n /^add$/i => %w[add create],\n /^added$/i => %w[added created],\n /^what|how$/i => %w[how what]\n }\n end",
"def synonyms; end",
"def []( word, *args )\n\t\tif word.is_a?( Integer )\n\t\t\t# :TODO: Assumes Synset IDs are all >= 100_000_000\n\t\t\tif word.to_s.length > 8\n\t\t\t\treturn WordNet::Synset[ word ]\n\t\t\telse\n\t\t\t\treturn WordNet::Word[ word ]\n\t\t\tend\n\t\telse\n\t\t\treturn self.lookup_synsets( word, 1, *args ).first\n\t\tend\n\tend",
"def wordnet_lookup_syns(lemma, pos)\n # Convert back to wordnet format\n lemma = lemma.tr(' ', '_')\n if (wordnet_lemma = WordNet::Lemma.find(lemma, pos))\n # Fetch all synonyms (combining all senses of the word)\n wordnet_lemma.synsets.flat_map(&:words).map do |w|\n # Clean up the output\n # - Adjectives can have an adjective marker at their end which needs be\n # stripped. Eg. beautiful(ip), beautiful(p), beautiful(a)\n # - Replace underscores with spaces\n w.gsub(/\\([a-z]*\\)$/, '').tr('_', ' ')\n end\n else\n []\n end\n end",
"def synonym(existing_word, *synonyms)\n existing_word = existing_word.to_s\n raise \"'#{existing_word}' is not in the vocabulary\" if type(existing_word).nil?\n reduced_form = reduce(existing_word)\n [synonyms].flatten.each do |syn|\n syn = syn.to_s\n existing_definition = @type_map[syn]\n if existing_definition.nil?\n @type_map[syn] = reduced_form\n elsif existing_definition != reduced_form\n raise \"'#{syn}' is already defined and is incompatible as a synonym of #{existing_word}\"\n end\n end\n end",
"def get_synonym_for(word, country = nil, age_from = nil, age_to = nil,\n gender = nil, education = nil)\n keyword = Keyword.find_by_name(word)\n\n if keyword.blank?\n Keyword.add_keyword_to_database(word)\n return nil\n end\n\n if self.project.present?\n prefered_synonym = PreferedSynonym\n .where(keyword_id: keyword.id, project_id: self.project.id).first\n return prefered_synonym.synonym if prefered_synonym.present?\n\n country = self.project.country unless country.present?\n age_from = self.project.minAge unless age_from.present?\n age_to = self.project.maxAge unless age_to.present?\n gender = self.project.gender unless gender.present?\n education = self.project.education_level unless education.present?\n end\n\n synonym_list, votes_count =\n keyword.retrieve_synonyms(country, age_from, age_to, gender, education)\n synonym_list.first\n end",
"def get_synonym_set(engine_name, id)\n get(\"engines/#{engine_name}/synonyms/#{id}\")\n end",
"def Noun(word)\n Noun[word]\n end",
"def synonyms\n @synonyms ||= self.class.synonyms\n @synonyms\n end",
"def lookup_synsets( word, *args )\n\t\tdataset = WordNet::Synset.filter( :words => WordNet::Word.filter(lemma: word.to_s) )\n\t\tself.log.debug \"Looking up synsets for %p\" % [ word.to_s ]\n\n\t\t# Add filters to the dataset for each argument\n\t\targs.each do |arg|\n\t\t\tself.log.debug \" constraint arg: %p\" % [ arg ]\n\t\t\tcase arg\n\n\t\t\twhen Integer\n\t\t\t\tself.log.debug \" limiting to sense %d\" % [ arg ]\n\t\t\t\tdataset = dataset.limit( 1, arg-1 )\n\n\t\t\twhen Range\n\t\t\t\tself.log.debug \" limiting to range of senses: %p\" % [ arg ]\n\t\t\t\tdataset = dataset.limit( arg.end - arg.begin, arg.begin - 1 )\n\n\t\t\twhen Regexp\n\t\t\t\tself.log.debug \" filter: definition =~ %p\" % [ arg ]\n\t\t\t\tdataset = dataset.filter( definition: arg )\n\n\t\t\twhen Symbol, String\n\t\t\t\t# Lexical domain, e.g., \"verb.motion\"\n\t\t\t\tif domain = WordNet::Synset.lexdomains[ arg.to_s ]\n\t\t\t\t\tself.log.debug \" filter: lex domain: %s (%d)\" % [ arg, domain[:lexdomainid] ]\n\t\t\t\t\tdataset = dataset.filter( lexdomainid: domain[:lexdomainid] )\n\n\t\t\t\t# Part of speech symbol, e.g., \"v\"\n\t\t\t\telsif WordNet::Synset.postype_table.key?( arg.to_sym )\n\t\t\t\t\tself.log.debug \" filter: part of speech: %s\" % [ arg ]\n\t\t\t\t\tdataset = dataset.filter( pos: arg.to_s )\n\n\t\t\t\t# Part of speech name, e.g., \"verb\"\n\t\t\t\telsif pos = WordNet::Synset.postypes[ arg.to_s ]\n\t\t\t\t\tself.log.debug \" filter: part of speech: %s\" % [ pos.to_s ]\n\t\t\t\t\tdataset = dataset.filter( pos: pos.to_s )\n\n\t\t\t\t# Assume it's a definition match\n\t\t\t\telse\n\t\t\t\t\tpattern = \"%%%s%%\" % [ arg ]\n\t\t\t\t\tself.log.debug \" filter: definition LIKE %p\" % [ pattern ]\n\t\t\t\t\tdataset = dataset.filter { :definition.like(pattern) }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn dataset.all\n\tend",
"def synonyms(opts = {})\n self.meanings.uniq.collect { |ref| ref.tags }.flatten.uniq\n end",
"def synonyms #:nodoc:\n select_all(\"SELECT synonym_name, table_owner, table_name, db_link FROM all_synonyms where owner = SYS_CONTEXT('userenv', 'session_user')\").collect do |row|\n OracleEnhanced::SynonymDefinition.new(oracle_downcase(row[\"synonym_name\"]),\n oracle_downcase(row[\"table_owner\"]), oracle_downcase(row[\"table_name\"]), oracle_downcase(row[\"db_link\"]))\n end\n end",
"def get_synset_from_sense(wordid=nil)\n if wordid\n return @conn.execute(\"select synset from sense where wordid=?\", wordid)\n end\n return []\n end",
"def show\n @meanings = Meaning.where(word_id: @word.id)\n @synonymous = Synonymou.all\n end",
"def lookup_word(word)\n h = self.lookup_entry(word)\n [ h[:pronounce], h[:meaning] ]\n end",
"def lookup(word)\n word.gsub!(/\\s/, \"+\")\n meaning_file = initialize_files(word)[0]\n f = File.open(meaning_file)\n begin\n extract_text(f)\n rescue Exception\n raise\n end\n\n end",
"def direct_hypernyms(word, part_of_speech)\n if Relations.map.keys.include? word\n return [word]\n else\n # look in wordnet\n synsets = @wordnet.lookup_synsets(word, part_of_speech) \n \n hypernyms = Set.new\n \n # get all hypernyms from wordnet\n synsets.each { |ss|\n ss.hypernyms.each { |synset|\n synset.words.each { |w|\n hypernyms << w.lemma\n }\n }\n }\n \n #check these with the mappings\n return hypernyms.to_a & Relations.map.keys.to_a\n end\n end",
"def find_synonyms(synonyms)\n return self.find_helper(@start_node, synonyms)\n end",
"def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end",
"def stem(word)\n stems = []\n\n FFI::MemoryPointer.new(:pointer) do |output|\n count = Hunspell.Hunspell_stem(self,output,word.to_s)\n ptr = output.get_pointer(0)\n\n if count > 0\n stems = ptr.get_array_of_string(0,count)\n end\n end\n\n return stems.map { |word| force_encoding(word) }\n end",
"def get_word\n dictionary.get_word\n end",
"def lookup(word)\r\n @word.each do |h|\r\n if h[:Word] == word.to_s\r\n return h[:Definition]\r\n end\r\n end\r\n end",
"def suggest(word)\n suggestions = []\n\n FFI::MemoryPointer.new(:pointer) do |output|\n count = Hunspell.Hunspell_suggest(self,output,word.to_s)\n ptr = output.get_pointer(0)\n\n if count > 0\n suggestions = ptr.get_array_of_string(0,count)\n end\n end\n\n return suggestions.map { |word| force_encoding(word) }\n end",
"def morphword\n @morphword\n end",
"def next_words_for(word) \n if word.nil? or word.empty?\n generator_names \n else\n name_of_last_generator_inverse = word[-1].swapcase\n generator_names.find_all{|name| name != name_of_last_generator_inverse }.map{|name| word + name }\n end\n end",
"def get_term_from_synonym\n sql = <<-SQL\n select term.*\n from term\n join ontology on ontology.ontology_id = term.ontology_id\n join term_synonym on term.term_pk = term_synonym.term_pk\n where term_synonym.synonym_value = ?\n order by ontology.fully_loaded desc, ontology.load_date asc\n SQL\n \n term_set = OLS_DB[ sql, @name ].all()\n \n raise OntologyTermNotFoundError, \"Unable to find the term '#{@name}' in the OLS database.\" \\\n if term_set.size == 0\n \n subject = term_set.first\n @name = subject[:identifier]\n @content = subject[:term_name]\n @term_pk = subject[:term_pk]\n @ontology_id = subject[:ontology_id]\n end",
"def hint(word)\n\t\tget_definition(word) \n\tend",
"def _word\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_atom)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_quoted_string)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_word unless _tmp\n return _tmp\n end",
"def recursive_hypernyms(word, part_of_speech)\n if Relations.map.keys.include? word\n return [word]\n else\n # look in wordnet\n synsets = @wordnet.lookup_synsets(word, part_of_speech) \n \n hypernyms = Set.new\n \n synsets.each { |ss|\n ss.traverse(:hypernyms).each { |synset|\n synset.words.each { |w|\n hypernyms << w.lemma\n }\n }\n }\n \n #check these with the mappings\n return hypernyms.to_a & Relations.map.keys.to_a\n end\n end",
"def morphword\n input.morphword\n end",
"def acronym(word)\n @acronyms[word.downcase] = word\n define_acronym_regex_patterns\n end",
"def words\n @words ||= (\n word_suggestions = []\n spellcheck = self.response[:spellcheck]\n if spellcheck && spellcheck[:suggestions]\n suggestions = spellcheck[:suggestions]\n unless suggestions.nil?\n # suggestions is an array: \n # (query term)\n # (hash of term info and term suggestion) \n # ...\n # (query term)\n # (hash of term info and term suggestion) \n # 'correctlySpelled'\n # true/false\n # collation\n # (suggestion for collation)\n i_stop = suggestions.index(\"correctlySpelled\")\n # step through array in 2s to get info for each term\n 0.step(i_stop-1, 2) do |i| \n term = suggestions[i]\n term_info = suggestions[i+1]\n # term_info is a hash:\n # numFound =>\n # startOffset =>\n # endOffset =>\n # origFreq =>\n # suggestion => { frequency =>, word => }\n origFreq = term_info['origFreq']\n suggFreq = term_info['suggestion']['frequency'] \n word_suggestions << term_info['suggestion']['word'] if suggFreq > origFreq\n end\n end\n end\n word_suggestions.uniq\n )\n end",
"def word_string_short(word)\n \"#{word.morphword} #{word.input}->#{word.output}\"\n end",
"def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end",
"def _autonyms\n @autonyms\n end",
"def find_words words\n\t\t\t\twords.empty? ? [] : App.rdf_collection.find({\n\t\t\t\t\t:\"$or\" => words.map {|i| {:o => i}},\n\t\t\t\t\t:p => RDF::RDFS.label.to_s}).map do |data|\n\t\t\t\t\tRDF::Statement.from_mongo(data)\n\t\t\t\tend\n\t\t\tend",
"def query(word)\n node = @the_node\n results = []\n word.split(\"\").each do |letter|\n next_node = node[letter]\n if next_node != nil\n node = next_node\n next\n else\n return ['']\n end\n end\n results << Word.new(word, node.final)\n results += get_childs(node).map{|s| Word.new(word) + s}\n results.select{|r| r.final}.map{|r| r.to_s }\n end",
"def set_lesson_word_synonym\n begin\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n @lesson_word_synonym = LessonWordSynonym.find_by!(synonym_id: params[:synonym_id], lesson_word_id: params[:lesson_word_id])\n end\n end",
"def get_word_value_array(word)\n html = RestClient.get(\"http://www.thesaurus.com/browse/#{word}\")\n word_string = Nokogiri::HTML(html).css(\"div.relevancy-list ul li a\").to_a\n part_of_speech = Nokogiri::HTML(html).css(\"div.mask ul li a em\")[0].text\n word_definition = Nokogiri::HTML(html).css(\"div.mask ul li a strong\")[0].text\n [word_string, \"(#{part_of_speech}) #{word_definition}\"]\n end",
"def add_synonym(synonym)\n synonyms << synonym\n end",
"def possible_stems(word, suffix)\n myaso.stems.select cut_stem(word, suffix)\n end",
"def original_word\n\t\tword\n\tend",
"def get_word\r\n return_word\r\n end",
"def morphword=(mw)\n @morphword = mw\n end",
"def rhyme(word)\n wup = word.upcase\n key = @words[wup]\n raise UnknownWord unless key\n @rhymes[key] - [wup]\n end",
"def get_rhymable_word(atoms)\n atoms.reverse_each do |atom|\n if (!atom.match(/^[,:;.?!]+$/))\n return atom\n end\n end\n end",
"def suggest(word, leave_erroneous=false)\n res = spellcheck(word).at(0)\n return word unless res\n case res.type\n when :ok\n return word\n when :miss, :guess\n return res.guesses.at(0)\n when :none\n return leave_erroneous ? word : ''\n else\n return ''\n end\n end",
"def badword_QualifiedName(o)\n if o.value == 'bigly'\n acceptor.accept(Issues::INVALID_WORD, o, :text => o.value)\n end\n end",
"def name\n \tself.marker_synonyms.collect{|ms| ms.name}.join(',')\n end",
"def lemma\n # TODO Return @string.stem\n @word.downcase\n end",
"def rhymes_for word\n word = 'land' if word == 'and' # workaround for rhymes gem not finding any rhymes for \"and\"\n Rhymes.rhyme(word.gsub /\\W+/, '').map(&:downcase)\nrescue Rhymes::UnknownWord\n []\nend",
"def word\n @word.downcase\n end",
"def in_a_word\n WORDS[self]\n end",
"def get_definitions\n Dictionary.find_by_word(word_id)\n end",
"def export_synonyms(hits_per_page = 100, request_options = {}, &_block)\n res = []\n page = 0\n loop do\n curr = search_synonyms('', { :hitsPerPage => hits_per_page, :page => page }, request_options)['hits']\n curr.each do |synonym|\n res << synonym\n yield synonym if block_given?\n end\n break if curr.size < hits_per_page\n page += 1\n end\n res\n end",
"def acronym(word)\n @acronyms[word.downcase] = word\n @acronym_regex = /#{@acronyms.values.join(\"|\")}/\n end",
"def getWord(word)\n @bits[word]\n end",
"def word\n @word.downcase\n end",
"def find_by_word(word)\n @wordlist[word] if word_exists?(word)\n end",
"def get_related_words(word, *args)\n http_method = :get\n path = '/word/{word}/relatedWords'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def acronym(word)\n @acronyms[word.downcase] = word\n @acronym_regex = /#{@acronyms.values.join(\"|\")}/\n end",
"def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end",
"def variation_words word\n ( deletions(word) + transpositions(word) + replacements(word) + insertions(word) ).uniq\n end",
"def word; end",
"def word; end",
"def word; end",
"def word; end",
"def word; end",
"def word\n @word\n end",
"def word\n @word\n end",
"def word\n @word\n end",
"def lookup(meaning, should_invent=false)\n word = nil\n unless meaning.empty?\n rules = grammar.lookup(meaning)\n if rules.empty?\n if should_invent\n word = utter_randomly\n # self.learn Utterance.new meaning, word\n end\n else\n rules.sort_by! do |rule|\n rule.meaning.missing_parts.count\n end.reverse!\n rules.each do |rule|\n if rule.meaning.full?\n word = rule.word\n break\n else\n current = rule.clone\n current.meaning.missing_parts.each do |index, part|\n required = Meaning.new\n required[part] = meaning[part]\n res = lookup(required, should_invent)\n if res.nil?\n word = nil\n break\n else\n current.embed!(part, index, res)\n end\n end\n if current.meaning.full?\n word = current.word\n break\n end\n end\n end\n end\n end\n word\n end",
"def spell(syllables)\n return syllables if self.noortho\n s = syllables.chars\n word = ''\n s.each do |syllable|\n if self.cortho[syllable]\n word << self.cortho[syllable]\n elsif self.vortho[syllable]\n word << self.vortho[syllable]\n elsif Glossa::DEFAULT_ORTHO[syllable]\n word << Glossa::DEFAULT_ORTHO[syllable]\n else\n word << syllable\n end\n end\n word\n end",
"def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end",
"def resolve_word(name)\n @vm.log(:verbose, \"resolve_word(#{name})\")\n nm = canonical(name)\n if @dict[nm].nil?\n need(nm, true)\n resolve_references do |token|\n @vm.log(:verbose, \" compiling resolved token #{token}\")\n compile_word(@dict[token])\n end\n end\n nm\n end",
"def singularize(word, term: :noun)\n case term\n when :noun, :n\n Noun[word].singular\n when :verb, :v\n Verb[word].singular\n end\n end",
"def get_word_ladder(start_word, end_word)\n # FILL ME IN\n return ['dog', 'cat']\n end",
"def search word\n # No need to enclose the following in a EM.run block b/c TweetStream does this when \n # it initializes the client.\n puts \"entering\"\n q = last_search_query(word) \n current_search = next_search(word, q)\n #jump first one beacause of max_id including last one\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n puts \"#{current_search.attrs[:search_metadata]}\"\n while current_search.next_results? do\n current_search.results.each do |tweet|\n unless same_tweet(tweet)\n raw_tweet_to_tweet(tweet, word).save\n end\n end\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n end\n end",
"def tag_alias_for_word_pattern(query)\n query = Tag.parse_query(query)\n aliases = consequent_aliases.sort_by { |ca| [ca.antecedent_name.size, ca.antecedent_name] }\n\n aliases.find do |tag_alias|\n name_matches = Tag.includes_all_words?(name, query)\n antecedent_matches = Tag.includes_all_words?(tag_alias.antecedent_name, query)\n\n antecedent_matches && !name_matches\n end\n end",
"def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end",
"def get_word\n word = @word_list[rand(@word_list.length)]\n @word = word.gsub(/\\s+/, \"\").downcase\n end",
"def singular(word)\n if result = singular_of[word]\n return result.dup\n end\n result = word.dup\n regex, hash = singularization_rules\n result.sub!(regex) {|m| hash[m]}\n singular_of[word] = result\n return result\n end",
"def update_synonym_set(engine_name, id, body)\n put(\"engines/#{engine_name}/synonyms/#{id}\", body)\n end",
"def word\n end",
"def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end",
"def get_country_synonym(affi_string)\n cleared_affi_string = country_exclude(affi_string)\n $country_synonyms.keys.each do |ctry_key|\n if cleared_affi_string.include?(ctry_key.to_s)\n return ctry_key.to_s\n end\n end\n return nil\nend",
"def word\n if @sym == SYM_ATOM || @sym == SYM_QTEXT\n save_text\n get\n else\n\t error \"expected word, got #{@sym.inspect}\"\n\tend\n end",
"def Verb(word)\n Verb[word]\n end",
"def get_valid_words(word)\n [word, word.downcase, word.capitalize, word.pluralize].uniq\n end",
"def get_word_id\n word = @text.downcase.singularize\n @word_id = EnglishWords.find_by(english_meaning: word)\n return @word_id\n end",
"def words\n terms.collect { |t| t.word }\n end",
"def get_word\n @word_to_guess.join\n end",
"def infer_word_pins word, context_pin, locals\n return [] if word.empty?\n return infer_self(context_pin) if word == 'self'\n lvars = locals.select{|pin| pin.name == word}\n return resolve_word_types(lvars, locals) unless lvars.empty?\n return api_map.get_global_variable_pins.select{|pin| pin.name == word} if word.start_with?('$')\n namespace, scope = extract_namespace_and_scope_from_pin(context_pin)\n return api_map.get_class_variable_pins(namespace).select{|pin| pin.name == word} if word.start_with?('@@')\n return api_map.get_instance_variable_pins(namespace, scope).select{|pin| pin.name == word} if word.start_with?('@')\n return api_map.pins.select{|pin| word_matches_context?(word, namespace, scope, pin)} if variable_name?(word)\n result = []\n cparts = namespace.split('::')\n until cparts.empty?\n break unless result.empty?\n cur = cparts.join('::')\n result.concat api_map.get_path_suggestions(\"#{cur}::#{word}\")\n cparts.pop\n end\n result.concat api_map.get_path_suggestions(word) if result.empty?\n # result.concat api_map.get_methods(namespace, scope: scope, visibility: [:public, :private, :protected]).select{|pin| pin.name == word} unless word.include?('::')\n result.concat api_map.get_method_stack(namespace, word, scope: scope) unless word.include?('::')\n result.concat api_map.get_constants('', namespace).select{|pin| pin.name == word} if result.empty?\n resolve_word_types(result, locals)\n end",
"def translate_word word\n # Don't translate short words\n return word if word.size == 1\n\n # Handle specific words\n dictionary = {\n 'AWESOME' => 'ERSUM',\n 'BANANA' => 'BERNERNER',\n 'BAYOU' => 'BERU',\n 'FAVORITE' => 'FRAVRIT',\n 'FAVOURITE' => 'FRAVRIT',\n 'GOOSEBUMPS' => 'GERSBERMS',\n 'LONG' => 'LERNG',\n 'MY' => 'MAH',\n 'THE' => 'DA',\n 'THEY' => 'DEY',\n 'WE\\'RE' => 'WER',\n 'YOU' => 'U',\n 'YOU\\'RE' => 'YER',\n\n 'awesome' => 'ersum',\n 'banana' => 'bernerner',\n 'bayou' => 'beru',\n 'favorite' => 'fravrit',\n 'favourite' => 'fravrit',\n 'goosebumps' => 'gersberms',\n 'long' => 'lerng',\n 'my' => 'mah',\n 'the' => 'da',\n 'they' => 'dey',\n 'we\\'re' => 'wer',\n 'you' => 'u',\n 'you\\'re' => 'yer',\n\n 'Awesome' => 'Ersum',\n 'Banana' => 'Bernerner',\n 'Bayou' => 'Beru',\n 'Favorite' => 'Fravrit',\n 'Favourite' => 'Fravrit',\n 'Goosebumps' => 'Gersberms',\n 'Long' => 'Lerng',\n 'My' => 'Mah',\n 'The' => 'Da',\n 'They' => 'Dey',\n 'We\\'re' => 'Wer',\n 'You' => 'U',\n 'You\\'re' => 'Yer',\n }\n\n return dictionary[word] if dictionary.key? word\n \n # Before translating, keep a reference of the original word\n original_word = \"\"\n original_word << word\n\n word.upcase!\n\n # Drop vowel from end of words. Keep it for short words, like \"WE\"\n word.sub!(/[AEIOU]$/, '') if original_word.size > 2\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # Reduce adjacent vowels to one\n word.gsub!(/[AEIOUY]{2,}/, 'E') # TODO: Keep Y as first letter\n\n # DOWN -> DERN\n word.gsub!(/OW/, 'ER')\n\n # PANCAKES -> PERNKERKS\n word.gsub!(/AKES/, 'ERKS')\n\n # The mean and potatoes: replace vowels with ER\n word.gsub!(/[AEIOUY]/, 'ER') # TODO: Keep Y as first letter\n\n # OH -> ER\n word.gsub!(/ERH/, 'ER')\n\n #MY -> MAH\n word.gsub!(/MER/, 'MAH')\n\n #FALLING -> FERLIN\n word.gsub!('ERNG', 'IN')\n\n #POOPED -> PERPERD -> PERPED\n word.gsub!('ERPERD', 'ERPED')\n\n #MEME -> MAHM -> MERM\n word.gsub!('MAHM', 'MERM')\n\n # Keep Y as first character\n # YES -> ERS -> YERS\n word = 'Y' + word if original_word[0] == 'Y'\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # YELLOW -> YERLER -> YERLO\n if original_word.end_with?('LOW') && word.end_with?('LER')\n word.sub!(/LER$/, 'LO')\n end\n\n # Resolve case\n return word.downcase if original_word[0] >= 'a' and original_word[0] <= 'z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n return word[0] + word[1..-1].downcase if original_word[0] >= 'A' and original_word[0] <= 'Z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n\n return word\n\nend",
"def search(word)\n Parser.new(query(word)).parse\n end",
"def synonym_dict\n return @@synonym_dict if @@synonym_dict\n @@synonym_dict = {}\n config[\"synonyms\"].each do |syn_set|\n syn_set.each {|syn| @@synonym_dict[syn] ||= Set.new; @@synonym_dict[syn].merge syn_set }\n end\n @@synonym_dict\n end",
"def words(data=nil, &block)\n\t\t\t#\tsequence the phrases\n\t\t\t#\t\t*sigh* verb and a noun\n\t\t\tnodes = sequence(data, &block)\n\n\t\t\t#\tcomposite the words\n\t\t\t#\t\teach node contains an array of words\n\t\t\tnodes.collect {|node| node.words }.flatten\n\t\tend",
"def get_word_results(word, label=nil)\n return [word]\n end",
"def find_word(word)\n\t\tfc = word[0,1].downcase\n\t\t# check if it's a vowel\n\t\tif fc =~ /[aeiou]/\n\t\t\t# if so, then check in each bucket\n\t\t\t\"aeiou\".split(//).map do |letter|\n\t\t\t\tfind_matches(@dictionary[letter], word)\n\t\t\tend.flatten\n\t\telse\n\t\t\t# else we do the search directly\n\t\t\tfind_matches(@dictionary[fc], word)\n\t\tend\n\tend",
"def findWords(prefix)\n words = []\n prefix_node = search(prefix)\n unless prefix_node\n return words\n end\n\n autocomplete(prefix_node, prefix, words)\n words - [prefix]\n end"
] |
[
"0.6837809",
"0.683243",
"0.65248585",
"0.65157163",
"0.6513385",
"0.6448367",
"0.64279884",
"0.64008737",
"0.6371983",
"0.6346837",
"0.63074297",
"0.62453896",
"0.6231569",
"0.6192896",
"0.6081743",
"0.6066702",
"0.6061148",
"0.60483044",
"0.60175085",
"0.59807175",
"0.5973408",
"0.59548205",
"0.5921942",
"0.5805715",
"0.5786242",
"0.57788515",
"0.576663",
"0.5752007",
"0.5732751",
"0.5717649",
"0.57028776",
"0.5689857",
"0.56881285",
"0.56844944",
"0.5677624",
"0.56602436",
"0.56593066",
"0.56515205",
"0.56290495",
"0.5618171",
"0.5614994",
"0.5608452",
"0.5606433",
"0.5603743",
"0.5576439",
"0.55701935",
"0.5569711",
"0.554862",
"0.5542831",
"0.5542635",
"0.5535446",
"0.55059284",
"0.54943687",
"0.5491545",
"0.5459545",
"0.54458624",
"0.54275006",
"0.5421632",
"0.54206717",
"0.5419673",
"0.541765",
"0.54144037",
"0.54022735",
"0.5392889",
"0.5392889",
"0.5392889",
"0.5392889",
"0.5392889",
"0.5374836",
"0.5374836",
"0.5374836",
"0.5368345",
"0.53643835",
"0.5359611",
"0.53555125",
"0.53515255",
"0.533978",
"0.53373796",
"0.53173786",
"0.5314949",
"0.53122514",
"0.53059447",
"0.53056914",
"0.5302909",
"0.5297491",
"0.52809036",
"0.5260297",
"0.5256382",
"0.52499443",
"0.5245158",
"0.5243088",
"0.5225859",
"0.5220474",
"0.52144843",
"0.5214426",
"0.52095747",
"0.52062017",
"0.5205319",
"0.52001834",
"0.51998603"
] |
0.7307483
|
0
|
GET /byoins/1 GET /byoins/1.json
|
def show
@byoin = Byoin.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @byoin }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def show\n @outing = Outing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outing }\n end\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inning }\n end\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def index\n render :json => UserInterest.all\n end",
"def show\n out = Out.find(params[:id])\n respond_to do |format|\n format.json {\n render :json => out, :layout => false\n }\n end\n end",
"def show \n @inmate = Inmate.find(params[:id])\n render json: @inmate\n end",
"def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end",
"def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end",
"def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end",
"def index\n @yaopins = Yaopin.order(\"id desc\").page(params[:page]).per(params[:per] || 100)\n if params[:name].present?\n @yaopins = @yaopins.where(:name=>params[:name])\n end\n\n end",
"def index\n @identities = Identity.all\n\n render json: @identities\n end",
"def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end",
"def show\n @otrosings = Otrosing.find(params[:id])\n end",
"def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def show\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oase }\n end\n end",
"def show\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ongoing }\n end\n end",
"def index\n init_oco if !session[:organization]\n if session[:organization] != '0'\n @insurances = Insurance.where(organization_id: session[:organization]).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n else\n @insurances = Insurance.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @insurances }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end",
"def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end",
"def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end",
"def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end",
"def index\n @outgoings = Outgoing.where(:year_at => Date.current.year).order(:created_at)\n @user = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outgoings }\n end\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n ends = End.find_each\n render json: ends\n end",
"def index\n # render json: Epicenter.where('owner_id = ?', @epicenter.id)\n puts Epicenter.all.count\n render json: Epicenter.all\n end",
"def index\n @seihinns = Seihinn.all\n end",
"def show\n @hijo = Hijo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hijo }\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n render json: @owner\n end",
"def index\n @owners = Owner.all\n render json: @owners, include: [], adapter: :json\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def list_inventors\n \tjson_out(Inventor.all)\n\tend",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instituicao }\n end\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @tagihans = Tagihan.all\n @tagihans = @tagihans.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @tagihans }\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end",
"def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end",
"def index\n @inboxes = Inbox.all\n @inboxes = @inboxes.select { |x| x.umkm_id == params[:umkm_id].to_i }\n render json: {items: @inboxes}\n end",
"def show\n render json: @onboarding\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def index\n # if we have plan to use paginate\n # @kinodoms = Kinodom.paginate :page => params[:page], :order => 'id DESC'\n @kinodoms = Kinodom.all\n @kinodom = Kinodom.new\n respond_with(@kinodoms, :location=>kinodoms_path )\n end",
"def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end",
"def index\n @ozones = Ozone.all\n render json: @ozones\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def specific\n @state = State.find(params[:id])\n @loans = @state.loans.where(:purpose_id == params[:purpose_id])\n render json: { state: @state, loans: @loans }\n end",
"def show\n @oai_endpoint = OaiEndpoint.find(params[:id])\n respond_to do |format|\n format.html { render :template => 'oai_endpoints/show', :layout => params[:layout] || true }\n format.json { render :json => @oai_endpoint.as_json }\n end\n end",
"def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend",
"def list_inventors\n json_out(Inventor.all)\n end",
"def list_inventors\n json_out(Inventor.all)\n end",
"def get_handle\n logger.debug \"Hoo ha!\"\n s = Swimmer.find(:all, :conditions => \"last = '#{params[:last]} and first like '#{params[:first]}'\").map {er|x| x.id }\n respond_to do |format|\n json { render s.to_json }\n end\n end",
"def index\n @onsens = Onsen.all\n if params[:name].present?\n @onsens = @onsens.get_by_name params[:name]\n elsif params[:onsen].present? && params[:onsen][:prefecture_id].present? then\n logger.debug(params[:onsen])\n @onsens = @onsens.get_by_prefecture_id params[:onsen][:prefecture_id]\n # logger.debug(params[:onsen][:prefecture_id])\n else\n @onsens = Onsen.all\n end\n end",
"def index\n @coins = Coin.all\n render \"index.json.jbuilder\"\n end",
"def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def index\n @onboardings = Onboarding.all\n render json: @onboardings.as_json(:only => [:id, :company_name, :company_uen, :a_corpsecretary, :a_accounting, :a_status, :a_action, :a_date_fye, :a_date_agm, :a_date_renewal, :created_at])\n\n end",
"def index\n @usuarios = Usuario.all\n\n @users = Usuario.all.order(:id)\n @users.each do |u|\n puts u.id\n end\n #render json: @usuarios\n render 'index.json.jbuilder'\n end",
"def index\n \n @interests = Interest.find(@interestsId)\n \n if params[:persona_id] == nil \n @interests = Interest.order(:name) \n end\n \n respond_to do |format|\n format.json { render :json => @interests }\n end\n end",
"def show\n @borc = Borc.where(:UyeId => current_user.uid).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borc }\n end\n end",
"def index\n render json: Client.all\n end",
"def index\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @hes = district.hes\n else\n @hes = He.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hes }\n end\n end",
"def index\n @syohins = Syohin.all\n end",
"def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def index\n\t my_uuid = params[:uuid]\n\t\tif my_uuid == nil\n\n\t\t\t@information = Information.all\n\t\telse\n\t\t\t@information = Information.where(uuid: my_uuid).all\n\t\tend\n\t\trespond_with @information\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def index\n render json: current_org.users\n end",
"def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end",
"def index\n @soils = Soil.where(:field_id => session[:field_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @soils }\n end\n end",
"def index\n @wowolinks = Wowolink.all\n respond_to do |format|\n format.json {\n render :json => @wowolinks, :layout => false\n }\n end\n end",
"def index\n @oc_members = OcMember.find(:all, :order => \"created_at ASC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @oc_members }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest }\n end\n end",
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def index\n @organisms = Organism.find(:all, :conditions => {:has_proteins => true})\n @dataset = params[:dataset]\n proteins = Protein.find(:all, :conditions => {:has_hits_public => true})\n @h_proteins = {}\n proteins.map{|p| @h_proteins[p.id]=p}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisms }\n end\n end",
"def index\n render json: Loan.all\n end",
"def show\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @interest }\n end\n end",
"def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end",
"def index\n @insumos = Insumo.all\n end"
] |
[
"0.6513531",
"0.6388622",
"0.6372817",
"0.63000786",
"0.6272199",
"0.6264514",
"0.62585986",
"0.6224663",
"0.6191145",
"0.6146437",
"0.613376",
"0.61313856",
"0.6099681",
"0.6079414",
"0.60769194",
"0.60614854",
"0.60572386",
"0.6053703",
"0.6046992",
"0.60383904",
"0.60371196",
"0.6028961",
"0.60268176",
"0.6020792",
"0.60188216",
"0.60126805",
"0.60098135",
"0.60007",
"0.5998937",
"0.5998367",
"0.599613",
"0.59892595",
"0.5968793",
"0.5965537",
"0.5954282",
"0.5954041",
"0.59490496",
"0.5948167",
"0.59364164",
"0.59341794",
"0.5931454",
"0.592816",
"0.5919266",
"0.591139",
"0.5901423",
"0.5896746",
"0.58942366",
"0.5886967",
"0.5883061",
"0.5882766",
"0.5870621",
"0.58701026",
"0.58599603",
"0.5858028",
"0.5856273",
"0.585197",
"0.5848097",
"0.584622",
"0.58431566",
"0.58423",
"0.5836124",
"0.5832499",
"0.5821585",
"0.5813069",
"0.58120835",
"0.58120835",
"0.5802816",
"0.5801025",
"0.5800176",
"0.57998914",
"0.57901657",
"0.57884216",
"0.57877094",
"0.5783232",
"0.57798463",
"0.57774395",
"0.57763296",
"0.5774325",
"0.5767824",
"0.5765822",
"0.57649046",
"0.57613355",
"0.5760726",
"0.57593936",
"0.5756815",
"0.5752662",
"0.5751994",
"0.57508326",
"0.5750678",
"0.5748482",
"0.5746929",
"0.5745953",
"0.5745594",
"0.5744742",
"0.5744365",
"0.5742794",
"0.574193",
"0.57411593",
"0.5740232",
"0.573469"
] |
0.66625655
|
0
|
GET /byoins/new GET /byoins/new.json
|
def new
@byoin = Byoin.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @byoin }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end",
"def new\n @ongoing = Ongoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ongoing }\n end\n end",
"def new\n @yaopin = Yaopin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yaopin }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def new\n authorize! :manage, LopMonHocSinhVien\n @lop_mon_hoc_sinh_vien = @lop_mon_hoc.lop_mon_hoc_sinh_viens.build\n respond_to do |format|\n format.html { render :layout => (request.headers['X-PJAX'] ? false : true)}\n format.json { render json: @lop_mon_hoc_sinh_vien }\n end\n end",
"def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end",
"def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end",
"def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end",
"def new\n @torneo = Torneo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneo }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end",
"def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def new\n @hasil = Hasil.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hasil }\n end\n end",
"def new\n @nail_salon = NailSalon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nail_salon }\n end\n end",
"def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\n end\n end",
"def new\n @hijo = Hijo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hijo }\n end\n end",
"def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end",
"def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end",
"def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end",
"def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def new\n @nave = Nave.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nave }\n end\n end",
"def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def new\n @bokin = Bokin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bokin }\n end\n end",
"def new\n @ins_company = InsCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ins_company }\n end\n end",
"def new\n @stone = Stone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stone }\n end\n end",
"def new\n @tenni = Tenni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenni }\n end\n end",
"def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @oase = Oasis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @oase }\n end\n end",
"def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def new\n @one = One.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @one }\n end\n end",
"def new\n @page = 'newdoll'\n @doll = current_user.dolls.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doll }\n end\n end",
"def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\n end\n end",
"def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end",
"def new\n @orc = Orc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orc }\n end\n end",
"def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @soil = Soil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @soil }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @bruger_id = current_user.id\n @bruger = Bruger.find_by_id(@bruger_id)\n @onske = Onske.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @onske }\n end\n end",
"def new\n @instituicao = Instituicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instituicao }\n end\n end",
"def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end",
"def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end",
"def new\n @sotrudniki = Sotrudniki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sotrudniki }\n end\n end",
"def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n end\n end",
"def new\n @basis = Base.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basis }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lore }\n end\n end",
"def new\n @sinh_vien = SinhVien.new\n\n respond_to do |format| \n format.json { render json: @sinh_vien }\n end\n end",
"def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end",
"def new\n @breadcrumb = 'create'\n @insurance = Insurance.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurance }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @sitio_entrega = SitioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio_entrega }\n end\n end",
"def new\n @trnodo = Trnodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @intern = Intern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intern }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @socio }\n end\n end",
"def new\n @impgen = Impgen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @impgen }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end",
"def new\n @entry = Entry.new\n\n render json: @entry\n end",
"def new\n @orgao = Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgao }\n end\n end",
"def new\n @opinion = Opinion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opinion }\n end\n end",
"def new\n @opinion = Opinion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opinion }\n end\n end",
"def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end",
"def new\n @obj = Obj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obj }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alley }\n end\n end",
"def new\n @monnaie = Monnaie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monnaie }\n end\n end",
"def new\n @objects_info = ObjectsInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objects_info }\n end\n end",
"def new\n @ci = Ci.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ci }\n end\n end",
"def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end",
"def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end",
"def new\n @hetong = Hetong.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hetong }\n end\n end",
"def new\n @cso = Cso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cso }\n end\n end",
"def new\n @outgoing = Outgoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing }\n end\n end",
"def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @socio }\n end\n end",
"def new\n @orden = Orden.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orden }\n end\n end",
"def new\n @howner = Howner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @howner }\n end\n end",
"def new\n @etnia = Etnia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @etnia }\n end\n end",
"def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def new\n @historial_odt = HistorialOdt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odt }\n end\n end",
"def new\n @inspiration = Inspiration.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inspiration }\n end\n end",
"def new\n @torso = Torso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torso }\n end\n end",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @lei = Lei.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lei }\n end\n end"
] |
[
"0.74631023",
"0.72607964",
"0.7131678",
"0.7076896",
"0.7056005",
"0.70374966",
"0.7020581",
"0.69768405",
"0.696636",
"0.69607735",
"0.6946114",
"0.69424623",
"0.6937767",
"0.6930798",
"0.6920706",
"0.6919153",
"0.69183034",
"0.6918192",
"0.69159484",
"0.68863875",
"0.68857855",
"0.6881653",
"0.6874127",
"0.68691087",
"0.68687075",
"0.6863992",
"0.68588954",
"0.685773",
"0.685767",
"0.6857224",
"0.6855911",
"0.6855855",
"0.6852861",
"0.6847237",
"0.6843799",
"0.68422985",
"0.68377537",
"0.68361664",
"0.68332493",
"0.6832772",
"0.68293077",
"0.682226",
"0.68143487",
"0.6813691",
"0.6811578",
"0.6811313",
"0.6810172",
"0.6808346",
"0.6807884",
"0.6800555",
"0.6799754",
"0.67929447",
"0.67924654",
"0.6792443",
"0.6790169",
"0.67899203",
"0.6788097",
"0.6785652",
"0.67816466",
"0.67816466",
"0.67806715",
"0.6776083",
"0.67715013",
"0.6766622",
"0.6765005",
"0.6762713",
"0.6762349",
"0.676192",
"0.676192",
"0.676192",
"0.676192",
"0.676192",
"0.67603415",
"0.67509645",
"0.6750328",
"0.6748328",
"0.6739076",
"0.67389137",
"0.67389137",
"0.6736825",
"0.6733713",
"0.67282647",
"0.67277354",
"0.6725052",
"0.67241955",
"0.6718935",
"0.6713601",
"0.6713341",
"0.67105246",
"0.6708945",
"0.67084986",
"0.6707427",
"0.6705755",
"0.67027164",
"0.6701557",
"0.66996825",
"0.66977537",
"0.6697209",
"0.6696334",
"0.669316"
] |
0.7550706
|
0
|
POST /byoins POST /byoins.json
|
def create
@byoin = Byoin.new(params[:byoin])
respond_to do |format|
if @byoin.save
format.html { redirect_to @byoin, notice: 'Byoin was successfully created.' }
format.json { render json: @byoin, status: :created, location: @byoin }
else
format.html { render action: "new" }
format.json { render json: @byoin.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @yaopin = Yaopin.new(params[:yaopin])\n\n respond_to do |format|\n if @yaopin.save\n format.html { redirect_to @yaopin, notice: 'Yaopin was successfully created.' }\n format.json { render json: @yaopin, status: :created, location: @yaopin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @yaopin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @insumo = Insumo.new(insumo_params)\n\n respond_to do |format|\n if @insumo.save\n format.html { redirect_to insumos_url, notice: 'Insumo was successfully created.' }\n format.json { render :show, status: :created, location: @insumo }\n else\n format.html { render :new }\n format.json { render json: @insumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @onsen = Onsen.new(onsen_params)\n\n respond_to do |format|\n if @onsen.save\n format.html { redirect_to @onsen, notice: 'Onsen was successfully created.' }\n format.json { render :show, status: :created, location: @onsen }\n else\n format.html { render :new }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end",
"def create\n @sinnoh = Sinnoh.new(sinnoh_params)\n\n respond_to do |format|\n if @sinnoh.save\n format.html { redirect_to @sinnoh, notice: 'Sinnoh was successfully created.' }\n format.json { render :show, status: :created, location: @sinnoh }\n else\n format.html { render :new }\n format.json { render json: @sinnoh.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def insint_params\n params.require(:insint).permit(:subdomen, :password, :insales_account_id, :user_id, :inskey, :status)\n end",
"def create\n @inning = Inning.new(params[:inning])\n\n respond_to do |format|\n if @inning.save\n format.html { redirect_to @inning, notice: 'Inning was successfully created.' }\n format.json { render json: @inning, status: :created, location: @inning }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def innings_params\n params.require(:innings).permit(:id, :match_id, :hometeambatted, :byes, :legbyes, :penalties)\n end",
"def create\n @syohin = Syohin.new(syohin_params)\n\n respond_to do |format|\n if @syohin.save\n format.html { redirect_to @syohin, notice: 'Syohin was successfully created.' }\n format.json { render :show, status: :created, location: @syohin }\n else\n format.html { render :new }\n format.json { render json: @syohin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def inseminacao_params\n params.require(:inseminacao).permit(:data, :inseminador_id, :bovino_id)\n end",
"def create\n @inews = Inews.new(inews_params)\n\n respond_to do |format|\n if @inews.save\n format.html { redirect_to @inews, notice: 'Inews was successfully created.' }\n format.json { render :show, status: :created, location: @inews }\n else\n format.html { render :new }\n format.json { render json: @inews.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def create\n @swyp_in = SwypIn.new(params[:swyp_in])\n @swyp_in.address = request.remote_ip\n @swyp_peer = @swyp_in.pair\n @swyp_in.developer = Developer.find_by_api_key(params[:api_key])\n \n if @swyp_in.save\n @swyp = @swyp_in\n render 'shared/status.json'\n else\n format.json { render json: @swyp_in.errors, status: :unprocessable_entity }\n end\n \n end",
"def create\n @oiseau = Oiseau.new(oiseau_params)\n\n respond_to do |format|\n if @oiseau.save\n format.html { redirect_to @oiseau, notice: 'Oiseau was successfully created.' }\n format.json { render :show, status: :created, location: @oiseau }\n else\n format.html { render :new }\n format.json { render json: @oiseau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n #Makes an innings associated with a given match\n @innings = Innings.new(innings_params)\n\n respond_to do |format|\n if @innings.save\n format.html { redirect_to match_path(@match), notice: 'Innings was successfully created.' }\n format.json { render :show, status: :created, location: @innings }\n else\n format.html { render :new }\n format.json { render json: @innings.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @outing = Outing.new(params[:outing])\n\n respond_to do |format|\n if @outing.save\n format.html { redirect_to @outing, notice: 'Outing was successfully created.' }\n format.json { render json: @outing, status: :created, location: @outing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @yaopin = Yaopin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yaopin }\n end\n end",
"def create\n @dino = Dino.new(dino_params)\n\n if @dino.save\n render json: @dino, status: :created, location: @dino\n else\n render json: @dino.errors, status: :unprocessable_entity\n end\n end",
"def create\n @out = Out.new(out_params)\n\n respond_to do |format|\n if @out.save\n format.json { render :json => @out, status: :created, :layout => false }\n else\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bokin = Bokin.new(params[:bokin])\n \n @bokin.name = current_user.name\n @bokin.photourl = current_user.screen_name\n \n \n respond_to do |format|\n if @bokin.save\n format.html { redirect_to @bokin, :notice => 'Bokin was successfully created.' }\n format.json { render :json => @bokin, :status => :created, :location => @bokin }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bokin.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @weigh_in = WeighIn.new(weigh_in_params)\n\n respond_to do |format|\n if @weigh_in.save\n format.html { redirect_to @weigh_in, notice: 'Weigh in was successfully created.' }\n format.json { render :show, status: :created, location: @weigh_in }\n else\n format.html { render :new }\n format.json { render json: @weigh_in.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user\n # render json: { status: 200, msg: \"Logged-in as #{current_user.name}\" }\n @userin = UserInvestor.new(userin_params)\n if @userin.save\n render json: { status: 'OK', results: @userin, errors: nil },\n status: :created\n else\n render json: { status: 'FAIL', results: nil,\n errors: 'failed to create user' },\n status: :unprocesable_entity\n end\n end\n end",
"def jusho_params\n params.require(:jusho).permit(:todofuken_id, :shichoson_id, :sonotajusho)\n end",
"def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end",
"def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end",
"def create\n @wine_oenologist = WineOenologist.new(wine_oenologist_params)\n\n respond_to do |format|\n if @wine_oenologist.save\n format.html { redirect_to @wine_oenologist, notice: \"Wine oenologist was successfully created.\" }\n format.json { render :show, status: :created, location: @wine_oenologist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wine_oenologist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @indoor = Indoor.new(params[:indoor])\n\n respond_to do |format|\n if @indoor.save\n format.html { redirect_to(@indoor, :notice => 'Indoor was successfully created.') }\n format.xml { render :xml => @indoor, :status => :created, :location => @indoor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @indoor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wine_oenologist_params\n params.require(:wine_oenologist).permit(:wine_id, :oenologist_id)\n end",
"def create\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.new(api_v1_mentorship_interest_params)\n\n respond_to do |format|\n if @api_v1_mentorship_interest.save\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentorship_interest }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n @outgoings = Outgoing.order(updated_at: :desc).limit(50)\n @outgoings_count = Outgoing.where(:status => 'INSERTED').count\n respond_to do |format|\n \tformat.html\n#\tformat.csv { send_data Outgoing.where(\"EXISTS (select * from answers where INSTR(telephone, contact) = 0)\").to_csv, filename: \"autodialer-#{Date.today}.csv\" } \n format.csv { send_data Outgoing.all.to_csv, filename: \"autodialer-#{Date.today}.csv\" } \n format.json { render :json => Outgoing.where.not(:trank => nil).as_json(only: [:id, :trank_id])}\n end\n end",
"def create\n @oyun = Oyun.new(oyun_params)\n\n respond_to do |format|\n if @oyun.save\n format.html { redirect_to @oyun, notice: 'Oyun was successfully created.' }\n format.json { render :show, status: :created, location: @oyun }\n else\n format.html { render :new }\n format.json { render json: @oyun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"def create\n @insumo_plato = InsumoPlato.new(insumo_plato_params)\n\n respond_to do |format|\n if @insumo_plato.save\n format.html { redirect_to @insumo_plato, notice: 'Insumo plato was successfully created.' }\n format.json { render :show, status: :created, location: @insumo_plato }\n else\n format.html { render :new }\n format.json { render json: @insumo_plato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @niche = current_user.niches.new(processed_params)\n if @niche.save\n render json: { status: 'ok' }\n else\n render json: { status: @niche.errors.to_a.join('base') }\n end\n end",
"def upsert_marketo_lead(params)\n # todo: verify required fields? perhaps get form fields and validation logic from marketo?\n # removing params included by rails\n params.delete :action\n params.delete :controller\n params.delete :marketo_form\n # parse incoming values to json\n body = {\n #\"action\"=>\"createOnly\",\n \"lookupField\"=>\"email\",\n \"input\"=>[params]\n }.to_json\n @body = body\n # set post uri\n uri = URI(Config.get_create_lead_url)\n # setup http request\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n uri.query = \"access_token=#{get_marketo_token}\"\n request = Net::HTTP::Post.new(uri, { 'Content-Type' => 'application/json' })\n request.body = @body\n # make http request\n response = http.request(request)\n return response.body\n end",
"def create\n checkin = @student.checkins.new(checkin_params)\n if checkin.save\n render json: checkin\n else \n render json: {message: \"Unable to create checkin.\"}\n end\n end",
"def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingeniero = Ingeniero.new(ingeniero_params)\n\n respond_to do |format|\n if @ingeniero.save\n format.html { redirect_to @ingeniero, notice: 'Ingeniero was successfully created.' }\n format.json { render :show, status: :created, location: @ingeniero }\n else\n format.html { render :new }\n format.json { render json: @ingeniero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def create\n @rankin = Rankin.new(rankin_params)\n\n if @rankin.save\n render json: @rankin, status: :created, location: api_v1_rankin_url(@rankin, format: :json)\n else\n render json: @rankin.errors, status: :unprocessable_entity\n end\n end",
"def create\n @incucai = Incucai.new(params[:incucai])\n\n respond_to do |format|\n if @incucai.save\n format.html { redirect_to @incucai, notice: 'Incucai was successfully created.' }\n format.json { render json: @incucai, status: :created, location: @incucai }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incucai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @merma_insumo = MermaInsumo.new(merma_insumo_params)\n\n respond_to do |format|\n if @merma_insumo.save\n format.html { redirect_to @merma_insumo, notice: 'Merma insumo was successfully created.' }\n format.json { render :show, status: :created, location: @merma_insumo }\n else\n format.html { render :new }\n format.json { render json: @merma_insumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @interesado = Interesado.new(interesado_params)\n\n respond_to do |format|\n if @interesado.save\n format.html { redirect_to @interesado, notice: 'Interesado was successfully created.' }\n format.json { render :show, status: :created, location: @interesado }\n else\n format.html { render :new }\n format.json { render json: @interesado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @obsah = Obsah.new(obsah_params)\n respond_to do |format|\n if @obsah.save\n format.html { redirect_to @obsah, notice: 'Obsah was successfully created.' }\n format.json { render :show, status: :created, location: @obsah }\n else\n format.html { render :new }\n format.json { render json: @obsah.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"def create\n @kokuin = Kokuin.new(kokuin_params)\n\n respond_to do |format|\n if @kokuin.save\n format.html { redirect_to admin_kokuin_path(@kokuin), notice: 'Kokuin was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kokuin }\n else\n format.html { render action: 'new' }\n format.json { render json: @kokuin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user])\n @animal = Animal.find(params[:animal])\n @interest = Interest.new(user_id: @user.id, animal_id: @animal.id, date: Date.today)\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to :back, notice: 'You sent an interest to the animal' }\n format.json { head :no_content }\n else\n format.html { redirect_to animals_url, notice: @interest.errors.full_messages[0] }\n format.json { head :no_content }\n end\n end\n end",
"def innapropiate_params\n params.require(:innapropiate).permit(:user_id, :post_id, :coment)\n end",
"def create\n @indivisual = Indivisual.new(indivisual_params)\n\n respond_to do |format|\n if @indivisual.save\n format.html { redirect_to @indivisual, notice: 'Indivisual was successfully created.' }\n format.json { render :show, status: :created, location: @indivisual }\n else\n format.html { render :new }\n format.json { render json: @indivisual.errors, status: :unprocessable_entity }\n end\n end\n end",
"def seihinn_params\n params.require(:seihinn).permit(:name, :price, :vendor)\n end",
"def onsen_params\n params.require(:onsen).permit(:name, :prefecture_id, :url, :review, :list_id, :user_id)\n end",
"def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def set_insint\n @insint = Insint.find(params[:id])\n end",
"def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @outdoor = Outdoor.new(params[:outdoor])\n\n respond_to do |format|\n if @outdoor.save\n format.html { redirect_to @outdoor, notice: 'Outdoor was successfully created.' }\n format.json { render json: @outdoor, status: :created, location: @outdoor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outdoor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end",
"def sign_in_json\n {\n id: id.to_s,\n email: email,\n firstname: firstname,\n lastname: lastname,\n schools: schools.map{|s| {id: s.id.to_s, name: s.name}},\n admin: shapter_admin,\n confirmed: confirmed?,\n sign_in_count: sign_in_count,\n }.to_json\n end",
"def create\n @synonymprotein = Synonymprotein.new(synonymprotein_params)\n\n respond_to do |format|\n if @synonymprotein.save\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successfully created.' }\n format.json { render :show, status: :created, location: @synonymprotein }\n else\n format.html { render :new }\n format.json { render json: @synonymprotein.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agente = Agente.find(params[:agente_id])\n @hijo = @agente.hijos.build(hijo_params)\n\n respond_to do |format|\n if @hijo.save\n format.html { redirect_to agente_hijos_path(@agente), notice: 'El hijo fué creado exitosamente.' }\n format.json { render :show, status: :created, location: @hijo }\n else\n format.html { render :new }\n format.json { render json: @hijo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_request\n\n @url = 'https://api.keeptruckin.com/v1'\n @headers = { 'content-type': 'application/json', 'X-Api-Key': ENV[\"KEEP_TRUCKIN_KEY\"] } \n request = HTTParty.put(\"#{@url}/users/\", headers: @headers, \n body: \n { \n\n password: @driver_profile.password,\n driver_company_id: @driver_profile.id,\n first_name: @driver_profile.first_name, \n last_name: @driver_profile.last_name,\n email: @driver_profile.email, \n first_name: @driver_profile.first_name, \n last_name: @driver_profile.last_name, \n phone: @driver_profile.phone, \n phone_ext: @driver_profile.phone_ext, \n time_zone: @driver_profile.time_zone,\n carrier_name: @driver_profile.carrier_name, \n carrier_street: @driver_profile.carrier_street, \n carrier_city: @driver_profile.carrier_city,\n carrier_state: @driver_profile.carrier_state, \n carrier_zip: @driver_profile.carrier_zip, \n terminal_street: @driver_profile.terminal_street,\n terminal_city: @driver_profile.terminal_city, \n terminal_state: @driver_profile.terminal_state, \n terminal_zip: @driver_profile.terminal_zip, \n username: @driver_profile.username,\n drivers_license_number: @driver_profile.drivers_license_number,\n drivers_license_state: @driver_profile.drivers_license_state,\n role: @driver_profile.role }.to_json)\n # @user_response = JSON.parse(@response.body, object_class: OpenStruct)\n \n # puts @user_response.body, @user_response.message\n puts \"request Body: #{request.body}\", \"request Code: #{request.code}\", \"request Message: #{request.message}\"\n end",
"def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n @inciting_incident = IncitingIncident.new(inciting_incident_params)\n\n if @inciting_incident.save\n render json: @inciting_incident, status: :created, location: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end",
"def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end",
"def create\n @interest = Interest.new(params[:interest])\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, :notice => 'Interest was successfully created.' }\n format.json { render :json => @interest, :status => :created, :location => @interest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @con_in = ConIn.new(con_in_params)\n\n respond_to do |format|\n if @con_in.save\n format.html { redirect_to @con_in, notice: 'Con in was successfully created.' }\n format.json { render :show, status: :created, location: @con_in }\n else\n format.html { render :new }\n format.json { render json: @con_in.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p \"*******INST CREATE*********\"\n user = User.find_by(id: session[:user_id])\n instrument = user.instruments.build(instrument_params)\n if instrument.save\n render json: instrument, status: :created\n else\n render json: {error: \"Not Created\"}, status: :not_created\n end\n end",
"def create\n if user_interest_params && @current_user.id == user_interest_params[:user_id].to_i #only create them if the current user = the parameter user\n \n @user_id = user_interest_params[:user_id]\n\n count = 1\n interests_to_add = does_interest_exist(user_interest_params) #only add interests that don't exist yet\n \n if interests_to_add.length >= 1 #only run this if there are interests to add\n interests_to_add.each do |interest|\n @user_interest = UserInterest.new(user_id: @user_id, interest_id: interest)\n \n if @user_interest.save\n if count == interests_to_add.length #show success only for the last one\n render json: { \n status: 200,\n message: \"Successfully added user interests\",\n user_interests: @user_interest\n }.to_json\n end\n else\n render json: {\n status: 500,\n message: \"Couldn't save user interests\",\n errors: @user_interest.errors\n }.to_json\n end\n count += 1\n end\n else #if there are no interests to add, state so.\n render json: {\n status: 200,\n message: \"No interests to add\"\n }.to_json\n end\n else\n render json: {\n status: 400,\n message: \"Invalid authentication\"\n }.to_json\n end\n end",
"def create\n @inscrito = Inscrito.new(params[:inscrito])\n\n respond_to do |format|\n if @inscrito.save\n format.html { redirect_to @inscrito, notice: 'Inscrito was successfully created.' }\n format.json { render json: @inscrito, status: :created, location: @inscrito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inscrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @innapropiate = Innapropiate.new(innapropiate_params)\n\n respond_to do |format|\n if @innapropiate.save\n format.html { redirect_to @innapropiate, notice: 'Innapropiate was successfully created.' }\n format.json { render :show, status: :created, location: @innapropiate }\n else\n format.html { render :new }\n format.json { render json: @innapropiate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #ederrafo seteo como nuevo\n @user = User.new(params[:user])\n if @user.save\n @wise = Wise.new(:website => params[:wise][:website],\n :apellation => params[:wise][:apellation],\n :banck_account => params[:wise][:banck_account],\n :bank => params[:wise][:bank],\n :user_id => @user.id,\n :summary => params[:wise][:summary],\n :guy => 1 \n )\n respond_to do |format|\n if @wise.save\n format.html { redirect_to @wise, :notice => 'Wise was successfully created.' }\n format.json { render :json => @wise, :status => :created, :location => @wise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @wise.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def create(bin_params)\n @rest.post('save', bin_params)\n end",
"def create\n @insurer = Insurer.new(params[:insurer])\n\n respond_to do |format|\n if @insurer.save\n format.html { redirect_to @insurer, notice: 'Insurer was successfully created.' }\n format.json { render json: @insurer, status: :created, location: @insurer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @insurer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anuphat = Anuphat.new(anuphat_params)\n\n respond_to do |format|\n if @anuphat.save\n format.html { redirect_to @anuphat, notice: 'Anuphat was successfully created.' }\n format.json { render :show, status: :created, location: @anuphat }\n else\n format.html { render :new }\n format.json { render json: @anuphat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shoutout = Shoutout.new(create_params)\n if @shoutout.save\n render json: @shoutout, status: 201, location: api_v1_shoutout_path(@shoutout.id)\n else\n render json: { error: \"Application error\", status: 400 }, status: 400\n end\n end",
"def index\n render :json => UserInterest.all\n end",
"def create\n @maptolinkedin = Maptolinkedin.new(params[:maptolinkedin])\n @bluetooth = @maptolinkedin[:bluetooth]\n @allbluetooths = Maptolinkedin.all.collect {|p| p.bluetooth}\n unless @allbluetooths.include? @bluetooth\n respond_to do |format|\n if @maptolinkedin.save\n format.html { redirect_to @maptolinkedin, notice: 'Maptolinkedin was successfully created.' }\n format.json { render json: @maptolinkedin, status: :created, location: @maptolinkedin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @maptolinkedin.errors, status: :unprocessable_entity }\n end\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: \"error\", status: :unprocessable_entity }\n end\n end",
"def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def sanvandong_params\n params.require(:sanvandong).permit(:soghe, :diachi, :doibong_id, :hinhanh, :ten, :hinanh1, :hinhanh2, :thongtin, :chitietthongtin, :thanhlap, :ve)\n end",
"def index\n @seihinns = Seihinn.all\n end",
"def create\n @buy_in = BuyIn.new(params[:buy_in])\n\n respond_to do |format|\n if @buy_in.save\n format.html { redirect_to @buy_in, notice: 'Buy in was successfully created.' }\n format.json { render json: @buy_in, status: :created, location: @buy_in }\n else\n format.html { render action: \"new\" }\n format.json { render json: @buy_in.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dinner = Dinner.new(dinner_params)\n @dinner.seats_available = @dinner.seats\n @dinner.host = current_user\n current_user.n_hosted += 1\n respond_to do |format|\n if current_user.save and @dinner.save\n format.html { redirect_to @dinner, notice: 'Supper successfully created.' }\n format.json { render :show, status: :created, location: @dinner }\n else\n format.html { render :new }\n format.json { render json: @dinner.errors, status: :unprocessable_entity }\n logger.error @dinner.errors.full_messages\n end\n end\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def stone_params\n params.require(:stone).permit(:info)\n end",
"def riyu_monshin_params\n params.require(:riyu_monshin).permit(:atai)\n end",
"def index\n @pinyins = Pinyin.all\n end",
"def add(params)\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(intranet(:koha_rest_api) + \"holds\")\n res = http.post(uri, params.to_json, headers)\n expect(res.code).to eq(\"201\"), \"got unexpected #{res.code} when adding hold.\\nResponse body: #{res.body}\"\n res.body\n end",
"def followed_events\n @followed = Follower.all.where(:customer_id => params[:customer_id])\n @followed_events=Array.new\n @eventos_nous=Array.new\n @followed.each do |f|\n @followed_events = Evento.all.where(:id_creator => f.company_id)\n @followed_events.each do |e|\n @eventos_nous << e.formatted_data.as_json()\n end\n end\n render json: @eventos_nous\n end",
"def create\n @out = Out.new(out_params)\n\n respond_to do |format|\n if @out.save\n format.html { redirect_to @out, notice: 'Out was successfully created.' }\n format.json { render action: 'show', status: :created, location: @out }\n else\n format.html { render action: 'new' }\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.57724303",
"0.5531953",
"0.543413",
"0.5430458",
"0.5376896",
"0.53581923",
"0.5354088",
"0.53494644",
"0.53471196",
"0.5323087",
"0.5304842",
"0.52863526",
"0.5217852",
"0.51786345",
"0.51729107",
"0.5149248",
"0.51343036",
"0.5129744",
"0.51244557",
"0.51180446",
"0.51026684",
"0.510109",
"0.5085286",
"0.5082282",
"0.5053634",
"0.50434476",
"0.5035286",
"0.50328225",
"0.50265205",
"0.50095206",
"0.5007149",
"0.5004546",
"0.5003166",
"0.49850902",
"0.4983499",
"0.49737698",
"0.49669826",
"0.49660668",
"0.49628744",
"0.49612007",
"0.49587667",
"0.49576974",
"0.4942167",
"0.49379796",
"0.4934664",
"0.49292436",
"0.4924508",
"0.49230558",
"0.4917491",
"0.49090523",
"0.48992327",
"0.48936364",
"0.48859197",
"0.48821792",
"0.48817435",
"0.48779044",
"0.48706898",
"0.48648724",
"0.48631158",
"0.48602885",
"0.48580047",
"0.48564103",
"0.48547345",
"0.4840675",
"0.48404452",
"0.48358154",
"0.4832759",
"0.48276943",
"0.4826589",
"0.48260403",
"0.4824665",
"0.48117736",
"0.48105884",
"0.4807518",
"0.4807284",
"0.48052144",
"0.480364",
"0.47992772",
"0.4799083",
"0.47988746",
"0.4789983",
"0.4786878",
"0.47833297",
"0.47770116",
"0.47687906",
"0.47662318",
"0.47656038",
"0.47605404",
"0.4760155",
"0.47593677",
"0.47578755",
"0.4749836",
"0.47425035",
"0.47420758",
"0.47418955",
"0.47393277",
"0.47372538",
"0.47363287",
"0.47334835",
"0.47327608"
] |
0.56098133
|
1
|
PUT /byoins/1 PUT /byoins/1.json
|
def update
@byoin = Byoin.find(params[:id])
respond_to do |format|
if @byoin.update_attributes(params[:byoin])
format.html { redirect_to @byoin, notice: 'Byoin was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @byoin.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def put(*args)\n request :put, *args\n end",
"def update\n @yaopin = Yaopin.find(params[:id])\n\n respond_to do |format|\n if @yaopin.update_attributes(params[:yaopin])\n format.html { redirect_to @yaopin, notice: 'Yaopin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yaopin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @syohin.update(syohin_params)\n format.html { redirect_to @syohin, notice: 'Syohin was successfully updated.' }\n format.json { render :show, status: :ok, location: @syohin }\n else\n format.html { render :edit }\n format.json { render json: @syohin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update\n # @outlet = Outlet.find(id: params[:outlet][:id])\n\n # respond_to do |format|\n # twitter follower test\n if @outlet.twitter.present?\n credentials = Base64.encode64(\"#{TWITTER_ID}:#{TWITTER_SECRET}\").gsub(\"\\n\", '')\n url = \"https://api.twitter.com/oauth2/token\"\n body = \"grant_type=client_credentials\"\n headers = {\n \"Authorization\" => \"Basic #{credentials}\",\n \"Content-Type\" => \"application/x-www-form-urlencoded;charset=UTF-8\"\n }\n r = HTTParty.post(url, body: body, headers: headers)\n bearer_token = JSON.parse(r.body)['access_token']\n\n api_auth_header = {\"Authorization\" => \"Bearer #{bearer_token}\"}\n url = \"https://api.twitter.com/1.1/users/show.json?screen_name=#{@outlet.twitter}\"\n response = HTTParty.get(url, headers: api_auth_header).body\n parsed_response = JSON.parse(response)\n twitter_followers = parsed_response[\"followers_count\"].to_s\n\n if twitter_followers.present?\n if twitter_followers.length > 3\n twitter_followers = twitter_followers.chop.chop.chop+\"k\"\n end\n @outlet.update(twitter_followers: twitter_followers)\n end\n end\n\n # facebook follower test\n if @outlet.facebook.present?\n url = \"https://graph.facebook.com/#{@outlet.facebook}?fields=fan_count&access_token=#{FACEBOOK_ID}|#{FACEBOOK_SECRET}\"\n facebook_response = HTTParty.get(url)\n parsed_facebook_response = JSON.parse(facebook_response)\n facebook_followers = parsed_facebook_response[\"fan_count\"].to_s\n if facebook_followers.present?\n if facebook_followers.length > 3\n facebook_followers = facebook_followers.chop.chop.chop+\"k\"\n end\n @outlet.update(facebook_likes: facebook_followers)\n end\n end\n\n # insta follower test\n # if @outlet.instagram.present?\n # url = \"https://www.instagram.com/web/search/topsearch/?query=#{@outlet.name}\"\n # insta_response = HTTParty.get url\n # insta_followers = insta_response[\"users\"].first[\"user\"][\"byline\"].chomp(\" followers\")\n # if insta_followers.present?\n # @outlet.update(instagram_followers: insta_followers)\n # end\n # end\n\n\n\n if @outlet.update(outlet_params)\n\n # format.html { redirect_to edit_outlet_path(@outlet), notice: 'Outlet was successfully updated.' }\n render json: {status:\"Update successful\", outlet: @outlet}\n else\n # format.html { render :edit }\n # format.json { render json: @outlet.errors, status: :unprocessable_entity }\n render json: {status:\"Update unsuccessful\", outlet: @outlet, error: Rails.logger.info(@outlet.errors.inspect)}\n end\n # end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to @inning, notice: 'Inning was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sinnoh.update(sinnoh_params)\n format.html { redirect_to @sinnoh, notice: 'Sinnoh was successfully updated.' }\n format.json { render :show, status: :ok, location: @sinnoh }\n else\n format.html { render :edit }\n format.json { render json: @sinnoh.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n if @insumo.update(insumo_params)\n format.html { redirect_to insumos_url , notice: 'Insumo was successfully updated.' }\n format.json { render :show, status: :ok, location: @insumo }\n else\n format.html { render :edit } \n format.json { render json: @insumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @seihinn.update(seihinn_params)\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully updated.\" }\n format.json { render :show, status: :ok, location: @seihinn }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end",
"def update\n put :update\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n if @sin.update_attributes(params[:sin])\n format.html { redirect_to @sin, notice: 'Binge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @obsah.update(obsah_params)\n format.html { redirect_to @obsah, notice: 'Obsah was successfully updated.' }\n format.json { render :show, status: :ok, location: @obsah }\n else\n format.html { render :edit }\n format.json { render json: @obsah.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @response = args[:response] if args.key?(:response)\n end",
"def update\n respond_to do |format|\n if @onsen.update(onsen_params)\n format.html { redirect_to @onsen, notice: 'Onsen was successfully updated.' }\n format.json { render :show, status: :ok, location: @onsen }\n else\n format.html { render :edit }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_obsah\n @obsah = Obsah.find(params[:id])\n end",
"def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @single_housing.update(single_housing_params)\n format.html { redirect_to @single_housing, notice: 'Single housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @single_housing }\n else\n format.html { render :edit }\n format.json { render json: @single_housing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n if @inscrito.update_attributes(params[:inscrito])\n format.html { redirect_to @inscrito, notice: 'Inscrito was successfully updated. #{undo_link}' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inscrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @houmon.update(houmon_params)\n format.html { redirect_to @houmon, notice: 'Houmon was successfully updated.' }\n format.json { render :show, status: :ok, location: @houmon }\n else\n format.html { render :edit }\n format.json { render json: @houmon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def set_api_v1_initiative_update\n @api_v1_initiative_update = Api::V1::InitiativeUpdate.find(params[:id])\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update obj, &block\n populate(obj, &block).save!\n json obj\n end",
"def update\n respond_to do |format|\n if @oyun.update(oyun_params)\n format.html { redirect_to @oyun, notice: 'Oyun was successfully updated.' }\n format.json { render :show, status: :ok, location: @oyun }\n else\n format.html { render :edit }\n format.json { render json: @oyun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n if @stone.update_attributes(params[:stone])\n format.html { redirect_to @stone, notice: 'Stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n if @onske.update_attributes(params[:onske])\n format.html { redirect_to @onske, notice: 'Onske was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def update\n @indoor = Indoor.find(params[:id])\n\n respond_to do |format|\n if @indoor.update_attributes(params[:indoor])\n format.html { redirect_to(@indoor, :notice => 'Indoor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @indoor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n standard_update(Interest, params[:id], interest_params)\n end",
"def update\n @hijo = Hijo.find(params[:id])\n\n respond_to do |format|\n if @hijo.update_attributes(params[:hijo])\n format.html { redirect_to @hijo, notice: 'Hijo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hijo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save(request)\n raise ArgumentError, \"PUT does not accept options\" unless request.options.empty?\n update(request) || create(request)\n end",
"def update\n respond_to do |format|\n if @oiseau.update(oiseau_params)\n format.html { redirect_to @oiseau, notice: 'Oiseau was successfully updated.' }\n format.json { render :show, status: :ok, location: @oiseau }\n else\n format.html { render :edit }\n format.json { render json: @oiseau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index(obj_or_request)\n request = get_request(obj_or_request)\n Connection.new.put request if request.body\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(obj)\n end",
"def update\n @outing = Outing.find(params[:id])\n \n @outing.attributes = {'activity_ids' => []}.merge(params[:outing] || {})\n\n respond_to do |format|\n if @outing.update_attributes(params[:outing])\n format.html { redirect_to @outing, notice: 'Outing was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @outing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end",
"def put(*args, &block)\n self.client.put *args\n end",
"def update\n respond_to do |format|\n if @invent.update(invent_params)\n format.html { redirect_to @invent, notice: 'Invent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def set_insint\n @insint = Insint.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @iine.update(iine_params)\n format.html { redirect_to @iine, notice: 'Iine was successfully updated.' }\n format.json { render :show, status: :ok, location: @iine }\n else\n format.html { render :edit }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hoho.update(hoho_params)\n format.html { redirect_to @hoho, notice: 'Hoho was successfully updated.' }\n format.json { render :show, status: :ok, location: @hoho }\n else\n format.html { render :edit }\n format.json { render json: @hoho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @shouldersbiceps1.update(shouldersbiceps1_params)\n format.html { redirect_to \"/shouldersbiceps1s\"}\n format.json { render :show, status: :ok, location: @shouldersbiceps1 }\n else\n format.html { render :edit }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n @hoge = Hoge.find(params[:id])\n\n respond_to do |format|\n if @hoge.update_attributes(params[:hoge])\n format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n if @instituicao.update_attributes(params[:instituicao])\n format.html { redirect_to @instituicao, notice: 'Instituicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instituicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wine_oenologist.update(wine_oenologist_params)\n format.html { redirect_to @wine_oenologist, notice: \"Wine oenologist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @wine_oenologist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @wine_oenologist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_syohin\n @syohin = Syohin.find(params[:id])\n end",
"def atualiza_um_pet_existente(objeto)\n uri = \"#{ENV['BASE_URI']}/pet\"\n \n without_authentication('put', uri, objeto.to_json)\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @inventories = args[:inventories] if args.key?(:inventories)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end",
"def set_api_v1_mentorship_interest\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.find(params[:id])\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to(@inning, :notice => 'Inning was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to(@inning, :notice => 'Inning was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(data = :object || :json)\n end",
"def update\n #update venues trought users controller\n\n @user = User.find_by(authentication_token: request.headers['Authorization'])\n\n if @user.is_venue?\n @user.venue.update(venue_params)\n if @user.venue.update(venue_params)\n render json: {status: :ok}\n else\n render json: {msg: 'Invalid params'}\n end\n else\n render json: {msg: 'You dont own a venue'}, status: :error\n end\n \n\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @outdoor = Outdoor.find(params[:id])\n\n respond_to do |format|\n if @outdoor.update_attributes(params[:outdoor])\n format.html { redirect_to @outdoor, notice: 'Outdoor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @outdoor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @out.update(out_params)\n format.json { render :show, status: :ok, location: @out }\n else\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sinnoh\n @sinnoh = Sinnoh.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @shogi.update(shogi_params)\n format.html { redirect_to @shogi, notice: 'Shogi was successfully updated.' }\n format.json { render :show, status: :ok, location: @shogi }\n else\n format.html { render :edit }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.61012685",
"0.6011096",
"0.59603673",
"0.5956994",
"0.5943289",
"0.59146076",
"0.59111",
"0.58982176",
"0.58756256",
"0.58387744",
"0.57933974",
"0.5760879",
"0.5687984",
"0.56679493",
"0.56552255",
"0.56528986",
"0.5633129",
"0.56303215",
"0.56303215",
"0.55878145",
"0.5585112",
"0.5572764",
"0.55624527",
"0.5560322",
"0.55497694",
"0.55340165",
"0.5533576",
"0.55277985",
"0.5527049",
"0.55259895",
"0.5519568",
"0.5513273",
"0.550674",
"0.54995227",
"0.5498198",
"0.5496868",
"0.5490305",
"0.54856277",
"0.5474359",
"0.5467774",
"0.5465712",
"0.5464926",
"0.54649013",
"0.5454291",
"0.5451979",
"0.54477066",
"0.54458237",
"0.54412115",
"0.5429907",
"0.5427494",
"0.5426252",
"0.5414072",
"0.5408262",
"0.539263",
"0.53895444",
"0.538797",
"0.5384079",
"0.53772336",
"0.5374001",
"0.53722036",
"0.5371508",
"0.5369708",
"0.53666586",
"0.5363129",
"0.5356331",
"0.53483427",
"0.5345855",
"0.5343402",
"0.53401494",
"0.53385794",
"0.5338569",
"0.533087",
"0.5329092",
"0.53267",
"0.531884",
"0.53148264",
"0.53136486",
"0.5311125",
"0.53089416",
"0.5307829",
"0.530689",
"0.5306569",
"0.5301889",
"0.5300538",
"0.5298699",
"0.529724",
"0.5288451",
"0.52882457",
"0.52880627",
"0.5285421",
"0.52814734",
"0.5274892",
"0.5274892",
"0.5273696",
"0.5269957",
"0.5267189",
"0.52669805",
"0.52622426",
"0.5261622",
"0.5259103"
] |
0.5905801
|
7
|
DELETE /byoins/1 DELETE /byoins/1.json
|
def destroy
@byoin = Byoin.find(params[:id])
@byoin.destroy
respond_to do |format|
format.html { redirect_to byoins_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @yaopin = Yaopin.find(params[:id])\n @yaopin.destroy\n\n respond_to do |format|\n format.html { redirect_to yaopins_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end",
"def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete\n request(:delete)\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @insumo.destroy\n respond_to do |format|\n format.html { redirect_to insumos_url, notice: 'Insumo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def delete!\n request! :delete\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @out.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @obsah.destroy\n respond_to do |format|\n format.html { redirect_to obsahs_url, notice: 'Obsah was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(oid)\n end",
"def destroy\n @oase = Oasis.find(params[:id])\n @oase.destroy\n\n respond_to do |format|\n format.html { redirect_to oases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soiree = Soiree.find(params[:id])\n @soiree.destroy\n\n respond_to do |format|\n format.html { redirect_to soirees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @inning = Inning.find(params[:id])\n @inning.destroy\n\n respond_to do |format|\n format.html { redirect_to innings_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n @osoba = Osoba.find(params[:id])\n @osoba.destroy\n\n head :no_content\n end",
"def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end",
"def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recinto = Recinto.find(params[:id])\n @recinto.destroy\n\n respond_to do |format|\n format.html { redirect_to recintos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicacao = Indicacao.find(params[:id])\n @indicacao.destroy\n\n respond_to do |format|\n format.html { redirect_to indicacoes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def destroy\n @inside.destroy\n respond_to do |format|\n format.html { redirect_to insides_url, notice: 'Inside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n \n end",
"def destroy\n @objet = Objet.find(params[:id])\n @objet.destroy\n\n respond_to do |format|\n format.html { redirect_to objets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objet = Objet.find(params[:id])\n @objet.destroy\n respond_to do |format|\n format.html { redirect_to objets_url }\n format.json { head :no_content }\n end\n end",
"def deleteRequest\n\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incucai = Incucai.find(params[:id])\n @incucai.destroy\n\n respond_to do |format|\n format.html { redirect_to incucais_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.71535367",
"0.6996581",
"0.69334257",
"0.6872575",
"0.6849983",
"0.6773241",
"0.67722857",
"0.6752195",
"0.6746345",
"0.6733793",
"0.6733225",
"0.673185",
"0.673185",
"0.673185",
"0.673185",
"0.67070353",
"0.67050636",
"0.66941684",
"0.66412836",
"0.66408604",
"0.66259706",
"0.6612239",
"0.661021",
"0.6605817",
"0.6592826",
"0.6571802",
"0.65702796",
"0.65675247",
"0.6567394",
"0.6566718",
"0.6564954",
"0.65637505",
"0.65616554",
"0.6530484",
"0.65294427",
"0.6521278",
"0.6518151",
"0.65175873",
"0.65137774",
"0.65130836",
"0.64898485",
"0.64817685",
"0.6480278",
"0.64738625",
"0.6471396",
"0.6460995",
"0.6458154",
"0.6454945",
"0.6453693",
"0.645325",
"0.6452212",
"0.6451911",
"0.6450226",
"0.64423025",
"0.64362586",
"0.64345634",
"0.64322704",
"0.6430092",
"0.64249593",
"0.6424688",
"0.6421767",
"0.64213216",
"0.64199597",
"0.6419384",
"0.6417971",
"0.6417971",
"0.64166063",
"0.6415403",
"0.6412424",
"0.641149",
"0.64093095",
"0.64091426",
"0.6406808",
"0.64067125",
"0.640621",
"0.6405214",
"0.6404247",
"0.64025044",
"0.6401819",
"0.6399464",
"0.6397625",
"0.6397577",
"0.6395758",
"0.6395758",
"0.6394846",
"0.6389592",
"0.63874483",
"0.6387091",
"0.63863367",
"0.6385094",
"0.6381391",
"0.63809174",
"0.6380791",
"0.63777465",
"0.63749975",
"0.637444",
"0.6371904",
"0.6371893",
"0.6371519",
"0.63711"
] |
0.69972354
|
1
|
Search params : byoinNm
|
def search
#conditions = Byoin.where("\"byoinCd\" NOT ?", nil)
conditions = Byoin.where("1 = ?", 1)
conditions = conditions.where("\"byoinNm\" LIKE ?", params[:byoinNm] + "%") if params[:byoinNm] != ""
logger.debug(conditions)
records = conditions.count
limit = params[:rows].to_i
page = params[:page].to_i
if records > 0
n = records.quo(limit)
total_pages = n.ceil
else
total_pages = 0
end
start = limit * page - limit;
@byoins = conditions.find(
:all,
:offset => start,
:limit => limit,
:order => "\"byoinCd\" DESC")
@responce = {
total: total_pages.to_s,
page: params[:page],
records: records.to_s,
rows: @byoins
}
#logger.debug(@responce)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @responce }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def search(arg, by: nil)\n\t\t\tr={type: \"search\", arg: arg}\n\t\t\tr[:by]=by if by\n\t\t\t# if :by is not specified, aur defaults to name-desc\n\t\t\tself.query(r)\n\t\tend",
"def search(criteria = {})\r\n \r\n end",
"def search_params\n params.require(:search).permit(:result_no, :generate_no, :last_result_no, :last_generate_no, :e_no, :sub_no, :main_no, :i_no, :i_name, :value)\n end",
"def search\n\n end",
"def search(params)\n raise NotImplementedError\n end",
"def search_params\n params[:name]\n end",
"def search \n\n end",
"def search_for(**search_by)\n search_by.keys.each do |key|\n raise \"Illegal search modifier: #{key}\" unless VALID_SEARCH_PARAMETERS.member?(key)\n end\n\n log.info \"[ACTION] Search with #{search_by.to_json}\"\n\n # Remove these 3 from search_by as they are used to next loop doesn't try to use them\n fill_in_if(:search_text, search_by.delete(:search_text))\n fill_in_if(:min_price, search_by.delete(:min_price))\n fill_in_if(:max_price, search_by.delete(:max_price))\n\n search_by.each do |locate_by, value|\n set_checkbox(locate_by, value)\n end\n\n click_search\n\n # Return WebPage object\n self.class.send(:given)\n end",
"def search\n\n end",
"def condicion_search(pparams, phash, pmodel)\n cp = 0\n pv = 0\n cad = ' '\n\n pparams.each do |k,v|\n if (k != 'utf8' and k != 'action' and k != 'controller' and k != 'srchmodel' and k != 'page') \n\t\n\t if v.rstrip != ''\n\t\t\n\t \tif pv > 0\n\t\t\tcad += \" AND \"\n\t\tend\n\t\t\n\t\tif k.to_s == \"searchfield\"\n\t\t \n \t\t if es_entero(v)\n\t\t \tif pmodel.hsearch_fields[0]==\"codigo\" or pmodel.hsearch_fields[0]==\"cliente_cod\"\n\t\t\t cad += pmodel.hsearch_fields[0]+\" = '#{v}' \"\n\t\t\telse\n\t\t\t cad += pmodel.hsearch_fields[0]+\" = #{v} \"\n\t\t\tend\n\t\t else\n\t\t sr = v.to_s\n\t\t\tif pmodel.hsearch_fields[0]==\"codigo\"\n\t\t\t cad += pmodel.hsearch_fields[1]+\" LIKE '%#{sr.capitalize}%'\"\t\n\t\t\telse \n\t\t\t cad += pmodel.hsearch_fields[1]+\"||to_char(\"+pmodel.hsearch_fields[0]+\",'99999') LIKE '%#{sr.capitalize}%'\"\t\n\t\t\tend\t \n\t\t end\n\t\n\t\telse #si no es searchfield\n\t \t\n \t\t tipo = phash[k].type\n\t\t case tipo\n\t\t when :string, :text\n\t\t sr = v.to_s\n\t\t\t if k.to_s == \"codigo\" or k.to_s == \"cliente_cod\" \n\t\t\t\t cad += \"upper(\"+k + \") = '#{sr.upcase}'\"\n\t\t\t else\n\t\t\t\t cad += \"upper(\"+k + \") like '%#{sr.upcase}%'\" \n\t\t\t end\t\t\n\t\t when :date, :datetime, :timestamp\n\t\t\t cad += k + \" = '#{v}'\"\n\t\t else\n\t\t\t cad += k + \" = #{v} \"\n\t end\n\t\tend #del searchfield\n\t\tpv += 1\n\t end \n\t cp += 1\n end\n end #del each\n \n if cp == 0\n \" 1 = 0\"\n else\n if pv == 0\n\t \" 1 = 1 \"\n else\n\t cad\n end \n end \nend",
"def search\n end",
"def index\n #@owners = Owner.all\n if params[:q]\n @owners = Owner.where(\"nombre LIKE '%\"+params[:q]+\"%' or clave LIKE '%\"+params[:q]+\"%'\")\n end\n\n end",
"def search; end",
"def search\n @users = User.all.order(:user_id)\n if params[:search][:annual].present?\n @users = @users.where(\"annual like '%\" + params[:search][:annual] + \"%' \").order(:user_id) \n end\n if params[:search][:name].present?\n @users = @users.where(\"name like '%\" + params[:search][:name] + \"%' \").order(:user_id)\n end\n @name = params[:search][:name]\n @annual = params[:search][:annual]\n render :index\n end",
"def search\n @search_criteria =\"\"\n if params[:q].eql? \"\"\n @search_criteria =\"All\"\n @items = Item.all.paginate(:page => params[:page], per_page: 9)\n else\n @st = \"%#{params[:q]}%\"\n @search_criteria = params[:q]\n @items = Item.where(\"LOWER(title) LIKE ?\", @st.downcase).paginate(:page => params[:page], per_page: 9)\n end\n end",
"def search_params\n # params[:search]\n end",
"def filtering_params(params)\n params.slice(:omnisearch)\n end",
"def search(query); end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search_params search\n search = Hash.new\n [:writing, :kana, :romaji, :def_de, :def_en, :def_fr].each do |field|\n search[field] = \"%#{params[:search]}%\"\n end\n search\n end",
"def search\n @methods = UnitMethod.all({\n :conditions => [\"name LIKE ?\", \"%#{params[:search].blank? ? '+' : params[:search]}%\"],\n :limit => 10\n })\n end",
"def name_search( type, search_for, order_by = 'name' )\n self.send(type.to_sym, { namesearch: search_for, order: order_by })\n end",
"def index\n\n if params[:search]\n @rhs = Rh.search(params[:search]) \n else \n @rhs = Rh.order(\"Nome\")\n end\n\n end",
"def search_param\n params[:loans][:search] if params[:accounting_entries] || nil\n end",
"def fullsearch\n if params[:isbn]\n @books = Book.where(:ISBN => params[:isbn])\n elsif params[:title]\n @books = Book.where(\"Title LIKE :title1\", { :title1 => \"#{params[:title]}%\"})\n elsif params[:author]\n @books = Book.where(\"Authors LIKE :author1\", { :author1 => \"#{params[:author]}%\"})\n elsif params[:description]\n @books = Book.where(\"Description LIKE :description1\", { :description1 => \"#{params[:description]}%\"})\n else\n @books = Book.all\n end\n end",
"def search(params)\n filter_name, keywords, field_queries = extract params\n scope = filtered_by filter_name\n query = text_search keywords\n query = field_search field_queries, query\n scope.where query\n end",
"def index\n\n @household_items = HouseholdItem.all\n\n # Search Function\n if params[:search]\n # for non postgresql\n if @household_items = HouseholdItem.where(\"title iLIKE ? OR genre iLIKE ? OR city iLIKE ? OR state iLIKE ? OR genre iLIKE ? \",\"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n # for postgresql change the LIKE to iLIKE\n # byebug\n # where(\"title iLIKE ? OR genre iLIKE ? OR author iLIKE ?\", \"%#{search}%\", \"%#{search}%\", \"%#{search}%\") \n else\n @message = \"We can not find your request !\" \n @household_items = HouseholdItem.all\n # byebug\n end\n end\n\n end",
"def search\r\nend",
"def index\n @myjobs = Myjob.where(\"company like (?) OR experince =? Location like (?) OR technology like (?)\",\"#{params[:search_com]}\",\"#{params[:search_exp]}\",\"%#{params[:search_location]}%\",\"%#{params[:search_tec]}%\")\n conditions = []\n if params[:search_com].present?\n conditions[0] = \"company like (?)\"\n conditions << \"#{params[:search_com]}\"\n end\n if params[:search_exp].present?\n if conditions[0].present?\n conditions[0] += \" OR company like (?)\"\n else\n conditions[0] += \"company like (?)\"\n end\n conditions << \"#{params[:search_com]}\"\n end\n\n @myjobs = Myjob.where(conditions)\n # binding.pry\n end",
"def search_param\n params[:loans][:search] if params[:loans] || nil\n end",
"def search_people(searchterm,params={})\n @opensearch.search_people(searchterm,params) \n end",
"def search(*args)\n end",
"def search\nend",
"def search_condition\n if search_support? && params[:q].present?\n clause = search_columns.collect {|f| \"#{model_class.table_name}.#{f} LIKE ?\" }.\n join(\" OR \")\n param = \"%#{params[:q]}%\"\n [\"(#{clause})\"] + [param] * search_columns.size\n end\n end",
"def search_params\n params.require(:search).permit(:ris)\n end",
"def search\n query = \"%\" + params[:search] + \"%\"\n @course = Course.where(\"name LIKE ?\", query)\n # if params[:search]\n # @course = Course.where(params:[:search]).order(\"created_at DESC\")\n # else\n # @course = Course.all.order(\"created_at DESC\")\n #This was causing an error with the search\n #@courses = Course.all;\n #end\n end",
"def find\n puts params[:search_string]\n @results = Clientworkout.where(client_name: params[:search_string])\n #@results = Clientworkout.where('lower(client_name)=?' params[:search_string])\n end",
"def index \n #忽略\n @q = Addtype.search(params[:q]) \n if params[:q].nil? \n @addtypes=Addtype.order(:id).page(params[:page]).per(10)\n else \n if params[:q][\"name_cont\"].lstrip.rstrip==\"\"\n @addtypes=Addtype.order(:id).page(params[:page]).per(10)\n else\n search = params[:q][\"search_cont\"]\n @addtypes = Addtype.where( \" #{search} like ?\", \"%#{params[:q][\"name_cont\"]}%\" ).page(params[:page]).per(10)\n end\n end \n end",
"def by\n new_params = search.params || {}\n new_params[:order] = definition.request_value\n search.class.new_unwrapped(new_params, search.root)\n end",
"def search_params\n params.fetch(:search, {})\n end",
"def search_params\n params.fetch(:search, {})\n end",
"def search_params\n params.fetch(:search, {})\n end",
"def index\n @vehicels = Vehicel.where(\"user_id = ?\", params[:user_id]).order(created_at: :desc)\n return @vehicels = Vehicel.where(\"vehicel_brand like ? or vehicel_model like ?\", \"%#{params[:search_field].downcase}%\" , \"%#{params[:search_field].downcase}%\").all if params[:commit] == \"Search\"\n end",
"def sort_and_search(loans)\n if search_param\n @loans = loans.list_with_loan_type_and_client.order(\"#{sort_column_param} #{sort_order_param}\").simple_search search_param\n else\n @loans = loans.list_with_loan_type_and_client.order(\"#{sort_column_param} #{sort_order_param}\")\n end\n end",
"def search_params\n params.require(:search).permit(:tabella, :campo, :argomento, :data, :occorrenze, :tipo)\n end",
"def search\n if params.has_key?('search')\n @orders = Order.search(params['search'])\n else\n @orders = []\n end\n params['search'] ||= {}\n @s_rate_name = params.has_key?('search') ? params[:search][:rate_name] : \"\"\n @s_rate_time_of_day = params.has_key?('search') ? params[:search][:times_of_day] : \"\"\n @s_rate_how_far = params.has_key?('search') ? params[:search][:rate_how_far] : \"\"\n @s_auto_model = params.has_key?('search') ? params[:search][:auto_model] : \"\"\n @s_auto_class = params.has_key?('search') ? params[:search][:auto_class] : \"\"\n @s_auto_color = params.has_key?('search') ? params[:search][:auto_color] : \"\"\n end",
"def index\n if params[:search]\n @lostfounds= Lostfound.where('name LIKE ? OR detail LIKE?', \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n else\n @lostfounds = Lostfound.all\n end\n end",
"def query_param\n return unless search_query\n \"search=#{search_query}&phrase=true\"\n end",
"def fees_student_structure_search_logic # student search fees structure\n query = params[:query]\n unless query.length < 3\n @students_result = Student.find(:all,\n :conditions => [\"first_name LIKE ? OR middle_name LIKE ? OR last_name LIKE ?\n OR admission_no = ? OR (concat(first_name, \\\" \\\", last_name) LIKE ? ) \",\n \"#{query}%\", \"#{query}%\", \"#{query}%\", \"#{query}\", \"#{query}\"],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n else\n @students_result = Student.find(:all,\n :conditions => [\"admission_no = ? \", query],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n end\n render :layout => false\n end",
"def search\n search_params = \"%#{params[:search_params]}%\"\n @code_programs = CodeProgram.where(\"city like ? OR keywords like ? OR mission_description like? OR organization_name like?\", search_params, search_params, search_params, search_params)\n puts \"yo\"\n p @code_programs\n render :index\n end",
"def searchName\n @nombre=params[:nombre]\n @death_record_items=buscarNombre(@nombre)\n end",
"def search_param_params\n params.require(:search_param).permit(:name, :mount, :flange_focal_distance, :sensor_size, :work_length, :work_lenght_round, :xiangyuan)\n end",
"def search\n conditions = KonyuRireki.where(\"konyu_rirekis.\\\"delFlg\\\" = ?\", 0)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"kokyakuId\\\"\", :kokyakuIdFrom, :kokyakuIdTo)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"hokenShubetsuCd1\\\"\", :hokenShubetsuCd1)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"hokenShubetsuCd2\\\"\", :hokenShubetsuCd2)\n conditions = add_condition_date(conditions, \"\\\"juchuDt\\\"\", :juchuDtFrom, :juchuDtTo)\n conditions = add_condition_name(conditions, \"byoins.\\\"byoinNm\\\"\", :byoinNm)\n conditions = add_condition_date(conditions, \"\\\"kariAwaseDt\\\"\", :kariAwaseDtFrom, :kariAwaseDtTo)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNm1\\\"\", :kokyakuNm1)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNm2\\\"\", :kokyakuNm2)\n conditions = add_condition_name(conditions, \"konyu_rirekis.\\\"shohinNm\\\"\", :shohinNm)\n conditions = add_condition_date(conditions, \"\\\"nohinDt\\\"\", :nohinDtFrom, :nohinDtTo)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNmKana1\\\"\", :kokyakuNmKana1)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNmKana2\\\"\", :kokyakuNmKana2)\n conditions = add_condition_userNm(conditions, \"ust\", :uketsukeSesakuTantoNm)\n conditions = add_condition_date(conditions, \"\\\"kofuDt\\\"\", :kofuDtFrom, :kofuDtTo)\n conditions = add_condition_str(conditions, \"konyu_rirekis.\\\"shubetsuKn\\\"\", :shubetsuKn)\n conditions = add_condition_userNm(conditions, \"kat\", :kariAwaseTantoNm)\n conditions = add_condition_date(conditions, \"\\\"nyukinDt\\\"\", :nyukinDtFrom, :nyukinDtTo)\n conditions = add_condition_name(conditions, \"seihins.\\\"hinmeiNm\\\"\", :hinmeiNm)\n conditions = add_condition_userNm(conditions, \"nt\", :nohinTantoNm)\n conditions = add_condition_date(conditions, \"\\\"oshiinDt\\\"\", :oshiinDtFrom, :oshiinDtTo)\n conditions = add_condition_userNm(conditions, \"mt\", :mitsumoriTantoEigyoNm)\n conditions = add_condition_date(conditions, \"\\\"kanryoDt\\\"\", :kanryoDtFrom, :kanryoDtTo)\n conditions = add_condition_date(conditions, \"\\\"mitsumoriDt\\\"\", :mitsumoriDtFrom, :mitsumoriDtTo)\n\n # 検索に必要なSQL文を取得する\n select, joins = get_select_stmt(:select)\n\n records = conditions.count(:joins => joins)\n limit = params[:rows].to_i\n page = params[:page].to_i\n if records > 0\n n = records.quo(limit)\n total_pages = n.ceil\n else\n total_pages = 0\n end\n start = limit * page - limit;\n\n @konyu_rirekis = conditions.find(\n :all,\n :select => select,\n :joins => joins,\n :offset => start,\n :limit => limit,\n :order => \"konyu_rirekis.\\\"kokyakuId\\\" ASC\")\n\n @responce = {\n total: total_pages.to_s,\n page: params[:page],\n records: records.to_s,\n rows: @konyu_rirekis\n }\n logger.debug(@responce)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responce }\n end\n end",
"def index\n unless params['body']['search'].blank?\n @amenities = Amenity.where([\"name ILIKE ?\",\"%#{params['body']['search']}%\"])\n else\n @amenities =Amenity.order('created_at ASC')\n end\n end",
"def search\n col_dict = {\n :unit_code => \"0\",\n :name => \"1\",\n :email => \"2\"\n }\n \n if params[:filter]\n col_dict.keys.each do |k|\n search = params[:filter][ col_dict[k] ]\n next if search.blank?\n \n if k == :name\n fn, ln = search.split(\" \", 2)\n \n if !ln.blank?\n params[:first_name] = fn\n params[:last_name] = ln\n \n else\n params[:first_name] = fn\n end\n \n else\n params[k] = search\n end\n \n end\n end\n \n # tablesorter page index start with 0\n params[:page] = params[:page].to_i + 1\n \n filter_residents(10)\n \n #render :json => {:resident_path => @resident ? property_resident_path(@property, @resident, :anchor => \"addTicket\") : nil }\n \n render template: \"residents/table.json.rabl\" \n \n end",
"def search\n\t\t@articles = Article.where(\"text = ?\",params[:q])\n \n #Article.find_by_text(params[:q])\n \n #debug\n @articles.each do |article|\n puts article.title\n end\n \n \n\t\t#@articles = Article.where(:text => params[:q]) ' 1=1 -- '\n\n\t\t#@articles = Article.where(\"text = ?\", params[:q] )\n \n \n #TODO\n # add filter for other fields\n # Article.where(\"text = ? and title = ?\",params[:text],params[:title])\n \n # to add LIKE filter SQL : name like %aa%\n # \"name LIKE ? OR postal_code like ?\", \"%#{search}%\", \"%#{search}%\"\n \n end",
"def search(params={})\n rpc_call :search, params\n end",
"def search_params\n params.require(:search).permit(:searchType, :fullTextSearch, :flightNumber, :pic, :sic, :airfield, :revenue, :memberName, :dateStart, :dateEnd, :prepMin, :prepMax, :caterMin, :caterMax, :depMin, :depMax, :flightMin, :flightMax, :arrMin, :arrMax, :maintMin, :maintMax, :catering, :maint, :createdBy, :hasComments, :save_search, :save_search_name, :overallmin, :overallmax, :user_id)\n end",
"def search\n # figure out if the search parameter looks like a first or last name only, or both\n @search = params[:search]\n if @search && !@search.empty?\n \tnames = @search.strip.split(' ')\n \tconditions = [[],[]]\n \tif (names.size > 1)\n\t \tfirst = names[0].to_s\n \t\tlast = names[1].to_s\n\t \tconditions[0] << \"#{_(:last_name, :person)} LIKE ? AND #{_(:first_name, :person)} LIKE ? \"\n\t \tconditions[1] << last + \"%\"\n\t \tconditions[1] << first + \"%\"\n\t \telse\n\t \t name = names.join\n\t \t\tconditions[0] << \"(#{_(:last_name, :person)} LIKE ? OR #{_(:first_name, :person)} LIKE ?) \"\n\t \t\tconditions[1] << name+'%'\n\t \t\tconditions[1] << name+'%' \n\t \tend\n\t \tif params[:filter_ids].present?\n\t \t conditions[0] << \"#{_(:id, :person)} NOT IN(?)\"\n\t \t conditions[1] << params[:filter_ids]\n \t end\n \t \n \t # Scope by the user's ministry / campus involvements\n \t involvement_condition = \"(\"\n \t if my_campus_ids.present?\n \t involvement_condition += \"#{CampusInvolvement.table_name}.#{_(:campus_id, :campus_involvement)} IN(?) OR \" \n \t \tconditions[1] << my_campus_ids\n \t end\n \t involvement_condition += \"#{MinistryInvolvement.table_name}.#{_(:ministry_id, :ministry_involvement)} IN(?) )\" \n \t \n\t \tconditions[0] << involvement_condition\n\t \tconditions[1] << current_ministry.self_plus_descendants.collect(&:id)\n\t \t\n\t \t@conditions = [ conditions[0].join(' AND ') ] + conditions[1]\n \n includes = [:current_address, :campus_involvements, :ministry_involvements]\n\t \t@people = Person.find(:all, :order => \"#{_(:last_name, :person)}, #{_(:first_name, :person)}\", :conditions => @conditions, :include => includes)\n\t \trespond_to do |format|\n\t \t if params[:context]\n\t \t format.js {render :partial => params[:context] + '/results', :locals => {:people => @people, :type => params[:type], :group_id => params[:group_id]}}\n \t else\n \t format.js {render :action => 'results'}\n\t end\n\t \tend\n\t else\n\t render :nothing => true\n\t end\n end",
"def fetch_custom_search_params; end",
"def index\n @hoteles = Hotele.where([\"nombre LIKE ?\",\"%#{params[:search]}%\"])\n end",
"def search_params\n params.require(:search).permit(:keyword, :zona, :last_run,:zone_id)\n end",
"def index\n if params[:search] then\n @users = User.where(\"(lower(full_name) LIKE :search) OR (lower(forum_name) LIKE :search)\", search: \"%#{params[:search]}%\".downcase)\n @users = @users.order(:aclx_id).paginate(:page => params[:page], :per_page => 5)\n end\n end",
"def search\n if params[:search].present?\n # This is for the elastic search\n #@bid_items = BidItem.search(params[:search])\n\n # Those are Ruby SQL queries\n # This is to search item_name\n #@bid_items = BidItem.where(:item_name => params[:search])\n # This is to search price larger than\n @bid_items = BidItem.where(\"starting_price > ?\", params[:search])\n else\n @bid_items = BidItem.order(\"id DESC\").limit(30)\n end\n end",
"def search\n\n # 検索条件設定\n conditions = KanseiBuhin.where(\"1 = ?\", 1)\n conditions = conditions.where(\"\\\"buhinNm\\\" LIKE ?\", params[:buhinNm] + \"%\") if params[:buhinNm] != \"\"\n conditions = conditions.where(\"\\\"katashikiCd\\\" >= ?\", params[:katashikiCdFrom].to_i) if params[:katashikiCdFrom] != \"\"\n conditions = conditions.where(\"\\\"katashikiCd\\\" <= ?\", params[:katashikiCdTo].to_i) if params[:katashikiCdTo] != \"\"\n conditions = conditions.where(\"\\\"katashikiNm\\\" LIKE ?\", params[:katashikiNm] + \"%\") if params[:katashikiNm] != \"\"\n\n logger.debug(conditions)\n\n records = conditions.count\n limit = params[:rows].to_i\n page = params[:page].to_i\n if records > 0\n n = records.quo(limit)\n total_pages = n.ceil\n else\n total_pages = 0\n end\n\n # 検索開始\n start = limit * page - limit;\n @kanseiBuhins = conditions.find(\n :all,\n :offset => start,\n :limit => limit,\n :order => \"\\\"buhinCd\\\"\")\n\n # 値の格納\n @responce = {\n total: total_pages.to_s,\n page: params[:page],\n records: records.to_s,\n rows: @kanseiBuhins\n }\n #logger.debug(@responce)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responce }\n end\n end",
"def search\n @filters = params.slice(:university)\n\n if params[:search].present?\n \n @tutor_profiles = TutorProfile.where(\"teaching_subject LIKE :teaching_subject or degree_subject LIKE :teaching_subject\", {teaching_subject: \"%#{params[:search]}%\"}).where(@filters)\n else\n @tutor_profiles = TutorProfile.where(@filters).paginate(:page => params[:page], :per_page => 10)\n end\n end",
"def index\n @conditions = OpenStruct.new(params[:conditions] || {})\n \n relation = Book.all\n \n unless @conditions.bname.blank?\n relation = relation.where(\"本の名前 like ? escape '!'\", '%' + \"#{@conditions.bname}\" + '%')\n end\n \n unless @conditions.bauthor.blank?\n relation = relation.where(\"著者 like ? escape '!'\", '%' + \"#{@conditions.bauthor}\" + '%')\n end\n \n unless @conditions.bcom.blank?\n relation = relation.where(\"出版社 like ? escape '!'\", '%' + \"#{@conditions.bcom}\" + '%')\n end\n\n\n @books = relation.order(params[:sort])\n end",
"def search_params_user\n params.require(:search).permit(:handle, :first_name, :last_name, :email)\n end",
"def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].present?\n params[:q].each do |k, v| \n if v == 'name asc'\n @items = @search.result.sort { |p1, p2| p1.name.downcase <=> p2.name.downcase }\n elsif v == 'name desc'\n @items = @search.result.sort { |p2, p1| p1.name.downcase <=> p2.name.downcase }\n end\n end\n end\n end",
"def search_params\n [params[:label], params[:search]].join(\" \").strip\n end",
"def searchauthor\n end",
"def search\n Api.search_all_apis params[:postcode]\n end",
"def index\n if !params[:bank_j_search].blank? && !params[:bank_cd_search].blank?\n @bankms = Bankm.where([\"bank_j LIKE ? AND bank_cd LIKE ?\",\n \"%#{params[:bank_j_search]}%\",\n \"%#{params[:bank_cd_search]}%\"]).sort_by{|bankm| (bankm.bank_cd)}\n elsif !params[:bank_j_search].blank?\n @bankms = Bankm.search(params[:bank_j_search]).sort_by{|bankm| (bankm.bank_cd)}\n elsif !params[:bank_cd_search].blank?\n @bankms = Bankm.search(params[:bank_cd_search]).sort_by{|bankm| (bankm.bank_cd)}\n elsif !params[:bank_j_select].blank?\n @bankms = Bankm.where(\"bank_j LIKE ?\", \"#{params[:bank_j_select]}\").sort_by{|bankm| (bankm.bank_cd)}\n elsif !params[:bank_all].blank?\n @bankms = Bankm.order(\"bank_cd\")\n else\n redirect_to root_path\n end\n end",
"def index\n if params[:search]\n @items = Item.all.order(id: :desc).page(params[:page]).per(20).where(\"(name_item LIKE ?) OR (maker LIKE ?)\", \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n else\n @items = Item.all.order(id: :desc).page(params[:page]).per(20)\n end\n end",
"def contractor_search\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get the client\n @client = @contract.client\n\n # double check the query\n query = params[:q]\n if query.blank? || query[0].blank?\n\n flash[:notice] = \"You must specify a last name or email address\"\n @contractors = []\n \n else\n\n @contractors = User.paginate :per_page => 26, :page => params[:page], :conditions => [\"(lastName like ? or email = ?) and type = 'ContractorUser'\", '%'+query.to_s+'%', '%'+query.to_s+'%'], :order => 'lastName'\n \n end\n \n end",
"def search_params\n params.fetch(:genius, {})\n end",
"def search \n @cars = Car.all \n if params[:search].blank? \n redirect_to(cars_path, alert: \"Empty field!\") \n else \n @parameter = params[:search].downcase \n @results = Car.all.where(\"lower(make) LIKE :search\", search: @make) \n end \n end",
"def index\n @oncokbs = Oncokb.all\n @search = params[\"search\"]\n if @search.present?\n @name = @search[\"name\"]\n @oncokbs = Oncokb.where(gene_name: @name)\n end\n end",
"def custom_search\n\n # if we’ve no searchable fields, then just fail out\n return [] if @searchable_fields.empty?\n\n # otherwise, construct our query\n fields = []\n values = []\n @searchable_fields.each do |f|\n\n fields << \"#{f} LIKE ?\"\n values << \"%#{params[:search]}%\"\n\n end\n\n # run the query\n @model_class.where( fields.join( ' OR '), *values )\n\n\n end",
"def parse_search; end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = TypeClient.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @type_clients = @results \n end",
"def model_search_params(model, params)\n cols = model.column_names\n params.reject { |k, _v| !cols.include?(k) }\n end",
"def index\n @companies = Company.search(params[:search])\n @companies = @companies.where(suscription: params[:suscription]) if params[:suscription] && %w[0 1].include?(params[:suscription])\n @companies\nend",
"def search_params\n params.require(:search).permit(:genre, :business_id, :band_name)\n end",
"def index_name # :nologin: :norobots:\n query = find_or_create_query(:Name, :by => params[:by])\n show_selected_names(query, :id => params[:id].to_s, :always_index => true)\n end",
"def index\n unless params['body']['search'].blank?\n @countries = Country.where([\"name ILIKE ?\",\"%#{params['body']['search']}%\"])\n else\n @countries =Country.order('created_at ASC')\n end\n end",
"def search\n \tif params[:search].blank? \n \tredirect_to(root_path, notice: \"Empty Search field! Please try again\") and return \n \telse\n \t\t@parameter = params[:search].downcase \n \t@results = Course.all.where(\"course_name LIKE :search\", search: \"%#{@parameter}%\" ) \n \t@answers = Trainer.all.where(\"first_name LIKE :search\", search: \"%#{@parameter}%\" )\n \tend \n end",
"def search\n query = params[:name] \n @paginated_users = User.search(query) \n end",
"def search_params\n params.require(:search).permit(:query)\n end",
"def index\n #cars = Car.new\n @cars = Car.search(params[:search])\n\n ## if params[:search].blank?\n ## @cars = Car.all\n ## else\n ## @parameter = params[:search].downcase\n # @results = Car.joins(:user).where('lower (users.name) LIKE ?', \"%#{@parameter}%\").order(\"users.name DESC\")\n # @results = Car.joins(:user).where('users.name LIKE ?', \"%#{params[:q]}%\").order(\"users.name DESC\")\n # @results = Car.joins(:user).where(params[:q]).order(\"users.name DESC\")\n ## @cars = Car.where('lower(name) LIKE ?', \"%#{@parameter}%\")\n ## end\n end",
"def search\n\t authorize! :search, Book\n\n\t query = params[:search] || \"\"\n page = params[:page] ? params[:page].to_i : 1\n \n @conditions = Condition.all\n\t @result = Book.search(query, page)\n @result = Book.calculate_hidden(@result, session[:user_id])\n\n\tend"
] |
[
"0.71156377",
"0.7031753",
"0.69069177",
"0.6891742",
"0.67376006",
"0.67093253",
"0.66832936",
"0.6678318",
"0.66602284",
"0.6644997",
"0.6616747",
"0.6605426",
"0.65893465",
"0.6588739",
"0.65704",
"0.6560714",
"0.65601283",
"0.65523684",
"0.6551555",
"0.6551555",
"0.6551555",
"0.6551555",
"0.6551555",
"0.6551555",
"0.6551555",
"0.6551555",
"0.6551555",
"0.6551555",
"0.65446055",
"0.65352166",
"0.653245",
"0.65142035",
"0.6507982",
"0.65001523",
"0.64911073",
"0.64569277",
"0.64524144",
"0.6448143",
"0.6393541",
"0.638713",
"0.6348861",
"0.63471276",
"0.63452035",
"0.63437694",
"0.63402647",
"0.63385296",
"0.63116395",
"0.6298303",
"0.62947774",
"0.62947774",
"0.62947774",
"0.629125",
"0.62864625",
"0.62841904",
"0.6269925",
"0.62635684",
"0.6259255",
"0.6227489",
"0.62253714",
"0.6223285",
"0.62161213",
"0.61849636",
"0.6177479",
"0.6177332",
"0.61772865",
"0.61768204",
"0.61469066",
"0.6141011",
"0.6131998",
"0.61172855",
"0.61161005",
"0.6115166",
"0.6114462",
"0.61071104",
"0.6105755",
"0.61008406",
"0.6089392",
"0.60876596",
"0.60836977",
"0.6066217",
"0.6063057",
"0.6062225",
"0.60559523",
"0.60448253",
"0.60402274",
"0.603828",
"0.6037166",
"0.60366577",
"0.60365635",
"0.6036546",
"0.6034382",
"0.6033292",
"0.6032242",
"0.6032095",
"0.6030595",
"0.60253334",
"0.60217226",
"0.60144734",
"0.60104465",
"0.60077566"
] |
0.7040071
|
1
|
GET /connpasses GET /connpasses.json
|
def index
@connpasses = Connpass.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def passes\n command = RequestPasses.call(@current_user, serialNumbers)\n if command.success?\n @passes = command.result\n render 'passes.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"def index\n @passes = Pass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @passes }\n end\n end",
"def index\n \n if params[:fly_id]\n @passes = Fly.find(params[:fly_id]).passes\n elsif params[:client_id]\n @passes = Client.find(params[:client_id]).passes\n else\n @passes = Pass.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @passes }\n end\n end",
"def index\n @passes = Pass.all\n end",
"def show\n @pass = Pass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pass }\n end\n end",
"def pass \n serialNumber = serialNumberParam\n unless @current_user.is_a? User \n render json: {}, status: :unauthorized\n return\n end\n \n begin \n @pass = Pass.find{|p| p.serial_number == serialNumber}\n authorize @pass\n rescue Pundit::NotAuthorizedError\n render json: {}, status: :not_found\n rescue ActiveRecord::RecordNotFound\n render json: {}, status: :not_found\n else\n render 'pass.json.jbuilder', status: :ok\n end\n \n end",
"def index\n @passes = Passbook::Pass.joins(:registrations).where('passes.pass_type_identifier = ?', params[:pass_type_identifier]).where('registrations.device_library_identifier = ?', params[:device_library_identifier])\n head :not_found and return if @passes.empty?\n\n @passes = @passes.where('passes.updated_at > ?', params[:passesUpdatedSince]) if params[:passesUpdatedSince]\n\n if @passes.any?\n respond_with({\n lastUpdated: @passes.collect(&:updated_at).max,\n serialNumbers: @passes.collect(&:serial_number).collect(&:to_s)\n })\n else\n head :no_content\n end\n end",
"def index\n @passports = Passport.all\n end",
"def status_getpass!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETPASS\n end",
"def abilities\n get('/ability/')\n end",
"def verifyPass\n pass=(encryptor(params[:password]))\n #puts(pass)\n options = {\n :body =>{\"password\": pass\n }.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4051/users/verify_pass?id=\"+ @current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def create\n @connpass = Connpass.new(connpass_params)\n\n respond_to do |format|\n if @connpass.save\n format.html { redirect_to @connpass, notice: 'Connpass was successfully created.' }\n format.json { render :show, status: :created, location: @connpass }\n else\n format.html { render :new }\n format.json { render json: @connpass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pass }\n end\n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pass }\n end\n end",
"def connections\n\t\t# Find degree\n\t\tif params.has_key? 'degree'\n\t\t\tdegree = params['degree']\n\t\telse\n\t\t\tdegree = 1\n\t\tend\n\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\n\t\t# Get connections from graph\n\t\tconnections = { 1 => [{\"user\" => {id: 3}}] }\n\n\t\t# Get demos from couch\n\t\tdemographics = { 1 => 'asdljasd' }\n\n\t\t# Build JSON\n\t\trender json: connections_json(user_id, connections, demographics)\n\tend",
"def connpass_params\n params[:connpass]\n end",
"def url_verification\n render json: { challenge: params[:challenge] }\n end",
"def attempts\n @course_ids = current_user_or_anonymous_user.challenge_responses.select(:course_id).group(:course_id).map(&:course_id).compact\n\n render json: @course_ids\n end",
"def index\n @conns = current_user.conns\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conns }\n end\n end",
"def show\n @conn = current_user.conns.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conn }\n end\n end",
"def get url\n puts \"COMMUNICATING WITH TOGGL SERVER COMMUNICATING WITH TOGGL SERVER\"\n uri = URI.parse( url )\n http = Net::HTTP.new( uri.host, uri.port )\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth( @api_key, \"api_token\" )\n request[\"Content-Type\"] = \"application/json\"\n response = http.request( request )\n \n if response.code.to_i==200 # OK\n hash = JSON.parse( response.body )\n elsif response.code.to_i==403 # Authentication\n raise Exceptions::AuthenticationError\n else\n puts \"Error, code #{ response.code }.\"\n puts response.body\n end\n end",
"def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end",
"def show\n # sql = \"SELECT `course`.* FROM `course` JOIN LEFT account_course ON id_user= WHERE `course`.`id_course` = \"+params[:id]+\" LIMIT 1\"\n # records_array = ActiveRecord::Base.connection.execute(sql)\n @course = Course.find(params[:id])\n @bought= CourseAccount.where(id_user:11,id_course:params[:id]).count()\n @chap = @course.lesson\n render :json =>[@course,@chap,@bought]\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end",
"def password_strength(password)\n json_parse_reply(key_style, *request(target, :post, '/password/score',\n Util.encode_form(password: password), \"content-type\" => Http::FORM_UTF8,\n \"accept\" => Http::JSON_UTF8))\n end",
"def index\n @boardingpasses = Boardingpass.all\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def status\n @plan = Plan.find(params[:id])\n authorize @plan\n respond_to do |format|\n format.json { render json: @plan.status }\n end\n end",
"def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def get_coins\n get(\"/getcoins\")\n end",
"def set_connpass\n @connpass = Connpass.find(params[:id])\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def credits\n authenticated_post(\"credits\").body\n end",
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def status\n \t\t@plan = Plan.find(params[:id])\n authorize @plan\n \t\tif user_signed_in? && @plan.readable_by(current_user.id) then\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json { render json: @plan.status }\n\t\t\tend\n\t\telse\n\t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @connpass.update(connpass_params)\n format.html { redirect_to @connpass, notice: 'Connpass was successfully updated.' }\n format.json { render :show, status: :ok, location: @connpass }\n else\n format.html { render :edit }\n format.json { render json: @connpass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n authenticate_user!\n @server = Server.find(params[:id])\n @checks = @server.checks.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end",
"def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end",
"def index\n @passives = Passive.all\n end",
"def credits(count = 10)\n params = { command: 'account_credits', count: count }\n get('/json.php', params)\n end",
"def getdifficulty\n request :getdifficulty\n end",
"def show\n\n @pass = Passbook::Pass.where(pass_type_identifier: params[:pass_type_identifier], serial_number: params[:serial_number]).first\n head :not_found and return if @pass.nil?\n head :unauthorized and return if request.env['HTTP_AUTHORIZATION'] != \"ApplePass #{@pass.authentication_token}\"\n\n # suck in example data for now, can be provided by the DB entry later if we want\n passJSONPath = \"#{Rails.root}/passbook/pass.json\"\n passJSONPath = \"#{Rails.root}/passbook/pass2.json\" if @pass.which == '2'\n passJSONPath = \"#{Rails.root}/passbook/pass3.json\" if @pass.which == '3'\n\n # read in the JSON from the file\n passJSON = File.read(passJSONPath)\n\n passFile = PB::PKPass.new passJSON\n\n passFile.addFiles [\n \"#{Rails.root}/passbook/icon.png\",\n \"#{Rails.root}/passbook/icon@2x.png\",\n \"#{Rails.root}/passbook/logo.png\",\n \"#{Rails.root}/passbook/logo@2x.png\"\n ]\n\n pkpass = passFile.file\n\n if stale?(last_modified: @pass.updated_at.utc)\n send_file pkpass.path, type: 'application/vnd.apple.pkpass', disposition: 'attachment', filename: \"pass.pkpass\"\n else\n head :not_modified\n end\n\n end",
"def coins\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:coins] = user.coins\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend",
"def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend",
"def getdifficulty\n @api.request 'getdifficulty'\n end",
"def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"def show\n authorize @accounts\n render json: @account\n end",
"def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end",
"def index\n @comments = [] # set to what everyone can see, then override with what only password people can see\n @comments = Bet.find(params[:bet_id]).comments if params[:bet_id]\n @comments = Comment.all if params[:pw] && params[:pw] == Server::Application.config.pw\n @comments.sort! {|x,y| x.id <=> y.id }\n render 'index.json.jbuilder'\n end",
"def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend",
"def password\n respond_to do |format|\n format.html\n format.json { render json: { :password => get_password } }\n end\n end",
"def index\n @type_passports = TypePassport.all\n end",
"def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end",
"def champs\n conn = Faraday.new(url, request: {open_timeout: 5, timeout: 5}) do |c|\n c.response :json, :content_type => /\\bjson$/\n c.use Faraday::Response::Logger # log request & response to STDOUT\n c.adapter Faraday.default_adapter\n end\n response = conn.get url\n #@hash = response.body['data']\n response.body['data']\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def ping\n render json: {logged_in: true, user: current_user.id}\n end",
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def get_user_campaigns username, password\n do_request 'get_user_campaigns', username: username, password: password\n end",
"def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end",
"def challenge\n skip_authorization\n render(json: { message: \"Ruby on Rails Challenge 20200810\" }, status: 200)\n end",
"def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end",
"def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end",
"def difficulty\n request('getdifficulty')\n end",
"def authenticate_connection!\n request(\n :method => :post,\n :path => 'certificates',\n :json => {\n :type => :client,\n :name => name,\n :password => password\n }\n )\n end",
"def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end",
"def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end",
"def create\n @pass = Pass.new(params[:pass])\n\n respond_to do |format|\n if @pass.save\n format.html { redirect_to @pass, :notice => 'Pass was successfully created.' }\n format.json { render :json => @pass, :status => :created, :location => @pass }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def destroy\n @connpass.destroy\n respond_to do |format|\n format.html { redirect_to connpasses_url, notice: 'Connpass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_authorized_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip && @trip.accepted_users.include?(current_user.id.to_s)\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@trip._id = @trip._id.to_s\n\t\t\t@driver = User.find_by(_id: @trip.driver)\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip,\n\t\t\t\tdriver: {\n\t\t\t\t\tfirst_name: @driver.first_name,\n\t\t\t\t\tlast_name: @driver.last_name,\n\t\t\t\t\trating: @driver.driver_rating,\n\t\t\t\t\tfacebook_link: @driver.facebook_link,\n\t\t\t\t\tphone_number: @driver.phone_number,\n\t\t\t\t\temail: @driver.email\n\t\t\t\t},\n\t\t\t\tuser_requests: @user_requests,\n\t\t\t\taccepted_users: @accepted_users\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'That trip could not be found or the user is not authorized to make this call!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def get(opts = {})\n with_monitoring do\n connection.get(opts[:path]) do |req|\n req.headers = headers.merge('Authorization' => \"Bearer #{opts[:access_token]}\")\n end\n end\n end",
"def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def pending_connections\n\t\tredirect_to '/my_connections'\n\tend",
"def chat_get_connected(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ChatApi#chat_get_connected ...\"\n end\n \n # resource path\n path = \"/chat/connected\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectedUsers')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ChatApi#chat_get_connected. Result: #{result.inspect}\"\n end\n return result\n end",
"def mget\n begin \n params.reject! {|key, value| ['controller', 'action', 'format'].include?(key)}\n @connections = []\n params.each do |key, value|\n @connections << {key: value, value: to_obj($redis.get(value)), ttl: $redis.ttl(value)}\n end \n rescue => e\n @connections = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connections }\n end\n end",
"def get(req)\n synchronize {\n param = @challenge\n return nil unless param\n user, passwd = @auth\n return nil unless user\n calc_cred(req, user, passwd, param)\n }\n end",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def index\n @users = User.all\n render json: { users: @users }, methods: :visit_ids\n end",
"def index\n @password_tiers = PasswordTier.all.includes(:contest)\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def index\n @clan_matches = ClanMatch.all\n\n render json: @clan_matches\n end",
"def index\n @users = User.all\n authorize @users\n\n render json: @users\n end",
"def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end",
"def pass\n conf['dashboard']['pass']\n end",
"def index\n render json: Client.where(active:true)\n end",
"def get_attribs_all( )\n url = \"#{self.url}/cid?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['results'] if ok?( status ) && response['results']\n return status, ''\n end",
"def index\n @challenges = Challenge.all params[:filters], params[:page]\n end",
"def show\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @click_thru }\n end\n end",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def for_user(user_id)\n request(:get, \"/users/#{user_id}/connections\")\n end",
"def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end",
"def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend",
"def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end",
"def getCounchDBData \r\n url = URI.parse(\"http://citivan.iriscouch.com/_utils\") \r\n server = Couch::Server.new(url.host, url.port) \r\n res = server.get(\"/sms/currentUsers\") \r\n json = res.body \r\n json = JSON.parse(json) \r\nend",
"def getconnectioncount\n request :getconnectioncount\n end"
] |
[
"0.66384435",
"0.63989335",
"0.633204",
"0.6001866",
"0.56572056",
"0.5623348",
"0.562248",
"0.55092794",
"0.5311898",
"0.5266798",
"0.5261784",
"0.5215726",
"0.5214483",
"0.5211567",
"0.5207906",
"0.5153614",
"0.51375157",
"0.5136857",
"0.5130621",
"0.51173353",
"0.5087707",
"0.50836676",
"0.5083176",
"0.50586456",
"0.5056055",
"0.50271535",
"0.5008702",
"0.4983816",
"0.49747872",
"0.4973338",
"0.4973304",
"0.4969554",
"0.49302006",
"0.49240503",
"0.49199525",
"0.49135587",
"0.4911859",
"0.49115947",
"0.4909408",
"0.48871303",
"0.48823354",
"0.48673442",
"0.4852698",
"0.48481882",
"0.48353994",
"0.4818525",
"0.48050055",
"0.4788797",
"0.4778218",
"0.4774303",
"0.4771508",
"0.47612867",
"0.47607797",
"0.47607473",
"0.47584873",
"0.47546783",
"0.47510532",
"0.4736317",
"0.47280502",
"0.4720617",
"0.47197238",
"0.4718594",
"0.4710346",
"0.4705347",
"0.47030178",
"0.47004628",
"0.46996078",
"0.4699052",
"0.4692712",
"0.46801102",
"0.46765283",
"0.46663034",
"0.4664957",
"0.46635962",
"0.46628162",
"0.46628162",
"0.46556038",
"0.4653249",
"0.4652343",
"0.46460268",
"0.463812",
"0.46350616",
"0.46336824",
"0.46303734",
"0.4628543",
"0.46235502",
"0.4622972",
"0.46219796",
"0.46194986",
"0.46182778",
"0.4616108",
"0.46145087",
"0.46082342",
"0.46082342",
"0.46069622",
"0.46034324",
"0.46030423",
"0.46007466",
"0.4600238",
"0.45972332"
] |
0.70516884
|
0
|
GET /connpasses/1 GET /connpasses/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @connpasses = Connpass.all\n end",
"def index\n @passes = Pass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @passes }\n end\n end",
"def index\n \n if params[:fly_id]\n @passes = Fly.find(params[:fly_id]).passes\n elsif params[:client_id]\n @passes = Client.find(params[:client_id]).passes\n else\n @passes = Pass.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @passes }\n end\n end",
"def passes\n command = RequestPasses.call(@current_user, serialNumbers)\n if command.success?\n @passes = command.result\n render 'passes.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"def index\n @passes = Pass.all\n end",
"def show\n @pass = Pass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pass }\n end\n end",
"def index\n @passes = Passbook::Pass.joins(:registrations).where('passes.pass_type_identifier = ?', params[:pass_type_identifier]).where('registrations.device_library_identifier = ?', params[:device_library_identifier])\n head :not_found and return if @passes.empty?\n\n @passes = @passes.where('passes.updated_at > ?', params[:passesUpdatedSince]) if params[:passesUpdatedSince]\n\n if @passes.any?\n respond_with({\n lastUpdated: @passes.collect(&:updated_at).max,\n serialNumbers: @passes.collect(&:serial_number).collect(&:to_s)\n })\n else\n head :no_content\n end\n end",
"def pass \n serialNumber = serialNumberParam\n unless @current_user.is_a? User \n render json: {}, status: :unauthorized\n return\n end\n \n begin \n @pass = Pass.find{|p| p.serial_number == serialNumber}\n authorize @pass\n rescue Pundit::NotAuthorizedError\n render json: {}, status: :not_found\n rescue ActiveRecord::RecordNotFound\n render json: {}, status: :not_found\n else\n render 'pass.json.jbuilder', status: :ok\n end\n \n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pass }\n end\n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pass }\n end\n end",
"def index\n @passports = Passport.all\n end",
"def show\n @conn = current_user.conns.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conn }\n end\n end",
"def create\n @connpass = Connpass.new(connpass_params)\n\n respond_to do |format|\n if @connpass.save\n format.html { redirect_to @connpass, notice: 'Connpass was successfully created.' }\n format.json { render :show, status: :created, location: @connpass }\n else\n format.html { render :new }\n format.json { render json: @connpass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @conns = current_user.conns\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conns }\n end\n end",
"def url_verification\n render json: { challenge: params[:challenge] }\n end",
"def show\n # sql = \"SELECT `course`.* FROM `course` JOIN LEFT account_course ON id_user= WHERE `course`.`id_course` = \"+params[:id]+\" LIMIT 1\"\n # records_array = ActiveRecord::Base.connection.execute(sql)\n @course = Course.find(params[:id])\n @bought= CourseAccount.where(id_user:11,id_course:params[:id]).count()\n @chap = @course.lesson\n render :json =>[@course,@chap,@bought]\n end",
"def status\n @plan = Plan.find(params[:id])\n authorize @plan\n respond_to do |format|\n format.json { render json: @plan.status }\n end\n end",
"def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end",
"def verifyPass\n pass=(encryptor(params[:password]))\n #puts(pass)\n options = {\n :body =>{\"password\": pass\n }.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4051/users/verify_pass?id=\"+ @current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def show\n authenticate_user!\n @server = Server.find(params[:id])\n @checks = @server.checks.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end",
"def show\n\n @pass = Passbook::Pass.where(pass_type_identifier: params[:pass_type_identifier], serial_number: params[:serial_number]).first\n head :not_found and return if @pass.nil?\n head :unauthorized and return if request.env['HTTP_AUTHORIZATION'] != \"ApplePass #{@pass.authentication_token}\"\n\n # suck in example data for now, can be provided by the DB entry later if we want\n passJSONPath = \"#{Rails.root}/passbook/pass.json\"\n passJSONPath = \"#{Rails.root}/passbook/pass2.json\" if @pass.which == '2'\n passJSONPath = \"#{Rails.root}/passbook/pass3.json\" if @pass.which == '3'\n\n # read in the JSON from the file\n passJSON = File.read(passJSONPath)\n\n passFile = PB::PKPass.new passJSON\n\n passFile.addFiles [\n \"#{Rails.root}/passbook/icon.png\",\n \"#{Rails.root}/passbook/icon@2x.png\",\n \"#{Rails.root}/passbook/logo.png\",\n \"#{Rails.root}/passbook/logo@2x.png\"\n ]\n\n pkpass = passFile.file\n\n if stale?(last_modified: @pass.updated_at.utc)\n send_file pkpass.path, type: 'application/vnd.apple.pkpass', disposition: 'attachment', filename: \"pass.pkpass\"\n else\n head :not_modified\n end\n\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @click_thru }\n end\n end",
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def attempts\n @course_ids = current_user_or_anonymous_user.challenge_responses.select(:course_id).group(:course_id).map(&:course_id).compact\n\n render json: @course_ids\n end",
"def status_getpass!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETPASS\n end",
"def set_connpass\n @connpass = Connpass.find(params[:id])\n end",
"def abilities\n get('/ability/')\n end",
"def connections\n\t\t# Find degree\n\t\tif params.has_key? 'degree'\n\t\t\tdegree = params['degree']\n\t\telse\n\t\t\tdegree = 1\n\t\tend\n\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\n\t\t# Get connections from graph\n\t\tconnections = { 1 => [{\"user\" => {id: 3}}] }\n\n\t\t# Get demos from couch\n\t\tdemographics = { 1 => 'asdljasd' }\n\n\t\t# Build JSON\n\t\trender json: connections_json(user_id, connections, demographics)\n\tend",
"def create\n @pass = Pass.new(params[:pass])\n\n respond_to do |format|\n if @pass.save\n format.html { redirect_to @pass, :notice => 'Pass was successfully created.' }\n format.json { render :json => @pass, :status => :created, :location => @pass }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end",
"def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end",
"def index\n @boardingpasses = Boardingpass.all\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def update\n respond_to do |format|\n if @connpass.update(connpass_params)\n format.html { redirect_to @connpass, notice: 'Connpass was successfully updated.' }\n format.json { render :show, status: :ok, location: @connpass }\n else\n format.html { render :edit }\n format.json { render json: @connpass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @visit = Visit.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @visit }\n end\n end",
"def index\n @passives = Passive.all\n end",
"def get url\n puts \"COMMUNICATING WITH TOGGL SERVER COMMUNICATING WITH TOGGL SERVER\"\n uri = URI.parse( url )\n http = Net::HTTP.new( uri.host, uri.port )\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth( @api_key, \"api_token\" )\n request[\"Content-Type\"] = \"application/json\"\n response = http.request( request )\n \n if response.code.to_i==200 # OK\n hash = JSON.parse( response.body )\n elsif response.code.to_i==403 # Authentication\n raise Exceptions::AuthenticationError\n else\n puts \"Error, code #{ response.code }.\"\n puts response.body\n end\n end",
"def status\n \t\t@plan = Plan.find(params[:id])\n authorize @plan\n \t\tif user_signed_in? && @plan.readable_by(current_user.id) then\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json { render json: @plan.status }\n\t\t\tend\n\t\telse\n\t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\t\tend\n\tend",
"def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end",
"def getdifficulty\n request :getdifficulty\n end",
"def create\n @pass = Pass.new(params[:pass])\n\n respond_to do |format|\n if @pass.save\n format.html { redirect_to @pass, notice: 'Pass was successfully created.' }\n format.json { render json: @pass, status: :created, location: @pass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def challenge\n skip_authorization\n render(json: { message: \"Ruby on Rails Challenge 20200810\" }, status: 200)\n end",
"def index\n @clan_matches = ClanMatch.all\n\n render json: @clan_matches\n end",
"def show\n @capacite = Capacite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacite }\n end\n end",
"def ping\n render json: {logged_in: true, user: current_user.id}\n end",
"def show\n @vehicle_passcard = VehiclePasscard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_passcard }\n end\n end",
"def index\n @coin_attributes = @coin.coin_attributes\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @coin_attributes }\n end\n end",
"def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end",
"def create\n @pass = Pass.new(pass_params)\n\n respond_to do |format|\n if @pass.save\n format.html { redirect_to @pass, notice: 'Pass was successfully created.' }\n format.json { render :show, status: :created, location: @pass }\n else\n format.html { render :new }\n format.json { render json: @pass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def password\n respond_to do |format|\n format.html\n format.json { render json: { :password => get_password } }\n end\n end",
"def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end",
"def coins\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:coins] = user.coins\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def index\n @type_passports = TypePassport.all\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def connpass_params\n params[:connpass]\n end",
"def index\n @users = User.all\n render json: { users: @users }, methods: :visit_ids\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end",
"def index\n render json: Client.where(active:true)\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end",
"def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend",
"def getdifficulty\n @api.request 'getdifficulty'\n end",
"def mget\n begin \n params.reject! {|key, value| ['controller', 'action', 'format'].include?(key)}\n @connections = []\n params.each do |key, value|\n @connections << {key: value, value: to_obj($redis.get(value)), ttl: $redis.ttl(value)}\n end \n rescue => e\n @connections = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connections }\n end\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def destroy\n @connpass.destroy\n respond_to do |format|\n format.html { redirect_to connpasses_url, notice: 'Connpass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sslplan }\n end\n end",
"def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def index\n # @checkpoints = Checkpoint.all\n @route = Route.find(params[:route_id])\n @checkpoints = @route.checkpoints\n # render json: {\n # checkpoints: @checkpoints.to_a\n # }\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def index\n @comments = [] # set to what everyone can see, then override with what only password people can see\n @comments = Bet.find(params[:bet_id]).comments if params[:bet_id]\n @comments = Comment.all if params[:pw] && params[:pw] == Server::Application.config.pw\n @comments.sort! {|x,y| x.id <=> y.id }\n render 'index.json.jbuilder'\n end",
"def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"def difficulty\n request('getdifficulty')\n end",
"def credits(count = 10)\n params = { command: 'account_credits', count: count }\n get('/json.php', params)\n end",
"def password_strength(password)\n json_parse_reply(key_style, *request(target, :post, '/password/score',\n Util.encode_form(password: password), \"content-type\" => Http::FORM_UTF8,\n \"accept\" => Http::JSON_UTF8))\n end",
"def show\n authorize @accounts\n render json: @account\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end",
"def show\n connection = connection_from_params\n if connection.nil?\n head 404\n else\n render jsonapi: connection_from_params, serializer: Connection::Serializer\n end\n end",
"def show\n @credito = Credito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credito }\n end\n end",
"def get_coins\n get(\"/getcoins\")\n end",
"def count\n @battles_count = Battle.all\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n render json: @visit\n end",
"def show\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection }\n end\n end",
"def show\n @route_connection = RouteConnection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route_connection }\n end\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def index_pass\n @assets = Asset.find(:all, :conditions => {:State => \"Pass\"})\n render :action => :index, :back => '/app'\n end",
"def show\n @visitante_credenciado = VisitanteCredenciado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @visitante_credenciado }\n end\n end",
"def info id\n get(\"ssl/v1/#{id}\")\n end",
"def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traffic }\n end\n end",
"def for_user(user_id)\n request(:get, \"/users/#{user_id}/connections\")\n end",
"def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end",
"def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientship }\n end\n end"
] |
[
"0.7016647",
"0.6601232",
"0.6458856",
"0.6336865",
"0.60618556",
"0.60514593",
"0.5785612",
"0.56928915",
"0.566608",
"0.5660947",
"0.55345917",
"0.546456",
"0.5395068",
"0.53315717",
"0.5319105",
"0.52863014",
"0.5228195",
"0.5223131",
"0.52011436",
"0.5183974",
"0.5164278",
"0.5155676",
"0.5138571",
"0.51118493",
"0.51026213",
"0.509214",
"0.5079252",
"0.5037677",
"0.50359875",
"0.50322336",
"0.5023406",
"0.5014766",
"0.5009744",
"0.49918023",
"0.49800715",
"0.49779886",
"0.49733293",
"0.4966087",
"0.49494565",
"0.49455532",
"0.49388063",
"0.4930095",
"0.4928622",
"0.49211898",
"0.49153027",
"0.4909436",
"0.49010354",
"0.48980275",
"0.48921075",
"0.48878396",
"0.48849195",
"0.4877765",
"0.4873179",
"0.48701873",
"0.48618352",
"0.48611298",
"0.48601657",
"0.48594448",
"0.48546568",
"0.48431882",
"0.4842887",
"0.48416343",
"0.4839229",
"0.48353538",
"0.4833594",
"0.48330528",
"0.48298326",
"0.48258162",
"0.48218548",
"0.4815498",
"0.48154095",
"0.48102808",
"0.4806121",
"0.48007634",
"0.47933206",
"0.47924975",
"0.47918808",
"0.47890556",
"0.47881162",
"0.47851065",
"0.4782414",
"0.47804162",
"0.47720626",
"0.4771095",
"0.4770278",
"0.47673318",
"0.47670937",
"0.47619483",
"0.47601423",
"0.47549546",
"0.47545823",
"0.47520843",
"0.4751669",
"0.47514665",
"0.47497848",
"0.47461984",
"0.47419548",
"0.4738539",
"0.47310218",
"0.47242284",
"0.4717085"
] |
0.0
|
-1
|
POST /connpasses POST /connpasses.json
|
def create
@connpass = Connpass.new(connpass_params)
respond_to do |format|
if @connpass.save
format.html { redirect_to @connpass, notice: 'Connpass was successfully created.' }
format.json { render :show, status: :created, location: @connpass }
else
format.html { render :new }
format.json { render json: @connpass.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def passes\n command = RequestPasses.call(@current_user, serialNumbers)\n if command.success?\n @passes = command.result\n render 'passes.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"def index\n @connpasses = Connpass.all\n end",
"def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend",
"def create\n @pass = Pass.new(params[:pass])\n\n respond_to do |format|\n if @pass.save\n format.html { redirect_to @pass, :notice => 'Pass was successfully created.' }\n format.json { render :json => @pass, :status => :created, :location => @pass }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pass = Pass.new(params[:pass])\n\n respond_to do |format|\n if @pass.save\n format.html { redirect_to @pass, notice: 'Pass was successfully created.' }\n format.json { render json: @pass, status: :created, location: @pass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pass = Pass.new(pass_params)\n\n respond_to do |format|\n if @pass.save\n format.html { redirect_to @pass, notice: 'Pass was successfully created.' }\n format.json { render :show, status: :created, location: @pass }\n else\n format.html { render :new }\n format.json { render json: @pass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @passes = Pass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @passes }\n end\n end",
"def connections_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_post ...\"\n end\n \n # resource path\n path = \"/connections\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_6')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_post. Result: #{result.inspect}\"\n end\n return result\n end",
"def index\n \n if params[:fly_id]\n @passes = Fly.find(params[:fly_id]).passes\n elsif params[:client_id]\n @passes = Client.find(params[:client_id]).passes\n else\n @passes = Pass.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @passes }\n end\n end",
"def pass \n serialNumber = serialNumberParam\n unless @current_user.is_a? User \n render json: {}, status: :unauthorized\n return\n end\n \n begin \n @pass = Pass.find{|p| p.serial_number == serialNumber}\n authorize @pass\n rescue Pundit::NotAuthorizedError\n render json: {}, status: :not_found\n rescue ActiveRecord::RecordNotFound\n render json: {}, status: :not_found\n else\n render 'pass.json.jbuilder', status: :ok\n end\n \n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def index\n @passes = Pass.all\n end",
"def verifyPass\n pass=(encryptor(params[:password]))\n #puts(pass)\n options = {\n :body =>{\"password\": pass\n }.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4051/users/verify_pass?id=\"+ @current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pass }\n end\n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pass }\n end\n end",
"def password_strength(password)\n json_parse_reply(key_style, *request(target, :post, '/password/score',\n Util.encode_form(password: password), \"content-type\" => Http::FORM_UTF8,\n \"accept\" => Http::JSON_UTF8))\n end",
"def push(options={})\n options = { body: options } unless options.empty?\n client.post(\"#{collection_name}/#{collection_uuid}/passes/#{id}/push\", options).ok?\n end",
"def authenticate_connection!\n request(\n :method => :post,\n :path => 'certificates',\n :json => {\n :type => :client,\n :name => name,\n :password => password\n }\n )\n end",
"def pass_params\n params.require(:pass).permit(:name, :location, :login, :password, :additional)\n end",
"def connpass_params\n params[:connpass]\n end",
"def pass\n @agent.pass\n end",
"def add_pass pass\n @passes << pass\n end",
"def visit_params\n params.require(:visit).permit(*allowable)\n end",
"def post_request(secureNetId, secureKey, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n body = {} # Request body hash\n yield body # Build body of request\n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend",
"def create\n @conn = current_user.conns.build(params[:conn])\n\n respond_to do |format|\n if @conn.save\n format.html { redirect_to @conn, notice: 'Conn was successfully created.' }\n format.json { render json: @conn, status: :created, location: @conn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boardingpass = Boardingpass.new(boardingpass_params)\n\n respond_to do |format|\n if @boardingpass.save\n format.html { redirect_to @boardingpass, notice: 'Boardingpass was successfully created.' }\n format.json { render :show, status: :created, location: @boardingpass }\n else\n format.html { render :new }\n format.json { render json: @boardingpass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_connpass\n @connpass = Connpass.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @connpass.update(connpass_params)\n format.html { redirect_to @connpass, notice: 'Connpass was successfully updated.' }\n format.json { render :show, status: :ok, location: @connpass }\n else\n format.html { render :edit }\n format.json { render json: @connpass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_passport = TypePassport.new(type_passport_params)\n\n respond_to do |format|\n if @type_passport.save\n format.html { redirect_to @type_passport, notice: 'Type passport was successfully created.' }\n format.json { render :show, status: :created, location: @type_passport }\n else\n format.html { render :new }\n format.json { render json: @type_passport.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def pass(password)\n @socket << \"PASS #{password}\"\n end",
"def create\n @passife = Passive.new(passife_params)\n \n respond_to do |format|\n if @passife.save\n format.html { redirect_to @passife, notice: 'Passive was successfully created.' }\n format.json { render :show, status: :created, location: @passife }\n else\n format.html { render :new }\n format.json { render json: @passife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pass= pass\n @agent.pass = pass\n end",
"def post(url)\n response = RestClient::Request.new(\n method: :post,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\"\n },\n payload: {user: user, pwd: password}.to_json\n ).execute\n\n # Parse the response to Ruby objects\n JSON.parse(response)\n end",
"def lanes_count_params\n params.permit(:lane, :user_id, :session_id)\n end",
"def destroy\n @connpass.destroy\n respond_to do |format|\n format.html { redirect_to connpasses_url, notice: 'Connpass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n (kick and return) if not is_god?\n if (params[:team].has_key? :pass_hash) and (params.has_key? :do_hash)\n clear_pass = params[:team][:pass_hash]\n hash = Digest::SHA1.base64digest clear_pass\n params[:team][:pass_hash] = hash\n end\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def credits\n authenticated_post(\"credits\").body\n end",
"def post(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'post'}.merge(authentication))\n end",
"def report_connectivity(controller, port, connectivity_map)\n me = `hostname`.chomp\n req = Net::HTTP::Post.new(\"/#{me}\", initheader = {'Content-Type'=>'application/json'})\n req.body = connectivity_map.to_json\n response = Net::HTTP.start(controller, port) do |http|\n http.request(req)\n end\n response.code == '200'\nend",
"def passport_params\n params.require(:passport).permit(:code, :name, :active, :verified, :country_id, :series_number, :issued_by,\n :issued_code, :issued_date, :valid_to, :address_id, :note)\n end",
"def create\n @pass = Passbook::Pass.where(pass_type_identifier: params[:pass_type_identifier], serial_number: params[:serial_number]).first\n head :not_found and return if @pass.nil?\n head :unauthorized and return if request.env['HTTP_AUTHORIZATION'] != \"ApplePass #{@pass.authentication_token}\"\n\n @registration = @pass.registrations.where(device_library_identifier: params[:device_library_identifier]).first_or_initialize\n @registration.push_token = params[:pushToken]\n\n status = @registration.new_record? ? :created : :ok\n\n @registration.save\n\n head status\n end",
"def index\n @passports = Passport.all\n end",
"def post(server, url, jsondata, auth_required=true)\n host = server\n port = 80\n uri = URI.parse url.gsub(/ /, '%20')\n realm = @realm\n username =@config['username']\n nc = \"00000001\"\n snonce = @realm\n cnonce = Digest::MD5.hexdigest Time.now.to_i.to_s + @config['secret']\n qop = 'auth'\n\n if @config['use_proxy']\n host = @config['proxy_server']\n port = @config['proxy_port']\n end\n\n # AuthDigest Components\n # http://en.wikipedia.org/wiki/Digest_access_authentication\n ha1 = Digest::MD5.hexdigest username + ':' + realm + ':' + @config['secret']\n ha2 = Digest::MD5.hexdigest 'POST:' + uri.path\n response = Digest::MD5.hexdigest ha1 + ':' + snonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2\n\n out = \"POST #{url} HTTP/1.0\\r\\n\"\n out += \"Host: #{server}\\r\\n\"\n if @config['use_proxy'] and not @config['proxy_user'].blank? and not @config['proxy_pass'].blank?\n out += \"Proxy-Authorization:Basic \" + base64_encode(@config['proxy_user'] + ':' + @config['proxy_pass']) + \"\\r\\n\"\n end\n out += \"Content-Type: application/json\\r\\n\"\n # Pre-computed auth credentials, saves waiting for the auth challenge hence makes things round trip time 50% faster.\n if auth_required\n out += 'Authorization: Digest ' +\n 'username=\"' + username + '\", ' +\n 'realm=\"' + realm + '\", ' +\n 'nonce=\"' + snonce + '\", ' +\n 'uri=\"' + uri.path + '\", ' +\n 'qop=' + qop + ', ' +\n 'nc=' + nc + ', ' +\n 'cnonce=\"' + cnonce + '\", ' +\n 'response=\"' + response + '\", ' +\n 'opaque=\"' + realm + '\"' +\n \"\\r\\n\"\n end\n out += \"Content-length: \" + jsondata.length.to_s + \"\\r\\n\\r\\n\"\n out += jsondata + \"\\r\\n\\r\\n\"\n\n socket = nil\n begin\n socket = TCPTimeout::TCPSocket.new(host, port,\n connect_timeout: @config['timeout'], read_timeout: @config['timeout'], write_timeout: @config['timeout'])\n socket.write(out)\n reply = []\n r = ''\n until r.nil? do\n reply << r\n r = socket.read 8192\n end\n rescue SocketError => e\n return set_error 299, e.to_s\n ensure\n socket.close unless socket.nil?\n end\n hunks = reply.join.split(\"\\r\\n\\r\\n\")\n return set_error(299, \"Error : Reply is too short.\") if hunks.length < 2\n # header = hunks[hunks.length - 2]\n # headers = header.split(\"\\n\")\n body = hunks[hunks.length - 1]\n return set_error(299, \"Error : Reply body is empty.\") if body.blank?\n body\n end",
"def status_pass!()\n @status = TAC_PLUS_AUTHEN_STATUS_PASS\n end",
"def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend",
"def url_verification\n render json: { challenge: params[:challenge] }\n end",
"def post_data(params)\n {\n gateway_username: options[:login],\n gateway_password: options[:password],\n payload: encrypt(params.to_json)\n }.to_json\n end",
"def initialize(user, passes = [])\n @user = user\n @passes = passes\n end",
"def create\n @trips_connect = TripsConnect.new(params[:trips_connect])\n\n respond_to do |format|\n if @trips_connect.save\n format.html { redirect_to @trips_connect, notice: 'Trips connect was successfully created.' }\n format.json { render json: @trips_connect, status: :created, location: @trips_connect }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trips_connect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def action_sendpass!()\n @action = TAC_PLUS_AUTHEN_SENDPASS\n end",
"def pass\n end",
"def create\n # TODO 既存 team を含めて保存する場合は認証に対応させる\n @concert = Concert.new(concert_savable_params)\n\n if @concert.save\n render :show, status: :created\n else\n render json: @concert.errors, status: :unprocessable_entity\n end\n end",
"def create\n @click_thru = ClickThru.new(params[:click_thru])\n\n respond_to do |format|\n if @click_thru.save\n format.html { redirect_to @click_thru, notice: 'Click thru was successfully created.' }\n format.json { render json: @click_thru, status: :created, location: @click_thru }\n else\n format.html { render action: \"new\" }\n format.json { render json: @click_thru.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_non_admin_user_authenticate\n post '/users', 'username' => 'testuser', 'password' => 'testpassword', 'email_address' => 'test@toto.com'\n id_user = last_response.json_body['id']\n digest_authorize 'testuser', 'testpassword'\n id_user\nend",
"def visit_params\n params.require(:visit).permit(:datetime, :datetime, :patient_id, :doctor_id, :clinic_id, :confirmed)\n end",
"def users_visit_params\n params.require(:users_visit).permit(:date, :status)\n end",
"def post_request(options, path, post_data)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Post.new(path)\n\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n req.body = post_data\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end",
"def test_bad_signup\n\n post(:create,\n { :user => { :first_name => \"Abe\",\n :last_name => \"Lincoln\",\n :login => \"\",\n :email => \"\",\n :active => \"1\",\n :password => \"newpassword\", \n :password_confirmation => \"wrongpassword\" } },\n {})\n assert_redirected_to( :controller => 'tracker', :action => \"index\" )\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n\n post(:signup, \n { :user => { :login => \"yo\",\n :password => \"newpassword\", \n :password_confirmation => \"newpassword\" } },\n cathy_admin_session)\n assert_response(:success)\n\n end",
"def post!( text, password )\n post text\n push password\n end",
"def visit_params\r\n params.require(:visit).permit(:id, :user_id)\r\n end",
"def is_wrong_password? password\nuri = URI.parse 'http://rubyschool.us/router'\n#response = Net::HTTP.get uri\n#p response\nresponse = Net::HTTP.post_form(uri, :login => \"admin\", :password => password).body\np response.include? \"denied\" # Тело объекта, который мы получаем через запрос\nend",
"def create(params)\n post_url = url\n LightspeedCall.make('POST') { HTTParty.post(post_url, body: params.to_json, headers: {Authorization: \"Bearer #{LightspeedApi::OauthGrant.token}\", 'Accept' => 'application/json', 'Content-Type' => 'application/json' }) }\n end",
"def password_params\n params.require(:password).permit(:login, :pass, :url, :obs, :PasswordCategory_id)\n end",
"def visit_params\n params.require(:visit).permit(:token)\n end",
"def passes; end",
"def passes; end",
"def visit_params\n params.require(:visit).permit(:date_visit, :length_since_last_visit, :lens_use_per_day, :sleep_with_lens,\n :lens_first_use, :dilation_consent, :privacy_consent, :test_result, :patient_id,\n :current_meds, :med_allergy, :med_allergy_list,\n :exams_attributes => [:id, :_destroy, :viewable_id, :viewable_type, :attachment])\n end",
"def index\n @passes = Passbook::Pass.joins(:registrations).where('passes.pass_type_identifier = ?', params[:pass_type_identifier]).where('registrations.device_library_identifier = ?', params[:device_library_identifier])\n head :not_found and return if @passes.empty?\n\n @passes = @passes.where('passes.updated_at > ?', params[:passesUpdatedSince]) if params[:passesUpdatedSince]\n\n if @passes.any?\n respond_with({\n lastUpdated: @passes.collect(&:updated_at).max,\n serialNumbers: @passes.collect(&:serial_number).collect(&:to_s)\n })\n else\n head :no_content\n end\n end",
"def create\n @escapetunnel = Escapetunnel.new(params[:escapetunnel])\n\n respond_to do |format|\n if @escapetunnel.save\n format.html { redirect_to @escapetunnel, :notice => 'Escapetunnel was successfully created.' }\n format.json { render :json => @escapetunnel, :status => :created, :location => @escapetunnel }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @escapetunnel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def set_password(opts = {})\n password(opts.merge(:verb => :post))\n end",
"def test_password_invalid_format\n data = { 'email' => 'ace@base.se', 'password' => 'open123' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n end",
"def challenge\n skip_authorization\n render(json: { message: \"Ruby on Rails Challenge 20200810\" }, status: 200)\n end",
"def create\n @trip = Trip.new(user_id: current_user.id)\n @trip.start_point = Station.find_by(uid: params[:station_id])\n #Defined current user and updated credits. This change may cause issues.\n @current_user = current_user\n @current_user.credits = (@current_user.credits - 1)\n\n if @trip.save\n @current_user.save\n #This is where the change ends\n render json: @trip.attributes.merge(station: @trip.start_point.attributes), status: :created, location: @trip\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end",
"def create\n @sslplan = Sslplan.new(params[:sslplan])\n\n respond_to do |format|\n if @sslplan.save\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully created.' }\n format.json { render :json => @sslplan, :status => :created, :location => @sslplan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(opts = {})\n with_monitoring do\n connection.post(opts[:path]) do |req|\n prefix = opts[:access_token] ? 'Bearer' : 'Basic'\n suffix = opts[:access_token] || opts[:claims_token]\n req.headers = headers.merge('Authorization' => \"#{prefix} #{suffix}\")\n end\n end\n end",
"def way_params\n params.require(:way).permit(:vertices_list, :edges_list, :total_distance, :total_time)\n end",
"def create\n @wallet = Wallet.build_secure_wallet(wallet_params)\n\n respond_to do |format|\n if @wallet.save\n format.html { redirect_to @wallet, notice: 'Wallet was successfully created.' }\n format.json { render :show, status: :created, location: @wallet }\n else\n format.html { render :new }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def connection_status_crypt_request; end",
"def create\n ip = remote_ip\n geolocation_data = RestClient.get \"freegeoip.net/json/#{ip}\"\n @geolocation_data = JSON.parse(geolocation_data, :symbolize => true) \n if @short_url.present? \n short_visit = @short_url.short_visits.create(visitor_ip: geolocation_data[\"ip\"], visitor_city: geolocation_data[\"city\"],visitior_state: geolocation_data[\"country_name\"],visitor_country_iso: geolocation_data[\"country_code\"])\n render json: { short_visit: short_visit, status: \"Created\" } \n else\n render json: { errors: \"something went wrong\" , status: \"failed\" } \n end \n end",
"def challenge_params\n params.require(:challenge).permit(:title, :description, :expires_at, :points)\n end",
"def create\n\n \t\t\t@penalty = Penalty.new penalty_params\n\n \t\t\tif @penalty.save\n\n \t\t\t\trender json: @penalty,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend",
"def create\n @canvass = Canvass.new(canvass_params)\n\n respond_to do |format|\n if @canvass.save\n format.html { redirect_to @canvass, notice: 'Canvass was successfully created.' }\n format.json { render :show, status: :created, location: @canvass }\n else\n format.html { render :new }\n format.json { render json: @canvass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def turn_params\n params.require(:turn).permit(:date, :user_id, :cancha_id)\n end",
"def action_chpass!()\n @action = TAC_PLUS_AUTHEN_CHPASS\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def attack_params\n params.require(:attack).permit(:name, :comment, :result)\n end",
"def set_password!(opts = {})\n password!(opts.merge(:verb => :post))\n end",
"def POST; end",
"def online_judge_params\n params.require(:online_judge).permit(:site, :account_name)\n end",
"def goal_params\n params.require(:goal).permit(:user_id, :goals, :status, :notes)\n end",
"def create\n @goal = Goal.new(goal_params)\n @goal.client_id = params[:client_id]\n @goal.status = 'active'\n\n if @goal.save\n flash[:message] = \"Goal saved\"\n render json: @goal.to_json\n else\n end\n end",
"def create\n @password_tier = PasswordTier.new(password_tier_params)\n\n respond_to do |format|\n if @password_tier.save\n format.html { redirect_to @password_tier, notice: 'PasswordTier was successfully created.' }\n format.json { render :show, status: :created, location: @password_tier }\n else\n format.html { render :new }\n format.json { render json: @password_tier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = CourseAccount.new(id_user:11,id_course: params[:course],coin:5000)\n @course.save()\n session[:id_course] =params[:course]\n render :json =>[@course,session[:id_course]]\n\n end",
"def create\n @plan = Plan.create(plan_params)\n @incident = Incident.find(params[:incident_id])\n respond_to do |format|\n if @plan.save\n format.html { redirect_to incident_plan_path(@incident, @plan) }\n format.json { redirect_to incident_plan_path(@incident, @plan) }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ip = remote_ip\n geolocation_data = RestClient.get \"freegeoip.net/json/#{ip}\"\n @geolocation_data = JSON.parse(geolocation_data, :symbolize => true) \n if @short_url.present? \n short_visit = @short_url.short_visits.create(visitor_ip: geolocation_data[\"ip\"], visitor_city: geolocation_data[\"city\"],visitior_state: geolocation_data[\"country_name\"],visitor_country_iso: geolocation_data[\"country_code\"])\n render json: { short_visit: short_visit, status: \"Created\" } \n else\n render json: { errors: \"something went wrong\" , status: \"failed\" } \n end \n end",
"def create\n @pw_user = PwUser.new(params[:pw_user])\n\n respond_to do |format|\n if @pw_user.save\n format.html { redirect_to @pw_user, notice: 'Pw user was successfully created.' }\n format.json { render json: @pw_user, status: :created, location: @pw_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pw_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, params = {}, auth=nil)\n request(:post, path, :body => params, :basic_auth => @auth)\n end",
"def pass(test)\n self[:pass] << test\n end"
] |
[
"0.6327074",
"0.6069031",
"0.58198714",
"0.5750625",
"0.56613624",
"0.5652071",
"0.54286885",
"0.53455895",
"0.5343968",
"0.5333515",
"0.53334546",
"0.518195",
"0.51461405",
"0.51389295",
"0.5119878",
"0.5071819",
"0.50663686",
"0.506427",
"0.49650648",
"0.49422172",
"0.4931543",
"0.4928321",
"0.49268526",
"0.49178776",
"0.4902761",
"0.48797387",
"0.48773",
"0.48170054",
"0.48102507",
"0.48092258",
"0.48048428",
"0.48033902",
"0.4798059",
"0.47876123",
"0.4764492",
"0.47426432",
"0.4741404",
"0.47391292",
"0.47155693",
"0.47090644",
"0.46989226",
"0.46781784",
"0.46769997",
"0.4673756",
"0.4665119",
"0.46643886",
"0.4658344",
"0.46582568",
"0.46513745",
"0.4647457",
"0.4640879",
"0.4637275",
"0.4631456",
"0.46278182",
"0.461244",
"0.46057",
"0.46048754",
"0.45945826",
"0.45903602",
"0.45889145",
"0.4587314",
"0.45763808",
"0.45687267",
"0.45655677",
"0.45623693",
"0.45532197",
"0.45532197",
"0.45527264",
"0.4547907",
"0.45431855",
"0.4543122",
"0.453411",
"0.45327628",
"0.4527486",
"0.45223397",
"0.45176226",
"0.45172068",
"0.45113194",
"0.45111057",
"0.4508322",
"0.45076907",
"0.4498732",
"0.44982097",
"0.44976887",
"0.44907716",
"0.4488545",
"0.44827926",
"0.44813317",
"0.44781083",
"0.44771287",
"0.44747606",
"0.44719929",
"0.44703755",
"0.44692114",
"0.44576105",
"0.44555637",
"0.44535726",
"0.44491005",
"0.4448521",
"0.4447097"
] |
0.61146283
|
1
|
PATCH/PUT /connpasses/1 PATCH/PUT /connpasses/1.json
|
def update
respond_to do |format|
if @connpass.update(connpass_params)
format.html { redirect_to @connpass, notice: 'Connpass was successfully updated.' }
format.json { render :show, status: :ok, location: @connpass }
else
format.html { render :edit }
format.json { render json: @connpass.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n @pass = Pass.find(params[:id])\n\n respond_to do |format|\n if @pass.update_attributes(params[:pass])\n format.html { redirect_to @pass, :notice => 'Pass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @pass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pass = Pass.find(params[:id])\n\n respond_to do |format|\n if @pass.update_attributes(params[:pass])\n format.html { redirect_to @pass, notice: 'Pass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @pass.update(pass_params)\n format.html { redirect_to @pass, notice: 'Pass was successfully updated.' }\n format.json { render :show, status: :ok, location: @pass }\n else\n format.html { render :edit }\n format.json { render json: @pass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @laynet_ele = LaynetEle.find(params[:id])\n @conn = @laynet_ele.conn\n pass1=@conn.update_attributes(params[:laynet_ele][:conn])\n pass2=@laynet_ele.update_attributes(params[:laynet_ele])\n respond_to do |format|\n if pass1 and pass2\n format.html { redirect_to laynet_eles_url, notice: t('laynet_eles.update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @laynet_ele.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update\n @conn = current_user.conns.find(params[:id])\n\n respond_to do |format|\n if @conn.update_attributes(params[:conn])\n format.html { redirect_to @conn, notice: 'Conn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def patch(path, **args); end",
"def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def update\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n if @click_thru.update_attributes(params[:click_thru])\n format.html { redirect_to @click_thru, notice: 'Click thru was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @click_thru.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :unauthorized\n end",
"def update\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n if @sslplan.update_attributes(params[:sslplan])\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n expose Challenge.update(@oauth_token, params[:challenge_id].strip,\n params[:data])\n end",
"def change_password(opts = {})\n password(opts.merge(:verb => :put))\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end",
"def update\n respond_to do |format|\n if @reqdifficulty.update(reqdifficulty_params)\n format.html { redirect_to @reqdifficulty, notice: 'Reqdifficulty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqdifficulty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, params)\n # abort params.inspect\n resource.update_without_password(params)\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def test_change_password_unsuccessful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"newer-password\"\n }\n\n user_id = 34\n expected = 1001\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def patch\n end",
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, :notice => 'Hack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n block_non_user\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n if @jetty.update_attributes(params[:jetty])\n format.html { redirect_to @jetty, notice: 'Jetty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_without_password(params, *options); end",
"def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end",
"def update\n\n if @penalty.update(penalty_params)\n\n render json: @penalty,status: :ok\n\n else\n\n render json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update_with_password(params, *options); end",
"def change_password!(opts = {})\n password!(opts.merge(:verb => :put))\n end",
"def test_change_password_successful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"new-password\"\n }\n\n user_id = 34\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n # TODO エラーハンドリングを共通化する\n if @current_team&.id != @concert.team.id\n render json: false, status: :unauthorized\n elsif @concert.update(concert_savable_params)\n render :show, status: :ok\n else\n render json: @concert.errors, status: :unprocessable_entity\n end\n end",
"def patch\n req.patch?\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end",
"def update!(**args)\n @allows = args[:allows] if args.key?(:allows)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, notice: 'Hack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params.has_key?(:save_and_go_back) and params.has_key?(:referrer)\n destination = params[:referrer]\n else\n destination = @server\n end\n\n if params[:server].has_key?(:need_password) && params[:server].has_key?(:password)\n case params[:server][:need_password]\n when \"0\"\n params[:server][:password] = \"\"\n when \"1\"\n if params[:server][:password].empty? then\n params[:server].delete :password\n end\n end\n end\n\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to destination, notice: t('notice.server.updated') }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n @cable = Cable.find(params[:id])\n authorize! :update, @cable\n \n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { redirect_to @cable, notice: 'Cable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def update\n UserComposite.new( user_params.merge(id: params[:id]) ).update!\n render json: StatusSerializer.new(:accepted), status: :accepted\n rescue ActiveRecord::RecordInvalid => ex\n render json: UserSerializer.new( ex.record ), status: :unprocessable_entity\n end",
"def patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end",
"def update\n respond_to do |format|\n if @passport.update(passport_params)\n format.html { redirect_to @passport, notice: 'Passport was successfully updated.' }\n format.json { render :show, status: :ok, location: @passport }\n else\n format.html { render :edit }\n format.json { render json: @passport.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n params[:client][:version] = ENV[\"VERSION\"]\r\n params[:client][:username] = current_user.username\r\n @client = Client.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @client.update_attributes(client_params)\r\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @client.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @bits_1.update(bits_1_params)\n format.html { redirect_to @bits_1, notice: 'Bits 1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bits_1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @api_client = args[:api_client] if args.key?(:api_client)\n @client = args[:client] if args.key?(:client)\n @client_states = args[:client_states] if args.key?(:client_states)\n @threat_info = args[:threat_info] if args.key?(:threat_info)\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update!(**args)\n @accesses = args[:accesses] if args.key?(:accesses)\n @resource_edges = args[:resource_edges] if args.key?(:resource_edges)\n @resources = args[:resources] if args.key?(:resources)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update\n respond_to do |format|\n if @cat_poly.update(cat_poly_params)\n format.html { redirect_to @cat_poly, notice: 'Cat poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_poly }\n else\n format.html { render :edit }\n format.json { render json: @cat_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_client\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 0})\n\t\telsif request.method == \"POST\"\n\t\t\trespond(update_user_client(params))\n\t\tend\n\tend",
"def edit(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.edit(struct)\n rt = nil\n val\n end",
"def update\n @challenge ||= Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @disallowed_connections = args[:disallowed_connections] if args.key?(:disallowed_connections)\n @disallowed_primary_connection = args[:disallowed_primary_connection] if args.key?(:disallowed_primary_connection)\n @travel_allowance = args[:travel_allowance] if args.key?(:travel_allowance)\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update_resource(object, attrs)\n object.update_with_password(*attrs)\n end",
"def update\n respond_to do |format|\n if @req.update(req_params)\n flash[:notice] = \"Your requirement has been saved\"\n format.html { redirect_to @req }\n format.json { render :show, status: :ok, location: @req }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @challenge.update_attributes(challenge_params)\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @credito = Credito.find(params[:id])\n\n respond_to do |format|\n if @credito.update_attributes(params[:credito])\n format.html { redirect_to @credito, notice: 'Credito was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @credito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.find(params[:id])\n\n respond_to do |format|\n if @capacite.update_attributes(params[:capacite])\n format.html { redirect_to @capacite, notice: 'Capacite a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capacite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @threat_info = args[:threat_info] if args.key?(:threat_info)\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end"
] |
[
"0.61746484",
"0.61034566",
"0.61034566",
"0.60805917",
"0.6055846",
"0.59964377",
"0.584302",
"0.5830509",
"0.5824125",
"0.5795116",
"0.5734334",
"0.5730964",
"0.5723088",
"0.5688998",
"0.5635366",
"0.5634619",
"0.5628341",
"0.55758846",
"0.5560144",
"0.5532608",
"0.5515663",
"0.54920983",
"0.54348665",
"0.54348665",
"0.5430571",
"0.5430571",
"0.5422036",
"0.542009",
"0.5418546",
"0.54083115",
"0.5403876",
"0.5403876",
"0.5403876",
"0.5403876",
"0.5401547",
"0.5401204",
"0.5398937",
"0.5380695",
"0.5375892",
"0.5361974",
"0.53579855",
"0.5357167",
"0.53571326",
"0.53561014",
"0.535093",
"0.53499955",
"0.53386074",
"0.5336864",
"0.53306156",
"0.53303367",
"0.53270096",
"0.53213656",
"0.5321136",
"0.5321136",
"0.5321136",
"0.5321136",
"0.5321136",
"0.5321136",
"0.5321136",
"0.5321136",
"0.5316653",
"0.53069574",
"0.5302652",
"0.5300354",
"0.5297475",
"0.52907157",
"0.5276993",
"0.5276993",
"0.5276993",
"0.5276993",
"0.5276993",
"0.5276993",
"0.5276993",
"0.5276233",
"0.5276233",
"0.527499",
"0.5269367",
"0.52496904",
"0.524614",
"0.524429",
"0.5237777",
"0.52327996",
"0.52327335",
"0.5231909",
"0.52316064",
"0.52259177",
"0.52214056",
"0.522131",
"0.5219724",
"0.52112603",
"0.52107066",
"0.5209385",
"0.52087677",
"0.52083945",
"0.5207998",
"0.52054006",
"0.52047414",
"0.5198059",
"0.5189386",
"0.518932"
] |
0.6090453
|
3
|
DELETE /connpasses/1 DELETE /connpasses/1.json
|
def destroy
@connpass.destroy
respond_to do |format|
format.html { redirect_to connpasses_url, notice: 'Connpass was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @pass = Pass.find(params[:id])\n @pass.destroy\n\n respond_to do |format|\n format.html { redirect_to passes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pass = Pass.find(params[:id])\n @pass.destroy\n\n respond_to do |format|\n format.html { redirect_to passes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conn = current_user.conns.find(params[:id])\n @conn.destroy\n\n respond_to do |format|\n format.html { redirect_to conns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pass.destroy\n respond_to do |format|\n format.html { redirect_to passes_url, notice: 'Pass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete_pathway\n pathway = Pathway.find(params[:pathway_par])\n current_user.pathways.delete(pathway)\n if current_user.pathways.size < 1\n respond_to do |format|\n format.html { redirect_to '/saved#pathways' }\n format.json { head :no_content }\n end\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end",
"def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end",
"def connections_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_delete\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_delete. Result: #{result.inspect}\"\n end\n return result\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sslplan = Sslplan.find(params[:id])\n @sslplan.destroy\n\n respond_to do |format|\n format.html { redirect_to sslplans_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @click_thru = ClickThru.find(params[:id])\n @click_thru.destroy\n\n respond_to do |format|\n format.html { redirect_to click_thrus_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @argument_connection = ArgumentConnection.find(params[:id])\n @argument_connection.destroy\n\n respond_to do |format|\n format.html { redirect_to argument_connections_url }\n format.json { head :no_content }\n end\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def delete(client_id)\n id = client_id.to_s\n Client.collection.filter(:id => id).delete\n AuthRequest.collection.filter(:client_id => id).delete\n AccessGrant.collection.filter(:client_id => id).delete\n AccessToken.collection.filter(:client_id => id).delete\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to patient_visits_url(@patient) }\n format.json { head :no_content }\n end\n end",
"def destroy\n block_non_user\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @connection.destroy\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def destroy\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.find(params[:id])\n @capacite.destroy\n\n respond_to do |format|\n format.html { redirect_to capacites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.html { redirect_to visits_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, opts = {})\n request(:delete, path, opts).body\n end",
"def destroy\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to visits_url, notice: 'Visita eliminada con exito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_connection = RouteConnection.find(params[:id])\n @route_connection.destroy\n\n respond_to do |format|\n format.html { redirect_to route_connections_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\r\n\r\n @connection_request = ConnectionRequest.find(params[:id])\r\n @connection_request.destroy\r\n\r\n render json: {:status => :success, :data => @connection_request}\r\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trips_connect = TripsConnect.find(params[:id])\n @trips_connect.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_connects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante_credenciado = VisitanteCredenciado.find(params[:id])\n @visitante_credenciado.destroy\n\n respond_to do |format|\n format.html { redirect_to visitante_credenciados_url }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params={}) # :nodoc:\n handle_response(@session.delete(path, MultiJson.dump(params)))\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end",
"def destroy\n @client = Client.find(params[:id])\n authorize! :update, @client\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @clientship = current_user.clientships.find(params[:id])\n @clientship.destroy\n\n respond_to do |format|\n format.html { redirect_to clientships_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @short_visit.destroy\n respond_to do |format|\n format.html { redirect_to short_visits_url, notice: 'Short visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @passport.destroy\n respond_to do |format|\n format.html { redirect_to passports_url, notice: 'Passport was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @visit.destroy\n\n head :no_content\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to visits_url, notice: 'Visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n @goal_categories = GoalCategory.all\n \n unless @visit.errors.any?\n @visit = @visit.client.visits.last\n end\n \n @client = Client.find(params[:client_id])\n @client.goals.each do |goal|\n if goal.goal_states.empty?\n goal.destroy()\n end\n end\n \n prepareShow()\n\n respond_to do |format|\n format.html { render :show }\n format.json { head :no_content }\n end\n end",
"def destroy\n @escapetunnel = Escapetunnel.find(params[:id])\n @escapetunnel.destroy\n\n respond_to do |format|\n format.html { redirect_to escapetunnels_url }\n format.json { head :ok }\n end\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # if authorise(request)\n operation = params[:operation]\n case operation\n when 'remove_vertex'\n delete_vertex(params[:id])\n when 'disconnect_vertex'\n delete_connection(params[:from_vertex_id], params[:to_vertex_id])\n else\n render json: { status: 'FAILED', message: 'Operation does not exist' }, status: :bad_request\n end\n # else\n # render json: { status: 'FAILED', message: 'Unauthorized' }, status: 401\n # end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to patient_visits_path(params[:patient_id]) }\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.6568274",
"0.6541548",
"0.6541548",
"0.64127207",
"0.6385443",
"0.6331785",
"0.63183075",
"0.6239806",
"0.6233033",
"0.6220353",
"0.62014693",
"0.61795956",
"0.61683464",
"0.61445504",
"0.609677",
"0.6096424",
"0.60917306",
"0.60782784",
"0.6069781",
"0.60662496",
"0.60655844",
"0.6064983",
"0.60611725",
"0.6058593",
"0.6051334",
"0.60357267",
"0.6034412",
"0.6030715",
"0.6024341",
"0.6015656",
"0.60089135",
"0.600377",
"0.5960739",
"0.59599984",
"0.59567845",
"0.59560215",
"0.59560215",
"0.59560215",
"0.59560215",
"0.5951358",
"0.5951021",
"0.595076",
"0.59498376",
"0.5948449",
"0.5946184",
"0.59427387",
"0.5942387",
"0.5925367",
"0.591241",
"0.5910192",
"0.590919",
"0.59019035",
"0.5900308",
"0.5897434",
"0.58955365",
"0.58923936",
"0.5891179",
"0.5890536",
"0.5889292",
"0.5888211",
"0.5883517",
"0.5883517",
"0.5881178",
"0.587983",
"0.5871938",
"0.5870726",
"0.58706576",
"0.58673024",
"0.5864778",
"0.5863614",
"0.5858837",
"0.58586156",
"0.5858064",
"0.5857982",
"0.5857982",
"0.5857576",
"0.5846542",
"0.58436894",
"0.5841196",
"0.5833291",
"0.5832688",
"0.58317864",
"0.58308655",
"0.58282536",
"0.58250225",
"0.5824819",
"0.5816046",
"0.581459",
"0.5813048",
"0.581264",
"0.58103114",
"0.5808622",
"0.5804806",
"0.5804708",
"0.5804106",
"0.5803457",
"0.58008426",
"0.5797359",
"0.57952267",
"0.57952267"
] |
0.70593244
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_connpass
@connpass = Connpass.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def connpass_params
params[:connpass]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
POST /listings POST /listings.json
|
def create
@listing = Listing.new(params[:listing])
if @listing.save
@listing.listing_nugget.update_attribute(:listing_extracted, true)
#if attachments are an broker email attachment
if params["email_attachment_ids"] && params["email_attachment_ids"].strip != ""
arr = params["email_attachment_ids"].split(";")
arr.each do |a|
email_attachment = BrokerEmailAttachment.find(a)
if Rails.env.development? || Rails.env.test?
attachment = ListingAttachmentUploader.new
attachment.cache!(File.open("#{email_attachment.file.current_path}"))
attach = ListingAttachment. create(
:listing_id=> @listing.id,
:file=> attachment
)
else
attachment = @listing.listing_attachments.new
attachment.remote_file_url = email_attachment.file.url
attachment.save
end
end
# if attachments are nugget attachments
elsif params["nugget_attachment_ids"] && params["nugget_attachment_ids"].strip != ""
arr = params["nugget_attachment_ids"].split(";")
arr.each do |a|
nugget_signage = NuggetSignage.find(a)
if Rails.env.development? || Rails.env.test?
attachment = ListingAttachmentUploader.new
attachment.cache!(File.open("#{nugget_signage.signage.current_path}"))
attach = ListingAttachment. create(
:listing_id=> @listing.id,
:file=> attachment
)
else
attachment = @listing.listing_attachments.new
attachment.remote_file_url = nugget_signage.signage.url
attachment.save
end
end
end
end
redirect_to :back
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end",
"def index\n @listings = Listing.all\n render json: @listings\n end",
"def create\n #debugger\n #TODO: DELETE ALL\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end",
"def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = current_profile.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end",
"def create\n @listing = current_user.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spot_listing = current_user.spot_listings.build(params[:spot_listing])\n @spot_listing.completed = false\n respond_to do |format|\n if @spot_listing.save\n format.html { redirect_to user_dashboard_url, notice: 'Your listing has been successfully created' }\n format.json { render json: @spot_listing, status: :created, location: @spot_listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spot_listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Associate user id with creating a listing \n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: \"Listing was successfully created.\" }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # byebug\n @building = Building.find(listing_params[:building_id])\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to listing_path(@listing), notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n # post_to_slack(@listing.id)\n # update_categories\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = @commoner.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @listing = Listing.new(listing_params)\n @listing = current_user.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def listing_params\n params.require(:listing).permit(:name, :time, :location, :body, :category)\n end",
"def create\n @listing = Listing.new(listing_params)\n @listing.user = current_user\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @listings = Listing.all\n \n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def create\n @listing = Listing.new(params[:listing])\n @listing.urls.append params[:url]\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render json: @listing, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def serve_listing_data\n @listings = Listing.open.joins(:origin_loc).group(\"listings.id\").\n order(\"listings.created_at DESC\").find_with(params, @current_user, @current_community).select(\"listings.id, listing_type, category\")\n render :json => { :data => @listings }\n end",
"def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n\n Mailer.new_listing(@listing).deliver\n\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = current_user.listings.new(listing_params)\n # @listing.status = 1\n if @listing.save\n redirect_to @listing\n else\n render :new\n end\n end",
"def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end",
"def listing_params\n\t params.permit(:token, :pretty, :format,\n\t \t:listing_type, :layout, :bathrooms, :min_rent, :max_rent,\n\t \t:cats_allowed, :dogs_allowed, :elevator, :doorman, :date_available_after,\n\t \t:date_available_before, :laundry_in_building, :laundry_in_unit, :changed_at,\n\t \t:has_photos, :featured, :sort, :sort_dir, :per_page, :page,\n\t \t:neighborhoods, :geometry, :agents, :status)\n \tend",
"def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n respond_to do |format|\n if @listing.save!\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n #contains all the listings\n @listings = Listing.all\n end",
"def create\n @listing = current_user.listings.build(listing_params)\n @listing.save\n redirect_to @listing\n end",
"def listing_params\n params.require(:listing).permit(:name, :content)\n end",
"def create\n @listing = current_user.listings.new(listing_params)\n if @listing.save! \n redirect_to '/listings'\n else\n render 'new'\n end\n end",
"def listing_params\n params.require(:listing).permit(:name, :desc, :price, :address, :latitude, :longitude, :token, :coin, :published_at, :images, :imove_in, :property, :furnished, :area, :parking, :bathroom, :bedroom, :hide)\n end",
"def listing_params\n params.require(:listing).permit(:title,:description,:room_type,:bedrooms,:rent,:rooms_for_rent,:available_from,:minimumstay,:current_roommates,:prefred_gender,:prefred_age, :prefred_occupation,:phonenumber_visibility,:visible_status,:verified_status,:security_deposit,:furnishing_status,:landmark,:user_id,:area_id,:city_id,:rule_ids => [],:amenity_ids => [])\n end",
"def listing_params\n params.require(:listing).permit(:name, :phone, :address, :postal_code, :email, :description, :price, :image_url, :home_service, :aggressive_pets_accepted, :query, :user_id)\n end",
"def listing_params\n params.require(:listing).permit(:title, :picture, :description, :price, :availability, :condition, :category_id, feature_ids: [])\n end",
"def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n\n respond_to do |format|\n if @listing.save\n\n # format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.html { redirect_to new_listing_availability_path(@listing), notice: 'Step 2: Listing was successfully created. Please add at least one start date and a later end date' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end",
"def listing_params\n params.require(:listing).permit(:user_id, :title, :description, :property_type, :num_of_rooms, :num_of_bathrooms, :price, :address, :city, :country, :max_guest, :num_of_beds)\n end",
"def index\n \t@listings = Listing.all\n end",
"def create\n # @profile_id = current_user.profile.id\n # @profile_name = current_user.profile.first_name\n @listing = current_user.profile.listings.create(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end",
"def listing\n @listing = Listing.find(params[:listing_id])\n end",
"def create\n # First find the company name (:company_name)\n if listing_params.has_key?(:company_name)\n c_name = listing_params[:company_name]\n company = Company.find_or_create_by(name: c_name)\n listing_params[:company_id] = company.id\n listing_params.delete(:company_name)\n @listing = Listing.new({\n company_id: company.id,\n description: listing_params[:description],\n deadline: listing_params[:deadline],\n job_title: listing_params[:job_title],\n url: listing_params[:url]\n })\n else\n @listing = Listing.new({\n description: listing_params[:description],\n deadline: listing_params[:deadline],\n job_title: listing_params[:job_title],\n url: listing_params[:url]\n })\n end\n\n if @listing.save\n render :show, status: :created, location: @listing\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n end",
"def create\n @listing = Listing.new(params[:listing])\n\n respond_to do |format|\n if @listing.save\n flash[:notice] = 'Listing was successfully created.'\n format.html { redirect_to(@listing) }\n format.xml { render :xml => @listing, :status => :created, :location => @listing }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(params[:listing])\n\n respond_to do |format|\n if @listing.save\n flash[:notice] = 'Listing was successfully created.'\n format.html { redirect_to(@listing) }\n format.xml { render :xml => @listing, :status => :created, :location => @listing }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def listing_params\n params.require(:listing).permit(:depart_maps_id, :depart_loc_id, :depart_range_start, :depart_range_end, :dest_maps_id, :dest_loc_id, :dest_range_start, :dest_range_end, :listing_type, :money, :comments, :detour_time)\n end",
"def my_listings\n page = params[:page]\n offset = page.to_s+\"0\"\n @prevPage = page.to_i-1\n @nextPage = page.to_i+1\n\n userID = session[:user_id]\n\n uri = URI(\"http://107.170.7.58:4567/api/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"count\" => \"10\", \"offset\" => offset}\n response = Net::HTTP.post_form(uri, parameters)\n\n list = JSON.parse(response.body)\n\n @sells = Array.new\n @books = Array.new\n list.each do |listing|\n if listing[\"kind\"].eql? \"sell\"\n @sells.push Sell.new(listing[\"data\"])\n else if listing[\"kind\"].eql? \"book\"\n @books[listing[\"data\"][\"id\"]] = Edition.new(listing[\"data\"])\n end\n end\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n\n authorize! :create, @listing\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(params[:listing])\n @listing.user_id= session[:user_id]\n respond_to do |format|\n if @listing.save\n @client = GooglePlaces::Client.new('AIzaSyCzlX9Hndc6BZlHpLVkk8S_xRGOsnA_cJ4')\n @arr=[@listing.latitude, @listing.longitude]\n @vv=@client.spots(@arr[0], @arr[1])\n @vv.each do |t|\n @pn= Pen.new\n @pn.latitude=t.lat\n @pn.longitude=t.lng\n @pn.vicinity=t.vicinity\n @pn.name=t.name\n @pn.icon=t.icon\n @pn.url=t.url\n @pn.types=t.types.join(\",\")\n @pn.listing_id=@listing.id\n @pn.save\n end # for end\n redirect_to \"/listings//\", :notice => \"New list successfully created\"\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end # commond end for if {statements} else {statements} end\n end #respond do\n end",
"def create\n @listing = Listing.new(listing_params)\n\n # check that the product has a print_image already created\n if @listing.product.print_image.file.nil?\n @listing.errors.add(:create, \"Product must have a print_image to create a listing\")\n render json: @listing.errors, status: :unprocessable_entity and return\n end\n\n current_user.listings << @listing\n\n if @listing.save\n store = Store.find(listing_params[:store_id])\n adapter = store.get_adapter\n @listing.external_id = adapter.list_product(@listing)\n @listing.printer_sku = @listing.sku\n Rails.logger.debug \"----------start------\"\n Rails.logger.debug @listing.inspect\n Rails.logger.debug \"----------start------\"\n\n if @listing.save\n render json: @listing, status: :created\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json => @listing }\n end\n end",
"def create\n @waiting_list = WaitingList.new(params[:waiting_list])\n\n respond_to do |format|\n if @waiting_list.save\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully created.' }\n format.json { render json: @waiting_list, status: :created, location: @waiting_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def listing_params\n params.require(:listing).permit(:name, :location, :description, :price, :tag_list, photos: [])\n end",
"def listing_params\n params.require(:listing).permit(:name, :code, :language, :private)\n end",
"def listing_params\n params.require(:listing).permit(:name, :place_type, :property_type, :room_number, :bed_number, :guest_number, :country, :state, :city, :zipcode, :address, :price, :description, :user_id)\n end",
"def listing_params\n params.require(:listing).permit(:description, :address, :num_of_bedrooms, :num_of_guests, :name, :location, listing_photos_attributes: [:id, :listing_id, :image])\n end",
"def index\n # @listings = Listing.all\n @listings = Listing.order(:name).page params[:page]\n end",
"def listing_params\n params.require(:listing).permit(:title, :price, :location, :bedrooms, :bathrooms, :amenities, :description, {image:[]}, :used_date, :all_tags, :tag)\n end",
"def listing_params\n params.require(:listing).permit(:title, :description, :year, :length, :sleeps, :rateperhour, :vehicletype, :rentalminimum, :latitude, :longitude, :city, :imagefront, :imageback, :imageleft, :imageright, :interiorfront, :interiorback, :state, :zipcode, :pickup_street_address, :pickup_city, :pickup_state, :pickup_zipcode, :extra_guest_charges, :maximum_guest_allowed)\n end",
"def listing_params\n params.require(:listing).permit(:profile_id, :hobby_id, :description, :location, :date, :city_id, :equipment, :capacity)\n end",
"def listing_params\n params.require(:listing).permit(:title, :description, :guests, :city, :stay_length, :country, :in_exchange)\n end",
"def listing_params\n params.require(:listing).permit(\n :title,\n :description,\n :image_url,\n :activated_at,\n :street_1,\n :street_2,\n :postal_code,\n :client_managed,\n client: [\n :first_name,\n :last_name,\n :email,\n :telephone\n ]\n )\n end",
"def listing_params\n params[:listing]\n end",
"def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n params[:listing_photos]['image'].each do |a|\n @listing_photo = @listing.listing_photos.create!(:image => a, :listing_id => @listing.id)\n end\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def listing_params\n listing_stuff = params.require(:listing).permit(:building_id, :unit_no, :floor_plan, :num_fbaths, :num_hbaths, :advertising, :move_in_special, :commission, :rent_price, :rent_per_period, :photo, :for_sale, :unit_floor_location, :type_of_property, :style, :sqft, :balcony, :liv_area, :efficiency, :faces, :additional_parking_info, :furnished_information, :available_date, :view, :floor, :dinning, :listing_type, :list_date, :expiration_date, :convert_bed, floor_ids: [], dining_area_ids: [], interior_feature_ids: []).to_h\n listing_stuff[:building_id] = params[:building_id]\n listing_stuff\n end",
"def create\n @listing = SaleListing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Sale listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n if @listing.save\n create_images if params[:images]\n flash[:notice] = 'Listing was successfully created.'\n end\n respond_with(@listing)\n end",
"def listing_params\n params.require(:listing).permit(\n :user_id, :place_name, :place_type, :address, \n :bedroom, :bath, :amenity, :cost_per_night,:description, {avatars:[]} \n )\n # if want to create post, it need :user_id, :place_name, :place_type, :address, \n # :bedroom, :bath, :amenity, :cost_per_night,:description validation\n end",
"def listing_params\n params.require(:listing).permit(:description, :street_address, :city, :state,\n :zip_code, :primary_contact, :secondary_contact,\n :listing_status, :asking_price, :renobb, :picture)\n end",
"def listing_params\n params.require(:listing).permit(:name, :address, :address_en, :photo, :manual, :map, :checkin, :checkout, :house_rule, :question, listing_details_attributes: [:id, :name, :photo_url, :detail, :_destroy])\n end",
"def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n @listing.profile_id = current_user.profile.id\n # @listing.status = params[:status].nil? ? 'pending' : 'draft'\n\n respond_to do |format|\n if @listing.save\n @listing.update(status: 'draft') if saving_as_draft?\n @listing.update(status: 'pending') if publishing?#waiting for admin to verify (active)\n\n @listing.category_ids=(params[:category]) unless params[:category].empty? or params[:category].nil?\n format.html { redirect_to display_vendor_listing_path(current_user.username, @listing), notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meetings_list = MeetingsList.new(meetings_list_params)\n\n respond_to do |format|\n if @meetings_list.save\n format.html { redirect_to @meetings_list, notice: 'Die Meeting-Liste wurde erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @meetings_list }\n else\n format.html { render :new }\n format.json { render json: @meetings_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def listing_params\n params.require(:listing).permit(:title, :description, :organization, :email, :salary, :city, :state, :user_id, :location, :source, :posted, :contact, :category, :tag_list, :wyncode_only)\n end",
"def listing_params\n params.fetch(:listing, {})\n end",
"def listing_params\n params.require(:listing).permit(:name, :description, :price, :slug, {listingimages: []})\n end",
"def create\n puts params[:listing]\n params[:listing][:tap_description] = params[:listing][:description].to_s + \"-\"+params[:listing][:bedrooms].to_s + \"Beds-\"+ params[:listing][:bathrooms].to_s + \"Baths -\" + params[:listing][:squarefootage].to_s + \"sq.ft\"\n @listing = Listing.new(params[:listing])\n @listing.user_id = current_user.id\n if !params[:image_file].nil?\n @uploadimages = Picture.new\n @uploadimages.upload_file_name = params[:image_file].original_filename\n @uploadimages.upload_content_type = params[:image_file].content_type\n @uploadimages.upload_file_size = params[:image_file].size\n @uploadimages.data = params[:image_file].read\n end\n respond_to do |format|\n if @listing.save\n @listings = Listing.where(:user_id => current_user.id)\n if !params[:image_file].nil?\n @uploadimages.listing_id = @listing.id\n @uploadimages.save\n end\n format.html { redirect_to '/mylistings', notice: 'Listing was successfully created.' }\n format.json { render json: @listings, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tasklisting = Tasklisting.new(tasklisting_params)\n\n respond_to do |format|\n if @tasklisting.save\n format.html { redirect_to @tasklisting, notice: 'Tasklisting was successfully created.' }\n format.json { render :show, status: :created, location: @tasklisting }\n else\n format.html { render :new }\n format.json { render json: @tasklisting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def listing_params\n params.require(:listing).permit(:image, :city, :address, :suite, :size, :building_type, :building_class, :asking_rate, :opex, :lease_type, :brokerage, :notes)\n end",
"def show\n @listings = Listing.find(params[:id])\n end",
"def listing_params\n params.require(:listing).permit(:title, :created_at, :content, :picture, :price, :category_id)\n end",
"def create\n @listing = Listing.new(listing_params)\n @listing.host_email = current_user.email\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def listing_params\n params.require(:listing).permit(:title, :description, :remuneration, :category_id, :page)\n end",
"def listing_params\n params.require(:listing).permit(:title, :body, :user_id)\n end",
"def create\n @listing = current_user.listings.create(listing_params)\n if @listing.valid?\n @listing.save!\n redirect_to listing_path(@listing.id)\n else\n flash.now[:messages] = @listing.errors.full_messages\n render :new\n end\nend",
"def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end",
"def set_listing\n @listing = Listing.find(params[\"id\"])\n end",
"def post_req\n redirect_to :controller => :listings, :action => :index\n end",
"def listing_params\n schema = Listing.column_names.map &:to_sym\n params.require(:listing).permit(schema)\n end",
"def listing_params\n params.require(:listing).permit(\n :host_id,\n :title,\n :description,\n :price,\n :max_capacity,\n :site,\n :lat,\n :lng,\n :location,\n :check_in,\n :check_out,\n :photos\n )\n end",
"def listing_params\n params.require(:listing).permit(:title, :description, :etsy_user_id, :price, :etsy_listing_id)\n end"
] |
[
"0.7446066",
"0.7005275",
"0.6834559",
"0.6828408",
"0.6827981",
"0.6775853",
"0.6734454",
"0.6723492",
"0.6723492",
"0.6673963",
"0.6612273",
"0.66121864",
"0.6581905",
"0.6568161",
"0.65660554",
"0.6559053",
"0.6555972",
"0.65158397",
"0.6491164",
"0.6446251",
"0.6435303",
"0.6434414",
"0.6434414",
"0.6434414",
"0.6434414",
"0.6434414",
"0.6434414",
"0.64224786",
"0.6421064",
"0.6412859",
"0.63799906",
"0.63727295",
"0.6359386",
"0.63567346",
"0.6350961",
"0.63424164",
"0.6341744",
"0.6333401",
"0.63218683",
"0.63133717",
"0.62897825",
"0.62862587",
"0.62732726",
"0.6267138",
"0.6243244",
"0.6237521",
"0.62269753",
"0.62023073",
"0.61984754",
"0.61984754",
"0.61984754",
"0.6196916",
"0.6194216",
"0.61919475",
"0.61919475",
"0.61870515",
"0.61652106",
"0.61628157",
"0.61478925",
"0.61309683",
"0.61238813",
"0.6114666",
"0.6102164",
"0.6091825",
"0.6091071",
"0.6084754",
"0.60810703",
"0.6073797",
"0.6071058",
"0.6070352",
"0.60662603",
"0.60401523",
"0.6036681",
"0.6027931",
"0.60236037",
"0.5993447",
"0.59854406",
"0.5984274",
"0.5982448",
"0.5975913",
"0.5975679",
"0.5969285",
"0.5968414",
"0.59675014",
"0.5967092",
"0.5965465",
"0.5959429",
"0.5957223",
"0.5954616",
"0.595436",
"0.59488463",
"0.5945933",
"0.5927306",
"0.59257555",
"0.5913477",
"0.59122795",
"0.5909264",
"0.5896563",
"0.5895885",
"0.589409",
"0.58924025"
] |
0.0
|
-1
|
DELETE /listings/1 DELETE /listings/1.json
|
def destroy
@listing = Listing.find(params[:id])
@listing.destroy
respond_to do |format|
format.html { redirect_to :back }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n api_delete(\"/listings/#{@listing_id}\")\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if @listing.destroy\n render nothing: true, status: :ok\n else\n render nothing: true, status: :bad_request\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n redirect_to listings_url\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #deleting a listing\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: \"Listing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to building_listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @listing = Listing.find(params[:listing_id])\n # need to delete on current user for security\r\n current_user.read_listings.delete(@listing)\r\n \n respond_to do |format|\r\n format.xml { head :ok }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to admin_listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # gets the todo items listing params :id\n @listing = Listing.find(params[:id])\n # destroys the current listing\n @listing.destroy\n \n # redirects you back to the (root) index page\n redirect_to listings_path\n end",
"def destroy\n @listing.destroy\n\n render json: @listing\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_path, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @lisitng\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slisting.destroy\n respond_to do |format|\n format.html { redirect_to slistings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: \"Listing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end",
"def destroy\n @listing.destroy\n redirect_to \"/listings\"\n end",
"def destroy\n @waiting_list = WaitingList.find(params[:id])\n @waiting_list.destroy\n\n respond_to do |format|\n format.html { redirect_to waiting_lists_url }\n format.json { head :no_content }\n end\n end",
"def delete_listing(listing_id)\n authenticated? do\n query_and_build \"marketplace/listings/#{listing_id}\", {}, :delete\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing_list = ThingList.find(params[:id])\n @thing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(thing_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @spot_listing = SpotListing.find(params[:id])\n @spot_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to spot_listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day_road_listing.destroy(params[:id])\n respond_to do |format|\n format.html { redirect_to day_road_lists_url, notice: 'Day road list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to sale_listings_url, notice: 'Sale listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to list_types_url, notice: \"Check ya later list.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to management_lists_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n end",
"def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_listing = EmailListing.find(params[:id])\n @email_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to email_listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tasklisting.destroy\n respond_to do |format|\n format.html { redirect_to tasklistings_url, notice: 'Tasklisting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house_list.destroy\n respond_to do |format|\n format.html { redirect_to house_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ongoing = Ongoing.find(params[:id])\n @ongoing.destroy\n\n respond_to do |format|\n format.html { redirect_to ongoings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @landing = Landing.find(params[:id])\n @landing.destroy\n\n respond_to do |format|\n format.html { redirect_to landings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listed.destroy\n respond_to do |format|\n format.html { redirect_to session[:previous_url] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_listing.destroy\n respond_to do |format|\n format.html { redirect_to business_listings_url, notice: 'Business listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredient_list.destroy\n respond_to do |format|\n format.html { redirect_to ingredient_lists_url, notice: 'Ingredient list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @topping_list.destroy\n respond_to do |format|\n format.html { redirect_to topping_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n redirect_to listings_url, notice: 'Listing was successfully deleted.'\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing_status = ListingStatus.find(:first, :conditions => [\"id = ?\", params[:id]], :select => 'id, description, position, is_final', :order => 'description')\n ListingStatus.clear_cached(params[:id])\n ListingStatus.clear_cached_from_description(@listing_status.description)\n @listing_status.destroy\n respond_to do |format|\n format.html { redirect_to(listing_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: \"List was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite_listing = get_favourite_listing(params[:id])\n @favourite_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to favourite_listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to my_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_shopping_list.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_shopping_lists_url, notice: 'Shopping list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def destroy\n @todoit_list.destroy\n respond_to do |format|\n format.html { redirect_to todoit_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listings_poll.destroy\n respond_to do |format|\n format.html { redirect_to listings_polls_url, notice: 'Listings poll was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing = Listing.find(params[:id])\n if @listing.user == current_user\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully deleted.' }\n format.json { head :no_content }\n end\n else\n redirect_to @listing, notice: 'This Listing cannot be deleted. Please contact the owner of this listing. '\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'The List was destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @landing.destroy\n respond_to do |format|\n format.html { redirect_to landings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listing.destroy\n flash[:alert] = \"Deleted Listing\"\n redirect_to listings_path\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { render :nothing => true}\n format.json { head :no_content }\n end\n end",
"def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end",
"def delete_listing(db, id)\n\tdb.execute(\"DELETE FROM cars WHERE id=?\", [id])\nend",
"def destroy\n @album_listing.destroy\n respond_to do |format|\n format.html { redirect_to album_listings_url, notice: 'Album listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inning = Inning.find(params[:id])\n @inning.destroy\n\n respond_to do |format|\n format.html { redirect_to innings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lending = Lending.find(params[:id])\n @lending.destroy\n\n respond_to do |format|\n format.html { redirect_to lendings_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.8234062",
"0.74533904",
"0.74533904",
"0.74533904",
"0.74533904",
"0.74533904",
"0.7325798",
"0.7325798",
"0.7325798",
"0.7325798",
"0.7325798",
"0.7303547",
"0.729347",
"0.72206295",
"0.72045994",
"0.71954113",
"0.71954113",
"0.71954113",
"0.71435225",
"0.7079359",
"0.7078171",
"0.7070172",
"0.7016359",
"0.7010337",
"0.70053726",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.69932735",
"0.6986055",
"0.69468427",
"0.69310576",
"0.68790984",
"0.6871891",
"0.6850598",
"0.6850598",
"0.6850598",
"0.68431485",
"0.6842014",
"0.67923856",
"0.6777032",
"0.67745346",
"0.67745346",
"0.67745346",
"0.67557293",
"0.6748255",
"0.672671",
"0.67141867",
"0.6711824",
"0.6697422",
"0.66971487",
"0.6695949",
"0.66909266",
"0.668646",
"0.6684782",
"0.666378",
"0.6663233",
"0.6660306",
"0.66507715",
"0.6647508",
"0.6641416",
"0.66333944",
"0.663325",
"0.6620683",
"0.6616123",
"0.6616123",
"0.6616123",
"0.6616123",
"0.6616123",
"0.6616123",
"0.6616123",
"0.66156554",
"0.6615396",
"0.6600392",
"0.6598149",
"0.6592888",
"0.6589221",
"0.6585414",
"0.6577055",
"0.6574002",
"0.6570373",
"0.6568369",
"0.65631956",
"0.6554496",
"0.6536206",
"0.6515861",
"0.6512093",
"0.6501689",
"0.6491189"
] |
0.7182406
|
18
|
Description: This method process get lastest roadmap
|
def get_lastest_roadmaps(user_id)
UserCategory.where(user_id: user_id).order_by(created_at: -1).limit(ITEM_PER_PAGE)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_new_road\n return nil if finding_new_road?\n return nil if Params::NEW_ROOT_FIND_PERCENTAGE < rand(Params::PERCENT_DENOMINATOR)\n\n found_mini_map_ids = mini_map_roads.collect{|r| r.end_mini_map_id}\n found_mini_map_ids << id\n not_found_mini_map_ids = MiniMap.all.collect{|m| m.id} - found_mini_map_ids\n end_mini_map_id = not_found_mini_map_ids[rand(not_found_mini_map_ids.size)]\n \n return end_mini_map_id\n end",
"def midtown_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, ['primary'], [])\nend",
"def midtown_no_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], ['primary'])\nend",
"def road_trip_game(route, neighbours)\n seen_plate_scores = {}\n route.each do |state, plates|\n plates.each do |plate|\n points = state_distance(state, neighbours, plate)\n seen_plate_scores[plate] = seen_plate_scores[plate].nil? ? [points] : seen_plate_scores[plate].push(points)\n end\n end\n \n result = {}\n seen_plate_scores.each do |plate, scores|\n result[plate] = scores.max\n end\n result\nend",
"def getLongFlight(csa)\n number2 = 0\n @parse.map{ |airport| \n if( airport[\"name\"] == csa) \n airport[\"destinations\"].map do |element|\n number1 = element[\"distance\"]\n if(number1>number2)\n number2 = number1\n end\n end\n airport[\"destinations\"].map{ |dest| \n if(number2 == dest[\"distance\"])\n puts \"The max distance is \" + number2.to_s + \" in the fligth between \"+ dest[\"ports\"].to_s\n end\n }\n end\n }\n end",
"def longest_single_flight\n\n max_distance = -1\n flight = \"\"\n @query.get_graph.each_key do |city|\n route_dict = get_outgoing_routes(city)\n route_dict.each do |dest, dist|\n if dist > max_distance\n max_distance = dist\n flight = \"#{get_city_info(city,\"name\")}-#{dest}\"\n end\n end\n end\n\n return flight\n\n end",
"def midtown_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], [])\nend",
"def last\n @locations.last\n end",
"def get_json_from_openstreetmaps(key,val,constrain_to_usa = true)\n timeout = 20000\n bounds = \"#{CONTINENTAL_US[:s]},#{CONTINENTAL_US[:w]},#{CONTINENTAL_US[:n]},#{CONTINENTAL_US[:e]}\"\n bounds_string = constrain_to_usa ? \"(#{bounds})\" : \"\"\n\n #This string fetches all geometry of a way including center points, but does not restrict how many ways to download\n #str = \"data=[out:json][timeout:#{timeout}];way[\\\"#{key}\\\"=\\\"#{val}\\\"](#{bounds_string});foreach((._;>;);out center #{NUMBER_TO_DOWNLOAD};);\"\n\n #This string fetches almost all geometry of a way except for center points. Does restrict number to download. \n str = \"data=[out:json][timeout:#{timeout}][maxsize:1073741824];way[\\\"#{key}\\\"=\\\"#{val}\\\"]#{bounds_string};out count;out meta geom #{NUMBER_TO_DOWNLOAD};\"\n\n print str\n base_url = \"http://overpass-api.de/api/interpreter?\"\n url = \"#{base_url}#{URI.escape(str)}\"\n puts url\n response = Typhoeus.get(url, {followlocation: true, timeout: timeout})\n response.body\nend",
"def get_route(curr_pos, end_time, pmap, tws, twe) \n ans = []\n starting_tuple = curr_pos << 0 # 0 is the waiting time\n ans << starting_tuple # [y, x, time unit]\n \n\t\n\t\n max_y = pmap.length - 1 \n max_x = pmap[0].length - 1\n \n highest_score = 0.0\n \n\ttime_for_score = 0.0\n\ttime_for_get_ans = 0.0\n\t\n\ttemp = -1\n\ttemp1 = 0\n\tfor y in 0..max_y\n\t\ttemp1 = pmap[y].count(temp)+ temp1 \n\tend\n\t\n\tno_of_pokemon = (pmap.length*pmap[0].length - temp1)\n\t\n\tnumber_of_loops = 0.7541*Math.log(no_of_pokemon,E) + 0.9829\n\t\n\n\t\n\t\n for h in 0...number_of_loops\n pmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n time_taken = Time.now\n sortedArrayByRatioDistStart1 = []\n ans1 = []\n ans1 = getArrayResultsWithStartingPokemon(starting_tuple, pmap1, tws1, twe1, sortedArrayByRatioDistStart1, end_time, h)\n\t\ttime_for_get_ans = Time.now - time_taken + time_for_get_ans\n\t\t\n\t\tpmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n\t\ttime_taken = Time.now\n score_time1 = get_score(ans1, pmap1, tws1, twe1)\n route_score1 = score_time1[0].round\n route_time1 = score_time1[1].round(3)\n time_for_score = Time.now - time_taken + time_for_score\n\t\t\n if highest_score <= route_score1\n final_ans = ans1\n highest_score = route_score1\n end\n\t\t\n\t\t\n end\n \n\n return final_ans\nend",
"def last\n @regions.sort.last\n end",
"def last\n self.get_geometry_n(self.num_geometries - 1) if self.num_geometries > 0\n end",
"def last\n self.get_geometry_n(self.num_geometries - 1) if self.num_geometries > 0\n end",
"def print_longest_flight(graph_instance)\n max_distance = 0\n city1 =''\n city2 =''\n graph_instance.node_hash.each_key { |key|\n linked = graph_instance.node_hash[key].linked_cities\n linked.each{ |tuple|\n if(tuple.distance > max_distance)\n max_distance = tuple.distance\n city1 = key\n city2 = tuple.city\n end\n }\n }\n puts \"Longest flight is #{max_distance} between #{city1} and #{city2}\"\nend",
"def hanover_roads\n hanover_north = 43.7031803975023\n hanover_east = -72.28413820266724\n hanover_south = 43.69828604529516\n hanover_west = -72.29262471199036\n OverpassGraph.get_roads(hanover_north, hanover_east, hanover_south, hanover_west, [], [])\nend",
"def getMaxPopulation(csa)\n population1 = 0\n @@parse.map{ |airport| \n if( airport[\"name\"] == csa) \n airport[\"destinations\"].map do |element,i|\n code = getCode(element[\"ports\"], airport[\"code\"])\n population2 = getPopulation(code, graph) \n if(population2>population1)\n population1 = population2\n end\n end\n \n puts \"The city with Max population from \"+ csa +\" available is : \" + getPopulationCity(population1, graph)\n end\n \n }\n end",
"def find_max_locator\n return nil if empty?\n use_max\n mode_call(:find_max_loc)\n end",
"def find_best_way(xx,yy)\n pf = Pathfinder.new($map)\n pf.ignore_obs_target = true # permit to calculate a path to a case with an ennemy on it\n path = pf.find([x,y],[xx,yy])\n end",
"def latest_ball(match)\n if match.blank? \n else\n over = latest_over(match)\n Ball.where(over_id: over, match_id: match).last\n end\n end",
"def invalid_longitude_roads\n north = 80\n east = -178\n south = 79\n west = -181\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend",
"def getLatest()\n return Gesellschafter.get(self.Mnr)\n end",
"def last\n @routes[-1]\n end",
"def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend",
"def last\n return nil if ! @map.last\n if @map.length == 1\n left = 0\n else\n left = @map[@map.length-2][0]+1\n end\n [@map.length-1,@map.last[1],left,@map.last[0]]\n end",
"def optimal_town(routes, current)\n\t\troutes = remove_visited(routes, current)\n\n\t\tif routes.length == 0 then \n\t\t\tputs \"Stuck at: #{current.name}\" \n\t\t\tputs \"Can't get to: #{Place.find_by_id(@to_visit_ids[0]).name}\"\n\t\tend\n\n\t\toptimal = routes[0]\n\t\tlow_method = optimal_method(routes[0])\n\t\tlow_time = method_time(low_method, routes[0])\n\t\tother = routes[0].other_town(current.id)\n\n\n\t\troutes.each do |r|\n\t\t\tr_low_method = optimal_method(r)\n\t\t\tr_low_time = method_time(r_low_method, r)\n\n\t\t\tif r_low_time < low_time then \n\t\t\t\tlow_time = r_low_time\n\t\t\t\tlow_method = optimal_method(r)\n\n\t\t\t\tother = r.other_town(current.id)\n\t\t\t\tif not @visited_ids.include?(other.id) then\n\t\t\t\t \tif @to_visit_ids.include?(other.id) then \n\t\t\t\t \t\toptimal = r \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tif @to_visit_ids.include?(other.id) then\n\t\t\t[optimal.other_town(current.id), optimal, low_method]\n\t\telse \n\t\t\tputs \"Journey broken\"\n\t\t\tnil\n\t\tend\n\tend",
"def last\n @features.sort.last\n end",
"def viewMap(address, to_lat, to_lng, callback)\n puts \"viewMap(address:#{address}, to_lat:#{to_lat}, to_lng:#{to_lng}, callback:#{callback}\"\n\n if GeoLocation.known_position?\n from_lat = GeoLocation.latitude\n from_lng = GeoLocation.longitude\n else\n from_lat = 34.3932857\n from_lng = 132.4705439\n from_lat = 34.4893270\n from_lng = 133.3614320\n from_lat = 35.005018\n from_lng = 135.889155\n end\n\n if callback\n #GeoLocation.set_notification(url_for(:action => :geo_callback), \"\")\n GeoLocation.set_notification(callback, \"\")\n end\n\n puts \"from:#{from_lat},#{from_lng} => to:#{to_lat},#{to_lng}\"\n puts \"distance: #{GeoLocation.haversine_distance(from_lat,from_lng,to_lat,to_lng)}\"\n\n #region = [@params['latitude'], @params['longitude'], 1/69.0, 1/69.0] #miles\n #region = [@params['latitude'], @params['longitude'], 1/111.0, 1/111.0] #km\n region = [(to_lat + from_lat) / 2, (to_lng + from_lng) / 2,\n (to_lat - from_lat).abs, (to_lng - from_lng).abs]\n\n url = \"http://maps.google.jp/maps/api/directions/json?\" +\n \"origin=#{from_lat},#{from_lng}&\" +\n \"destination=#{to_lat},#{to_lng}&\" +\n \"mode=walking&\" +\n \"language=ja&\" +\n \"sensor=true\"\n #puts url\n\n res2 = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res2.inspect\n #puts res2[\"status\"]\n\n# if res2[\"status\"] == \"ok\"\n# end\n\n myannotations = []\n\n #puts res2[\"body\"].inspect\n #puts res2[\"body\"][\"status\"]\n #puts res2[\"body\"][\"routes\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].size\n\n res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n #puts step.inspect\n\n title = step[\"html_instructions\"]\n title = title.gsub(/\\<\\/?[bB]\\>/, \"\")\n #puts title\n\n myannotations << {\n :latitude => step[\"start_location\"][\"lat\"],\n :longitude => step[\"start_location\"][\"lng\"],\n :title => title,\n :subtitle => step[\"distance\"][\"text\"],\n #:url => \"/app/GeoLocation/show?city=Original Location\",\n #:image => '/public/images/marker_blue.png', :image_x_offset => 8, :image_y_offset => 32\n }\n end\n\n myannotations << {\n :latitude => to_lat,\n :longitude => to_lng,\n :title => address,\n #:subtitle => @params['map']['address'],\n #:url => \"/app/GeoLocation/show?city=Original Location\"\n }\n\n map_params = {\n #:provider => \"Google\",\n :provider => \"ESRI\",\n :settings => {\n #:map_type => \"roadmap\",\n :map_type => \"standard\",\n :region => region,\n :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => true,\n #:api_key => '0jDNua8T4Teq0RHDk6_C708_Iiv45ys9ZL6bEhw'\n },\n :annotations => myannotations\n }\n\n #puts map_params.inspect\n puts \"-------------------------\"\n MapView.create map_params\n end",
"def next_clean_time(addr) \n #Figure out side of the street\n side = self.get_side(addr) \n \n #Find all blocks that match Street Address \n all_blocks = self.blocks\n blocks = all_blocks.where(\"side = ? AND bottom <= ? AND top >= ?\", side, addr, addr)\n if blocks == []\n return nil\n else \n #Compute the next cleaning times for the block and pick the smallest(i.e. the soonest) time\n cts = Array.new\n blocks.each{|x|cts << x.ct.next_time}\n best = cts.min\n return best, blocks[0].id\n end\n end",
"def get_road p0, p1\n if @road_hash[p0].nil? || @road_hash[p1].nil?\n raise \"Neither point specified has any roads\"\n elsif @road_hash[p0][p1].nil?\n raise \"The points specified do not define a road\"\n else\n @road_hash[p0][p1]\n end\n end",
"def last\n @features.last\n end",
"def maproutes(graph_instance)\n url ='http://www.gcmap.com/mapui?P='\n route_strings=''\n graph_instance.node_hash.each_key{ |key|\n linked = graph_instance.node_hash[key].linked_cities\n linked.each{ |tuple|\n route_strings = route_strings + \"#{key}-#{tuple.city},+\"\n }\n }\n Launchy.open(url+route_strings)\nend",
"def find_best_clusters(lat,long, catch_time, direction, week_day)\n temporal_delta = 600\n #max = Float::INFINITY\n max = BigDecimal::INFINITY\n near_stop = nil\n\n #Analisis geografico\n stops.where(:direction => direction).each_with_index do |stop, index|\n candidate = Bus.geographic_distance([stop.latitude, stop.longitude], [lat,long])\n if candidate < max\n near_stop = stop\n max = candidate\n end\n end\n\n #Analisis temporal, para el paradero seleccionado\n max_time = Float::INFINITY\n best_guess = nil\n near_stop.centroids.where(:direction => direction).each do |centroid|\n candidate = Bus.temporal_distance(centroid.catch_time, catch_time.to_i)\n if candidate < max_time and centroid.catch_time > catch_time.to_i\n best_guess = centroid\n max_time = candidate \n end\n end\n #se mapea la resta a todas las filas\n #time_data = time_data.map {|z| z - catch_time.to_i }\n\n #Donde la diferencia de tiempo sea mayor que 0 (no haya pasado aun) y sea mas grande de un minuto\n #time_data = time_data.sort.find{|x| x > 0 && x > 60 }\n\n #Si no encuentras recomendaciones, te pasaste del limite y te recomiendo la que pasa mas temprano\n if best_guess.nil? or best_guess.blank?\n best_guess = Sapeada.where(:stop_id => near_stop.id, :direction => direction, :bus_id => 1, :week_day => week_day).order(\"catch_time ASC\").first\n [near_stop.latitude, near_stop.longitude, best_guess.catch_time]\n else\n [near_stop.latitude, near_stop.longitude, best_guess.catch_time - catch_time.to_i]\n end\n end",
"def process_end()\n if self.parser.options[:list_activities]\n @sp.activity_map.keys.sort.each { |ak| self.output.printf(\"#-- Activity %s\\n\", ak) }\n end\n\n if self.parser.options[:map_activities]\n @sp.activity_map.keys.sort.each do |ak|\n self.output.printf(\"#-- Activity %s\\n\", ak)\n self.activities_map[ak].each do |url|\n self.output.printf(\"#-- Park %s\\n\", url)\n end\n end\n end\n\n super()\n end",
"def biggest_cities\n @game = Game.find( params[:id] )\n\n # if flag random is active load 10 Cities radomly\n if params[:random]\n @cities = @game.cities.random\n \n # else: just get the biggest 10 Cities \n else\n @cities = @game.cities.biggest\n end \n \n @map = @game.map\n end",
"def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n all_locations = Locations.all\n all_locations = all_locations.sort_by {|x| x.latitude}\n all_locations.each do |loc|\n if loc.latitude <= nelat && loc.latitude >= swlat && loc.longitude <= nelng && loc.longitude >= swlng\n if Following.find_by_follower_id_and_location_id(user_id, loc.id)\n @locations << {:id => loc.id, :name => loc.name, :latitude => loc.latitude, :longitude => loc.longitude, :follows => true }\n else\n @locations << {:id => loc.id, :name => loc.name, :latitude => loc.latitude, :longitude => loc.longitude, :follows => false }\n end\n end\n end\n # locations_following = Following.find_by_sql(\"SELECT f.location_id FROM following f WHERE f.follower_id = ?\", user_id)\n # locations_not_following = Locations.find_by_sql(\"SELECT l.location_id FROM locations l\")\n # while @locations.length <= 50\n # locations_following.each do |l1|\n # locations_following.each do |l_id|\n # l = Locations.find(:id => l_id)\n # if l1.latitude <= nelat and l1.latitude >= swlat and l1.longitude <= nelng and l1.longitude >= swlng\n # @locations << {:id => l1.id, :name => l1.name, :latitude => l1.latitude, :longitude => l1.longitude, :follows => true}\n # end\n # end\n # locations_not_following.each do |l2_id|\n # l2 = Locations.find(:id => l2_id)\n # if l2.latitude <= nelat and l2.latitude >= swlat and l2.longitude <= nelng and l2.longitude >= swlng\n # @locations << {:id => l.id, :name => l.name, :latitude => l.latitude, :longitude => l.longitude, :follows => false}\n # end\n # end\n # end\n end",
"def get_closer_zips\n response = RestClient.get \"https://www.zipcodeapi.com/rest/#{Rails.application.config.zip_code_key}/radius.json/#{self.zomato_postal_code}/15/mile\"\n if response.code == 200\n response = JSON.parse(response)\n closer_zips = []\n closer_zips_coords = []\n nearest_distance = 10\n\n Parallel.each(response['zip_codes'], in_threads: 8) { |zip_code|\n # Get the coordinates of each zip from Google Geocode API\n zip_coords = RestClient.get \"https://maps.googleapis.com/maps/api/geocode/json?&address=#{zip_code['zip_code']}&key=#{Rails.application.config.google_key}\"\n zip_coords = JSON.parse(zip_coords)\n if zip_coords['status'] == 'OK'\n # Get Distance from Google Distance Maps API\n distance = RestClient.get \"https://maps.googleapis.com/maps/api/distancematrix/json?origins=#{self.location_lat},#{self.location_lng}&destinations=#{zip_coords[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]},#{zip_coords[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]}&key=#{Rails.application.config.google_key}\"\n distance = JSON.parse(distance)\n if distance['status'] == 'OK' and distance['rows'][0]['elements'][0]['status'] == 'OK'\n distance = distance['rows'][0]['elements'][0]['distance']['value']*0.000621371\n if distance <= 5 and zip_code['zip_code'] != self.zomato_postal_code\n closer_zips.push zip_code['zip_code']\n closer_zips_coords.push \"#{zip_coords['results'][0]['geometry']['location']['lat']},#{zip_coords['results'][0]['geometry']['location']['lng']}\"\n if nearest_distance or nearest_distance > distance\n nearest_distance = distance\n self.nearest_zip = zip_code['zip_code'];\n self.nearest_zip_coords = \"#{zip_coords['results'][0]['geometry']['location']['lat']},#{zip_coords['results'][0]['geometry']['location']['lng']}\"\n end\n end\n end\n end\n }\n self.closer_zips = closer_zips.to_s\n self.closer_zips_coords = closer_zips_coords.to_s\n true\n end\n false\n end",
"def create_locations\n LOGGER.add 0, 'INFO: Beginning location generation'\n overpass = OverpassAPI.new(timeout: TIMEOUT, json: true)\n\n row = 0\n total = 0\n\n # rubocop:disable Metrics/BlockLength\n (GLOBAL_BOUNDARIES[:s]...GLOBAL_BOUNDARIES[:n]).step(STEP) do |ns|\n row += 1\n column = 0\n\n (GLOBAL_BOUNDARIES[:w]...GLOBAL_BOUNDARIES[:e]).step(STEP) do |ew|\n column += 1\n total += 1\n attempts = 0\n boundaries = { s: ns, n: ns + STEP, w: ew, e: ew + STEP }\n LOGGER.add 0, \"INFO: Beginning row #{row}, column #{column} (#{boundaries})\"\n\n begin\n attempts += 1\n overpass.query(query(boundaries)).slice_before { |result| result[:type] == 'node' }.each do |node_set|\n node_group = node_set.group_by { |item| item[:type] }\n\n streets = node_group['way']\n next if streets.blank?\n\n # We're only concerned with certain streets\n streets = streets.select { |way| way[:tags][:highway].present? }\n streets = streets.select { |way| way[:tags][:name].present? }\n streets = streets.select { |way| %w[footway cycleway path service track].exclude? way[:tags][:highway] }\n\n # Deduplicate names on four fields if they are present\n streets = streets.uniq { |way| strip_direction(way[:tags][:name]) }\n streets = streets.uniq { |way| strip_direction(way[:tags][:name_1]) || rand }\n streets = streets.uniq { |way| way[:tags][:'tiger:name_base'] || rand }\n streets = streets.uniq { |way| way[:tags][:'tiger:name_base_1'] || rand }\n\n streets = streets.map { |way| way[:tags][:name] }\n streets = streets.sort_by { |way| way.scan(/(?=\\d)/).length }.reverse\n\n node = node_group['node'].first\n next if node.blank?\n\n lat_lon_duplicate = Location.where(latitude: node[:lat], longitude: node[:lon]).first\n\n street_duplicate = Location.where(\n '(street1 = ? AND street2 = ?) OR (street2 = ? AND street1 = ?)',\n streets.first,\n streets.second,\n streets.first,\n streets.second,\n ).first\n\n if lat_lon_duplicate.present?\n LOGGER.add(\n 0,\n 'WARN: Found multiple street pairs at same lat/lon. '\\\n \"Found #{streets.first} & #{streets.last}, had #{street_duplicate}\",\n )\n elsif streets.try(:length) != 2\n LOGGER.add 0, \"WARN: Node didn't have 2 ways #{streets} (#{node[:lat]}, #{node[:lon]})\"\n elsif street_duplicate.present?\n LOGGER.add(\n 0,\n \"INFO: Adding #{humanize_street(streets.first)} & #{humanize_street(streets.second)} \"\\\n 'at midpoint & removed previous location',\n )\n Location.create!(\n latitude: (street_duplicate.latitude + node[:lat]) / 2,\n longitude: (street_duplicate.longitude + node[:lon]) / 2,\n active: false,\n street1: streets.first,\n street2: streets.second,\n name: \"#{humanize_street(streets.first)} & #{humanize_street(streets.second)}\",\n )\n street_duplicate.destroy!\n else\n LOGGER.add 0, \"INFO: Adding #{humanize_street(streets.first)} & #{humanize_street(streets.second)}\"\n Location.create!(\n latitude: node[:lat],\n longitude: node[:lon],\n active: false,\n street1: streets.first,\n street2: streets.second,\n name: \"#{humanize_street(streets.first)} & #{humanize_street(streets.second)}\",\n )\n end\n end\n rescue StandardError => e\n if attempts <= RETRIES\n LOGGER.add 0, \"WARN: Encountered error, retry #{attempts} of #{RETRIES}\"\n sleep(attempts < RETRIES ? PAUSE : TIMEOUT)\n retry\n else\n LOGGER.add 0, \"ERROR: #{e.message}\"\n end\n ensure\n sleep(PAUSE)\n end\n end\n # rubocop:enable Metrics/BlockLength\n end\n LOGGER.add 0, \"INFO: Total requests: #{total}\"\n end",
"def get_live_response(address_info)\n raise \"API key not specified.\\nCall AddressStandardization::GoogleMaps.api_key = '...' before you call .standardize().\" unless GoogleMaps.api_key\n \n address_info = address_info.stringify_keys\n \n address_str = [\n address_info[\"street\"],\n address_info[\"city\"],\n (address_info[\"state\"] || address_info[\"province\"]),\n address_info[\"zip\"]\n ].compact.join(\" \")\n url = \"http://maps.google.com/maps/geo?q=#{address_str.url_escape}&output=xml&key=#{GoogleMaps.api_key}&oe=utf-8\"\n AddressStandardization.debug \"[GoogleMaps] Hitting URL: #{url}\"\n uri = URI.parse(url)\n res = Net::HTTP.get_response(uri)\n return unless res.is_a?(Net::HTTPSuccess)\n \n content = res.body\n AddressStandardization.debug \"[GoogleMaps] Response body:\"\n AddressStandardization.debug \"--------------------------------------------------\"\n AddressStandardization.debug content\n AddressStandardization.debug \"--------------------------------------------------\"\n xml = Nokogiri::XML(content)\n xml.remove_namespaces! # good or bad? I say good.\n return unless xml.at(\"/kml/Response/Status/code\").inner_text == \"200\"\n \n addr = {}\n \n addr[:street] = get_inner_text(xml, '//ThoroughfareName').to_s\n addr[:city] = get_inner_text(xml, '//LocalityName').to_s\n addr[:province] = addr[:state] = get_inner_text(xml, '//AdministrativeAreaName').to_s\n addr[:zip] = addr[:postalcode] = get_inner_text(xml, '//PostalCodeNumber').to_s\n addr[:country] = get_inner_text(xml, '//CountryName').to_s\n \n return if addr[:street] =~ /^\\s*$/ or addr[:city] =~ /^\\s*$/\n \n Address.new(addr)\n end",
"def top_floor\n\t\t@flrs.last\n\tend",
"def get_last\n return nil if @head.nil?\n return get_last_helper(@head)\n end",
"def shore_acres_roads\n shore_acres_north = 40.95352042058797\n shore_acres_east = -73.71407747268677\n shore_acres_south = 40.94329381595473\n shore_acres_west = -73.73105049133301\n OverpassGraph.get_roads(shore_acres_north, shore_acres_east, shore_acres_south, shore_acres_west, [], [])\nend",
"def latest_ball_done(match)\n if match.blank? \n else\n over = latest_over(match)\n if Ball.where(over_id: over.id, match_id: match.id, done: true).any?\n ball = Ball.where(over_id: over.id, match_id: match.id, done: true).last\n return ball\n else\n Ball.where(over_id: over.id, match_id: match.id).last\n end\n end\n end",
"def last_point\n path_points.last\n end",
"def most_rebound(player_name)\r\n game_hash.each do |team, data|\r\n data.each do |team_info, value|\r\n if team_info == \"players\".to_sym\r\n value.each do |player, detail|\r\n if player == player_name\r\n return detail[:rebounds]\r\n end\r\n end\r\n end\r\n end\r\n end\r\nend",
"def address_correlate\n return nil unless (self.community.respond_to?(:launch_date) && Community.find_by_name(\"Lexington\").respond_to?(:launch_date))\n return nil if self.community.launch_date.to_date < Community.find_by_name(\"Lexington\").launch_date.to_date\n likeness = 0.94\n addr = []\n street = self.community.street_addresses\n street.each do |street_address|\n st_addr = street_address.address\n test = st_addr.jarowinkler_similar(address.split(\",\").first)\n if test > likeness\n likeness = test\n addr.clear\n addr << street_address\n elsif test == likeness\n addr << street_address\n end\n end\n\n if addr.empty?\n addr << create_st_address\n end\n\n addr.first\n end",
"def show\n set_delivery_truck\n @myVehicles = Vehicle.where(\"truck_id LIKE ?\", params[:id])\n @delivery_truck.update(occupied_slots: @myVehicles.length)\n @waypoints = Array.new\n @distances = Array.new\n @directions = Array.new\n @destination;\n\n @myVehicles.each do |vehicle|\n ##Include only one of each destination \n @waypoints.push(vehicle.origin)\n @waypoints.push(vehicle.destination)\n end\n if @waypoints.empty?\n else\n ###Find furthest point for destination\n @waypoints.each do |wp|\n @directions.push GoogleDirections.new(@delivery_truck.origin, wp)\n @distances.push (@directions.last.distance_in_miles)\n end\n if @directions.any?\n @destination = @waypoints[@distances.index(@distances.max)]\n end\n end\n\n end",
"def extract_link_map(next_link)\n webpage = MapBuilder.new(next_link, @domain_root.url)\n update_webcrawler(webpage) unless webpage == :error\n end",
"def invalid_latitude_roads\n north = 91\n east = -100\n south = 90\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend",
"def getEndPoint()\n geoObject().lastPoint() ;\n end",
"def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n validLocations = []\n\n validLocations = Location.where(\"latitude > ? AND latitude < ? AND longitude > ? AND longitude < ?\", swlat, nelat, swlng, nelng)\n validLocations = validLocations.sort_by { |k| k[\"latitude\"] }\n validLocations = validLocations[0..49]\n\n validLocations.each do|loc|\n @locations << loc.to_hash_with_follow(user_id)\n end\n\n end",
"def IsThereNewTrackers?(last_refresh, known_trackers, m_id, numMaxCoords, offset)\n trackers=[]\n attempts=Attempt.where(\"mission_id = ?\",m_id)\n #.order(tracker_id: :asc)\n # allTrackers=[]\n # attempts.each_cons(2) do |element, next_element|\n # if next_element.tracker_id != element.tracker_id\n # allTrackers.push(element.tracker_id.to_s)\n # end\n # allTrackers.push(element.tracker_id.to_s)\n # end\n # .where({ tracker_id: allTrackers})\n if (last_refresh != \"10000101\" && last_refresh != nil)#the map already contains coordinates\n datetime = last_refresh.to_datetime\n newCoords = (Coordinate.where(id: Coordinate.order(datetime: :desc).limit(numMaxCoords).where(\"datetime > ?\", datetime).where.not(tracker_id: known_trackers))).where(\"datetime > ?\", datetime).where.not(tracker_id: known_trackers).order(tracker_id: :asc)\n if (newCoords != [])\n newCoords.each_cons(2) do |element, next_element|\n if next_element.tracker_id != element.tracker_id\n if (attempts.find_by_tracker_id(element.tracker_id)!=nil) # && trackers.find(element.tracker_id.to_s) == nil)\n trackers.push(element.tracker_id.to_s)\n end\n end\n end\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n end\n return trackers\n else #the map does not have any coordinates\n if getMissionIds.size > 0 #if there is currently a mission\n if offset.to_i == 0\n start = Mission.find(m_id).start\n else\n start = (Time.now.utc-offset.to_f)\n end\n newCoords = (Coordinate.where(id: Coordinate.order(datetime: :desc).limit(numMaxCoords).where(\"datetime > ?\", start).where.not(tracker_id: known_trackers))).where(\"datetime > ?\", start).where.not(tracker_id: known_trackers).order(tracker_id: :asc)\n\n if (newCoords != [])\n \tif newCoords.size > 1\n\t\t newCoords.each_cons(2) do |element, next_element|\n\t\t if next_element.tracker_id != element.tracker_id\n if (attempts.find_by_tracker_id(element.tracker_id)!=nil) # && trackers.find(element.tracker_id.to_s) == nil)\n\t\t trackers.push(element.tracker_id.to_s)\n end\n\t\t end\n\t\t end\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n else\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n end\n end\n return trackers\n end\n end\n end",
"def geocode_best_possible\n\n return unless addressable_type == 'Company'\n\n # don't Geocode if we're doing development or testing AND\n # we already have lat and long and nothing has changed\n return if dev_or_test_and_have_geo_unchanged?\n\n specificity_order = address_array\n\n most_specific = 0\n least_specific = specificity_order.size - 1\n\n geo_result = nil\n\n until most_specific > least_specific || geo_result.present?\n geocode_address = specificity_order[most_specific..least_specific].compact.join(', ')\n geo_result = Geocoder.search(geocode_address)\n most_specific += 1\n end\n\n unless geo_result.nil?\n self.latitude = geo_result[0].latitude\n self.longitude = geo_result[0].longitude\n end\n\n end",
"def reverse_geocode_trip\n self.departure_location_address ||= Geocoder.search([departure_location_latitude, departure_location_longitude]).first.address\n self.arrival_location_address ||= Geocoder.search([arrival_location_latitude, arrival_location_longitude]).first.address\n end",
"def highest_train_at_stop?(this_route, stop)\n max = 0\n max_route = nil\n this_route.routes.each do |r|\n if r.visited_stops.map(&:hex).include?(stop.hex) && !diesel?(r.train) && r.train.distance > max\n max = r.train.distance\n max_route = r\n end\n end\n max_route == this_route\n end",
"def optimize_for_location(params)\n flight_floor = params[:flight_floor] || 5000 #meters\n flight_ceiling = params[:flight_ceiling] || 60000 #meters\n\n #verify parameters\n params = params.with_indifferent_access\n\n raise 'No start altitude (params[:start][:altitude])' unless params[:start][:altitude].present?\n raise 'No start latitude (params[:start][:lat])' unless params[:start][:lat].present?\n raise 'No start longitude (params[:start][:lon])' unless params[:start][:lon].present?\n raise 'No start time (params[:start][:time])' unless params[:start][:time].present?\n\n raise 'No finish latitude (params[:finish][:lat])' unless params[:finish][:lat].present?\n raise 'No finish longitude (params[:finish][:lon])' unless params[:finish][:lon].present?\n\n # creates a filter lambda to check that any path passes certain conditions\n filter = lambda {|node, previous|\n node.altitude < flight_ceiling &&\n node.altitude > flight_floor &&\n # (!x || y) checks y only if x is true\n (!params[:use_faa] || node.faa_zones_approx(previous)) && #no restricted zones\n (!params[:check_countries] || node.countries(previous))\n }\n\n #run the search with the provided start, duration, and performance factor\n greedy_search({\n start: Node.from_pos(\n params[:start][:lat].to_f, params[:start][:lon].to_f,\n params[:start][:altitude].to_f, params[:start][:time]\n ),\n finish: Node.from_pos(\n params[:finish][:lat].to_f, params[:finish][:lon].to_f,\n params[:start][:altitude].to_f, params[:start][:time]\n ),\n movement_cost: lambda {|current|\n #vent / ballast costs are proportional to the square of the altitude change\n (current.parent.altitude - current.altitude).abs/1200000.0\n },\n heuristic: lambda {|current|\n ((current.parent.lon - current.lon) / Prediction::time_variance)\n },\n neighbors: lambda {|current|\n current.neighbors(filter)\n },\n build_from_finish: lambda{|finish|\n finish.build_chain\n },\n timeout: params[:timeout],\n performance: params[:performance]\n })\n\n end",
"def fetch_locations\n log(' - Fetching location data (takes ~25s)...', false)\n results = {}\n ('a'..'z').to_a.each do |letter|\n response = get_response(\"http://www.railwaycodes.org.uk/stations/station#{letter}.shtm\")\n Nokogiri::HTML(response).xpath('//table/tr').each do |row|\n cols = row.xpath('./td').map(&:text)\n crs = row.xpath('./td').first.xpath('./a').first['name'].upcase rescue nil\n unless [crs, cols[6], cols[7]].include?(nil) || [crs, cols[6], cols[7]].include?('')\n results[crs] = { latitude: cols[7].to_f, longitude: cols[6].to_f }\n end\n end\n sleep(1) # be nice to railwaycodes.org.uk\n end\n log('DONE')\n results\nend",
"def last() end",
"def _search_first(accessToken, lat, lon)\n req = {\n 'AccessToken' => accessToken,\n 'IsLite' => true,\n 'MaxPerPage' => MAX_PER_PAGE,\n 'GeocachingLogCount' => 5,\n 'TrackableLogCount' => 0,\n 'PointRadius' => {\n 'DistanceInMeters' => \"#{SEARCH_DISTANCE}.000000\",\n 'Point' => {\n 'Latitude' => lat,\n 'Longitude' => lon\n }\n }\n }\n\n data = _post('/LiveV6IAP/Geocaching.svc/SearchForGeocaches', req)\n\n _check_result(data)\n _log_limit('lite', data)\n\n return data['Geocaches']\n end",
"def final_location\n\t\t@roo.location\n\tend",
"def big_shoe_rebounds\n\nhighest_rebounds = 0\nbiggest_shoe = 0\n\n game_hash.each do |location, team_info|\n game_hash.dig(location, :players).each do |player_name, stats|\n stats.each do |stat, number|\n if stat == :shoe\n if number > biggest_shoe\n biggest_shoe = number\n stats.each do |stat, number|\n if stat == :rebounds\n highest_rebounds = number\n end\n end\n end\n end\n end\n end\n end\n puts highest_rebounds\n return highest_rebounds\nend",
"def gather_target_sites(all_blast_results,gbff_dir,seq_dir,flanking_res)\n #step1 process blast_results into a hash function which includes the seq_id and an array of blast_items\n #blast_result_hash = blast_results_to_hash(all_blast_results)\n #step2 gather endo from gbff file\n process_all_db(all_blast_results,gbff_dir,seq_dir,flanking_res)\nend",
"def highway_structure_version_roadways\n typed_version = TransamAsset.get_typed_version(highway_structure_version)\n if state == 'final'\n if highway_structure_version.respond_to? :reify\n typed_version.roadways\n else\n time_of_finalization = versions.last.created_at\n results = typed_version.roadways.where('updated_at <= ?', time_of_finalization).to_a\n\n typed_version.roadways.where('updated_at > ?', time_of_finalization).each do |roadway|\n ver = roadway.versions.where('created_at > ?', time_of_finalization).where.not(event: 'create').order(:created_at).first\n results << ver.reify if ver\n end\n return results\n end\n else\n return highway_structure.roadways\n end\n end",
"def find_journey(city1, city2, graph_instance)\n distance, previous = find_shortest_journey(city1, city2, graph_instance)\n puts \"Shortest distance is #{distance} with stopovers at\"\n c = city2\n while(true)\n if(c == city1)\n break\n end\n puts \"#{previous[c]}\"\n c = previous[c]\n end\nend",
"def highest_ranked_household_person_link\n HouseholdPersonLink.order_by_rank(household_person_links).first\n end",
"def getShortFlight(csa)\n number2 = 10000000\n @parse.map{ |airport| \n if( airport[\"name\"] == csa) \n airport[\"destinations\"].map do |element|\n number1 = element[\"distance\"]\n if(number1<number2)\n number2 = number1\n end\n end\n airport[\"destinations\"].map{ |dest| \n if(number2==dest[\"distance\"])\n puts \"The min distance is \" + number2.to_s + \" in the fligth between \"+ dest[\"ports\"].to_s\n end\n }\n end\n }\n end",
"def getHubCity()\n vertex = 0\n city = \"\"\n @parse.map{ |airport|\n if(airport[\"destinations\"].length > vertex)#if target has more vertex swap\n city = airport[\"name\"]\n vertex =airport[\"destinations\"].length\n end\n }\n \n puts \"The city with more connections is \" + city + \" with #{vertex}\"\n end",
"def find_best_location(asteroids)\n\tresults = Hash.new\n\tbest = nil\n\tmax = 0\n\tasteroids.each do |(x,y), item|\n\t\tar = asteroid_relative(x,y,asteroids)\n\t\tresult = seen_i(ar)\n\t\tsize = result.size\n\t\tif size > max\n\t\t\tmax = size\n\t\t\tbest = [ x, y, result]\n\t\tend\n\tend\n\tremove_self(*best)\n\tbest\nend",
"def create_route(itinerary)\n locations = []\n # puts itinerary\n itinerary.each do |item|\n if item[:error] == nil\n locations << item[:route_coords]\n end\n end\n get_route(locations)\nend",
"def last_round\n rounds.first[:partidos].map(&method(:build_match))\n end",
"def get_known_orte_with_props\n orte = {}\n strecken = []\n # Transportabschnitte inklusive Beobachtungsorte und Strecke der Route\n transportabschnitte.each do |abschnitt|\n if abschnitt.route && abschnitt.route.name != \"Unbekannt\"\n strecken.concat(abschnitt.route.get_strecken)\n else\n if abschnitt.start_ort && abschnitt.end_ort && abschnitt.start_ort.lat && abschnitt.end_ort.lat\n strecken << [abschnitt.start_ort, abschnitt.end_ort] \n end\n end\n check_ort_p(orte, abschnitt.start_ort, \"Abschnitt\")\n check_ort_p(orte, abschnitt.end_ort, \"Abschnitt\")\n abschnitt.beobachtungen.each do |beob|\n check_ort_p(orte, beob.ort, \"Beobachtung\")\n end\n end\n # Umschlaege\n umschlaege.each do |umschlag|\n check_ort_p(orte, umschlag.ort, \"Umschlag\")\n end\n # Start und Zielanlage zuletzt, damit auf jeden Fall das aktuellste, andere werden ggf. ueberschrieben\n check_ort_p(orte, start_anlage.ort, \"Start-Anlage\")\n check_ort_p(orte, ziel_anlage.ort, \"Ziel-Anlage\")\n if strecken.empty? \n if umschlaege.empty? && start_anlage.ort && ziel_anlage.ort && start_anlage.ort.lat && ziel_anlage.ort.lat\n strecken << [start_anlage.ort, ziel_anlage.ort] \n elsif start_anlage.ort && start_anlage.ort.lat\n ort_aktuell = start_anlage.ort\n umschlaege.each do |umschlag|\n if umschlag.ort\n strecken << [ort_aktuell, umschlag.ort]\n ort_aktuell = umschlag.ort\n end\n end\n if ziel_anlage.ort && ziel_anlage.ort.lat\n strecken << [ort_aktuell, ziel_anlage.ort]\n end\n end\n end\n return orte, strecken\n end",
"def results\n @results ||= perform_reverse_geocode\n end",
"def divide_roads_into_points(distance)\n\n @road_points = Hash.new()\n\n @shapefile.each do |linestrings|\n\n if linestrings.attributes.keys().include?(@id_field) == false\n raise \"Attribute #{@id_field} is not present in the file. Kindly pass the name of the unique field in RoadRoller.new(filename, id_field).\"\n end\n\n linestrings.geometry.each do |linestring|\n\n linestring_points = divide_linestring_into_points(linestring, distance)\n\n @road_points[linestrings.attributes[@id_field]] = linestring_points\n end\n end\n\n puts \"road_points length = #{@road_points.length}\"\n return @road_points\n end",
"def bike_on_road(road)\n \n @destinations_left_behind += missed_destinations(road)\n puts \"missed destinations:\", @destinations_left_behind\n destination_city = road.the_city_opposite(@current_city)\n\n # we have arrived at the city now\n @current_city = destination_city\n\n @visited_cities << @current_city\n\n end",
"def big_shoe_rebounds_2\n\nhighest_rebounds = 0\nbiggest_shoe = 0\n\n\n game_hash.dig(:home, :players).each do |player_name, stats|\n stats.each do |stat, number|\n if stat == :shoe\n if number > biggest_shoe\n biggest_shoe = number\n stats.each do |stat, number|\n if stat == :rebounds\n highest_rebounds = number\n\n end\n end\n end\n end\n end\nend\n\n puts highest_rebounds\n return highest_rebounds\nend",
"def best_laps\n best_laps = []\n RACER_RECORDS.each {|racer| best_laps << [ racer.piloto, racer.best_lap ]}\n @view.display_best_laps(best_laps)\n end",
"def getLastPoint myhash\n\t\t\t#sort the hash and get the x values\n\t\t\tdummy = myhash.keys.sort\n\t\t\t#save the x value of the last point \n\t\t\txval = dummy.last\n\t\t\t#get the y value of the last point\n\t\t\tyval = myhash[xval]\n\t\t\treturn [xval, yval]\n\tend",
"def next_distances(save = true) ; next_task(@@DISTANCE_TASKS, save) ; end",
"def last; end",
"def last; end",
"def last; end",
"def get_last_server\n return get_server_by_algorithm { |l| l.last }\n end",
"def calculate_max_point(r, bots)\n x0, y0, z0, x1, y1, z1 = r.all_points\n\n max_seen = 0\n max_coord = [nil, nil, nil]\n\n x0.upto(x1) do |x|\n y0.upto(y1) do |y|\n z0.upto(z1) do |z|\n num = points_in_range(bots, x, y, z)\n #$POINTS_CALCULATED_DIRECTLY += 1\n if num > max_seen\n max_seen = num\n max_coord = [x, y, z]\n end\n end\n end\n end\n [max_seen, max_coord]\nend",
"def load_coarse_info\n @zip_code = @location[:zipCode] unless @location[:zipCode].nil?\n @city = @location[:city] unless @location[:city].nil?\n return if @location[:postalAddress].nil?\n @postal_address = @location[:postalAddress]\n end",
"def latest_pipelines(project_id)\n last_20_pipelines(project_id).each_with_object({}) do |pipeline, all_latest_pipelines|\n branch = pipeline['ref']\n all_latest_pipelines[branch] = pipeline if all_latest_pipelines[branch].nil?\n end\nend",
"def hop_on_hop_off\n if params[:route_id].present? && params[:type] == \"From\"\n @current_route = MainRoute.find_by_id(params[:route_id]) \n #@cities=(MainRoute.joins(:line_color_routes).joins('LEFT OUTER JOIN \"city_routes\" ON \"city_routes\".\"line_color_route_id\" = \"line_color_routes\".\"id\" LEFT OUTER JOIN \"cities\" ON \"cities\".\"id\" = \"city_routes\".\"city_id\"').select(\"main_routes.id\",\"main_routes.name\",\"cities.name as city_name\",\"cities.id as city_id\").where(:main_routes => {id: @current_route.id}).distinct.pluck(\"cities.id,cities.name\") + City.where(name: MainRoute.find_by_id(@current_route.id).start_point.downcase!).pluck(:id,:name)).sort{|a,b| a[1] <=> b[1]}\n city = []\n @current_route.line_color_routes.each do |a|\n a.city_routes.pluck(:city_id).each do |b|\n city << b\n end\n end\n @cities = City.where(id: city.uniq).pluck(:id,:name)\n\n \n\n #@cities = []\n @cities.each do |city| \n city[1] = city[1].titleize if city.present?\n\n end\n\n\n\n\n end \n if params[:route_id].present? && params[:type] == \"To\"\n #@city= City.find_by_id(params[:city_id])\n # @cities = City.where(name: Bus.where(start_point: @city.name).pluck(:end_point)).pluck(:id,:name) \n #@cities = (City.where(name: Bus.where(start_point: @city.name).pluck(:end_point)).pluck(:id,:name)).sort{|a,b| a[1] <=> b[1]}\n \n\n #my code starts here...\n\n @current_route = MainRoute.find_by_id(params[:route_id]) \n cit = []\n @current_route.line_color_routes.each do |a|\n a.city_routes.pluck(:city_id).each do |b|\n cit << b\n end\n end\n arr = cit.uniq\n arr.delete(params[:city_id].to_i)\n # p \"------#{arr}--#{params[:city_id].to_i}-------\"\n @cities = City.where(id: arr).pluck(:id,:name)\n @cities.each do |city| \n city[1] = city[1].titleize if city.present?\n\n end\n end \n respond_to do |format|\n format.html \n format.json { render :json => {:cities=>@cities } }\n end\n end",
"def biggest_area\n max_post = 0\n max_post = $postings.max {|a,b| a[1][/\\d+(?=ft)/].to_i <=> b[1][/\\d+(?=ft)/].to_i}\n max_area = max_post[1][/\\d+(?=ft)/].to_i\n max_ads = $postings.select{|p| p[1][/\\d+(?=ft)/].to_i == max_area}\n list_apt(max_ads)\nend",
"def last_location\n if !current_user.stories.last.nil?\n current_user.stories.last.location\n else\n Location.new(latitude: 53.1235, longitude: 18.0084)\n end\n end",
"def refreshEtaForDiffPoints\n\n if routeId!=45 && routeId!=64 && routeId!=73\n return \"Invalid route id\"\n end\n etaResponse=EtaResponse.new\n route=Route.getRouteByRouteId routeType, routeId\n if trip==nil\n etaResponse.status=EtaResponse::NO_TRIP_ALLOCATED\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n return EtaResponse::NO_TRIP_ALLOCATED\n end\n\n lat, lng, updated=getCurrentGpsCoord\n currentTime=getCurrentTime\n\n #driver is not on the route\n if trip.startTime-currentTime > TIME_BEFORE_DRIVER_IS_EXPECTED\n #ava allocation has happened but trip has not started\n etaResponse.status=EtaResponse::TOO_SOON_TO_COMPUTE_ETA\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n return EtaResponse::TOO_SOON_TO_COMPUTE_ETA\n elsif trip.startTime-currentTime >0 && trip.startTime-currentTime<TIME_BEFORE_DRIVER_IS_EXPECTED\n\n lat, lng, updated=getCurrentGpsCoord\n\n if lat==nil || lng==nil\n etaResponse.status=EtaResponse::GPS_NOT_AVAILABLE\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n return etaResponse\n end\n\n pickUpPoints=route.getPickUpPoints\n\n etaPick=Hash.new\n\n totalPickUpPoints=pickUpPoints.length\n\n #check if driver has reached startPoint\n distanceFromStartPoint=LocationUtil.distance([lat, lng], [pickUpPoints[0].lat, pickUpPoints[0].lng])\n timeDeltaToStartTrip=0\n if distanceFromStartPoint>Route::THRESHOLD_DISTANCE_TO_CONSIDER\n direction=BingDirection.new [{\"lat\"=> lat, \"lng\" => lng}, pickUpPoints[0]], trip.startTime\n direction.execute\n timeDeltaToStartTrip=direction.duration_in_traffic\n end\n remark=\"\"\n if timeDeltaToStartTrip>15*60\n\n remark=\"Actual trip delta is \"+timeDeltaToStartTrip.to_s\n timeDeltaToStartTrip=0\n end\n pickPointsA=Array.new\n (0..totalPickUpPoints-1).each do |no|\n pickPointsA.push pickUpPoints[no]\n end\n (1..totalPickUpPoints-1).each do |no|\n\n direction=BingDirection.new pickPointsA, trip.startTime+timeDeltaToStartTrip\n direction.execute\n etaPick[pickUpPoints[totalPickUpPoints-no].id]=trip.startTime+timeDeltaToStartTrip+direction.duration_in_traffic\n pickPointsA.pop\n end\n etaPick[pickUpPoints[0].id]=trip.startTime+timeDeltaToStartTrip\n locationEta=Hash.new\n\n etaPick.each do |key, value|\n\n locationEta[key]=value\n TripEta.create(:driverid => driverId, :locationid => key, :eta => value, :routeid => routeId, :remarks => remark)\n\n end\n\n etaResponse.status=EtaResponse::SUCCESS\n etaResponse.locationEta =locationEta\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n\n\n elsif currentTime-trip.startTime<Route::THRESHOLD_TIME_FOR_ROUTE_END && trip.endTime==0\n\n\n currentPoint, distanceToPoint= self.getCurrentPositionWithinRoute #driver is in middle of a trip\n if distanceToPoint<Route::THRESHOLD_DISTANCE_TO_CONSIDER\n remark=\"\"\n lat, lng, updated=getCurrentGpsCoord\n if distanceToPoint>THRESHOLD_TO_CONSIDER_FOR_MAPPING_POINT\n remark=\"Cannot map driver to route\"\n else\n\n #sanitizing latitude longitude of drivers raw coordinates\n\n lat=currentPoint[\"lat\"]\n lng=currentPoint[\"lng\"]\n end\n\n\n\n driverLatLng=Hash.new\n driverLatLng[\"lat\"]=lat\n driverLatLng[\"lng\"]=lng\n\n pickUpPoints=route.getPickUpPoints\n\n pointCurrent, fromPick, fromPickPoint, toPick, toPickPoint=getPositionVehicleWithPickUpPoint\n startComputing=false\n startIndex=0\n if toPickPoint!=nil\n leftPickPoints=Array.new\n pickUpPoints.each do |pick|\n if pick.id==toPickPoint.id && !startComputing\n startComputing=true\n end\n if startComputing\n leftPickPoints.push pick\n else\n startIndex=startIndex+1\n end\n end\n locationEta=Hash.new\n totalPickUpPoints=pickUpPoints\n (0..totalPickUpPoints.length-1).each do |index|\n if index<startIndex\n locationEta[pickUpPoints[index].id]=-1\n else\n direction=BingDirection.new leftPickPoints.unshift(driverLatLng), getCurrentTime\n direction.execute\n locationEta[pickUpPoints[totalPickUpPoints.length-1-(index-startIndex)].id]=getCurrentTime+direction.duration_in_traffic\n leftPickPoints.pop\n end\n end\n etaResponse.status=EtaResponse::SUCCESS\n etaResponse.locationEta =locationEta\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n\n else\n if distanceToPoint>Route::THRESHOLD_DISTANCE_TO_CONSIDER\n\n RouteEtaStatus.create(:driverid => driverId, :routeid => routeId, :eta_status => EtaResponse::DRIVER_CANNOT_BE_TRACKED)\n etaResponse.status=EtaResponse::DRIVER_CANNOT_BE_TRACKED\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n else\n if fromPick!=nil\n RouteEtaStatus.create(:driverid => driverId, :routeid => routeId, :eta_status => TRIP_COMPLETED, :trip_id => trip.id)\n etaResponse.status=EtaResponse::TRIP_COMPLETED\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n else\n etaResponse.status=EtaResponse::UNKNOWN_ERROR\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n RouteEtaStatus.create(:driverid => driverId, :routeid => routeId, :eta_status => UNKNOWN_ERROR, :trip_id => trip.id)\n end\n end\n end\n else\n etaResponse.status=EtaResponse::DRIVER_CANNOT_BE_TRACKED\n\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n end\n\n else\n # last sessions trip\n\n etaResponse.status=EtaResponse::NO_TRIP_ALLOCATED\n Rails.cache.write EtaResponse.getCacheKeyForDriverId(driverId), etaResponse.to_json\n return etaResponse\n\n end\n\n\n end",
"def process\n unless @map.get(*@from)\n @result = { places: {}, costs: {} }\n return\n end\n init\n until @frontier.empty?\n current = @frontier.pop\n @map.neighbors(*current).each do |neighbor|\n register_place current, neighbor\n end\n end\n format_result\n end",
"def last_move; @last_move ||= match.moves.last; end",
"def neighborhood\n self.locations.first.neighborhood\n end",
"def test_sitemap_geos_and_queries\n geos = ['ca', 'co', 'il', 'ny']\n\n geos.each do |loc|\n # Step 1\n params = {\n 'g' => loc,\n 'h_geos' => 0,\n 'h_queries' => 0\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(0, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(0, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 2\n params = {\n 'g' => loc,\n 'h_geos' => 10,\n 'h_queries' => 30\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(10, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(30, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 3\n params = {\n 'g' => loc,\n 'h_geos' => 50,\n 'h_queries' => 100\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(50, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(100, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 4\n params = {\n 'g' => loc\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(50, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(50, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 5\n params = {\n 'g' => loc,\n 'h_geos' => 100,\n 'h_queries' => 1000\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(50, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(100, @parsed_response['Queries']['NumFound'], @parsed_response)\n end\n end",
"def empty_map\n @game = Game.find( params[:id] )\n \n # if flag random is active load 10 Cities radomly\n if params[:random]\n @cities = @game.cities.random\n \n # else: just get the biggest 10 Cities \n else\n @cities = @game.cities.biggest\n end \n @map = @game.map \n end",
"def onroad_state(statistics)\n distance_from_last_start = distance_from [statistics.last_start.latitude, statistics.last_start.longitude]\n duration_since_last_start = (time - statistics.last_start.time).to_i\n\n if ignition_is_off? && (distance_from_last_start >= 0.01 or duration_since_last_start > 300)\n on_stop(statistics, duration_since_last_start)\n else\n on_road(statistics)\n end \n end",
"def greedy_salesman (cities)\n path = []\n not_visited = cities\n path.push(not_visited.shift)\n loop do\n current = path.last\n # for testing, only prints if PRINT_STEPS is set to true at the top of the file\n puts \"current: \" + current.name + \" (\" + current.x.round(2).to_s + \",\" + current.y.round(2).to_s + \")\" if PRINT_STEPS\n next_city = nearest_possible_neighbor(current,not_visited)\n path.push(not_visited.delete(next_city))\n break if not_visited.empty?\n end\n path\nend",
"def longest_path_1(edges)\nend",
"def addWaypoints coordinates\n #First delete any existing waypoints\n Waypoint.delete waypoint_ids\n self.distance = 0\n self.height_gain = 0\n self.height_loss = 0\n parent = nil\n local_index = parent_index = 0\n lastPointDeleted = false #True if a point is deleted for being close to another existing point\n\n coordinates.split('</trkpt>').each_with_index do |coordinate|\n next if coordinate.index('lat=\"').nil? #Skip if entry does not contain coordinate data.\n lat_index = coordinate.index('lat=\"') + 'lat=\"'.length\n lat = coordinate[lat_index .. coordinate.index('\"', lat_index)-1]\n lat = lat.to_f\n lon_index = coordinate.index('lon=\"') + 'lon=\"'.length\n lon = coordinate[lon_index .. coordinate.index('\"', lon_index)-1]\n lon = lon.to_f\n height_index = coordinate.index('<ele>') + '<ele>'.length\n height = coordinate[height_index .. coordinate.index('</ele>', height_index)-1]\n height = height.to_f\n \n unless parent.nil? #Unless first waypoint then compute distance and elev change\n dist = parent.dist lat, lon\n\tnext if dist < 0.05 # Skip waypoint if less than 50m away from the parent waypoint.\n # Delete waypoint if less than 90m away from the grand parent waypoint\n\tgrand_parent = waypoints[parent.parent_index]\n if grand_parent.dist(lat,lon) < 0.07\n\t parent_index = grand_parent.local_index\n\t parent = grand_parent\n lastPointDeleted = true\n next\n end\n #Only delete additional waypoints if the previous waypoint was deleted.\n #This allows a duplicate point to exist for closing loops.\n if lastPointDeleted\n\t closeToAPreviousPoint = false\n\t (waypoints - [parent,grand_parent]).each do |waypoint|\n\t if waypoint.dist(lat,lon) < 0.5\n\t closeToAPreviousPoint = true\n\t parent_index = waypoint.local_index\n\t parent = waypoint\n\t lastPointDeleted = true\n\t break\n\t end\n\t end\n end\n\tnext if closeToAPreviousPoint # Want to filter out the return points. Only care about 1 way travel.\n lastPointDeleted = false\n\tself.distance += dist\n self.height_gain += height > parent.height ? (height - parent.height) : 0\n self.height_loss += height < parent.height ? (parent.height - height) : 0\n end\n\t\n parent = waypoints.build(:latitude => lat, :longitude => lon, :height => height, :local_index => local_index, :parent_index => parent_index, :distance => self.distance, :height_gain => self.height_gain, :height_loss => self.height_loss)\n parent_index = local_index\n local_index += 1\n end\n\n # Mark the first waypoint as the starting point.\n waypoints[0].title = \"Start point\" if waypoints.length > 0\n end",
"def max_flight_distance; end",
"def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n locs = Location.where(\"gps_lat >= ? AND gps_lat <= ? AND gps_long >= ? AND gps_long <= ?\", swlat, nelat, swlng, nelng).limit(50).order(\"gps_lat\")\n get_following_locations(user_id)\n following_loc_ids = []\n @following_locations.each do |f_loc|\n following_loc_ids << f_loc[:id]\n end\n\n locs.each do |loc|\n result = loc.to_hash\n if following_loc_ids.include?(loc.id)\n result[:follows] = true\n else\n result[:follows] = false\n end\n @locations << result\n end\n end",
"def latest_over(match_id)\n if match_id.blank? \n else\n Over.where(match_id: match_id).order( 'number DESC' ).first\n end\n end"
] |
[
"0.6195852",
"0.58092445",
"0.5718303",
"0.5710238",
"0.5674145",
"0.56470186",
"0.5635778",
"0.55787253",
"0.54382527",
"0.54308456",
"0.5414753",
"0.54028016",
"0.54028016",
"0.53753495",
"0.53672177",
"0.5356196",
"0.530149",
"0.5286058",
"0.525225",
"0.5235575",
"0.51976985",
"0.5197575",
"0.51883405",
"0.51869833",
"0.517991",
"0.5173883",
"0.5172966",
"0.51701343",
"0.5160615",
"0.5159139",
"0.51447266",
"0.5133039",
"0.51319265",
"0.5111706",
"0.51078457",
"0.5086644",
"0.50804484",
"0.5076415",
"0.50565743",
"0.5055924",
"0.5046854",
"0.5046366",
"0.50430626",
"0.5038079",
"0.50243366",
"0.49967727",
"0.4983157",
"0.4977029",
"0.49762574",
"0.4971145",
"0.49665248",
"0.49593318",
"0.49588317",
"0.49560782",
"0.4949473",
"0.49453554",
"0.4945223",
"0.49446487",
"0.49388915",
"0.4936733",
"0.49268007",
"0.49216443",
"0.49191895",
"0.49044672",
"0.490144",
"0.49003458",
"0.48999172",
"0.48855573",
"0.48854056",
"0.4877526",
"0.4861027",
"0.4856912",
"0.48451966",
"0.48439974",
"0.48355907",
"0.4832478",
"0.4824895",
"0.4824617",
"0.4824617",
"0.4824617",
"0.4817876",
"0.4814313",
"0.48120275",
"0.48110524",
"0.4808894",
"0.48081738",
"0.4807117",
"0.48038885",
"0.48026294",
"0.47992113",
"0.47958353",
"0.47939035",
"0.47922498",
"0.47895467",
"0.47850093",
"0.4784639",
"0.47836387",
"0.47754756",
"0.47737476",
"0.4768557"
] |
0.6390302
|
0
|
::: bp_class ::: 31/05/2012 ................................................................................................... Format and clean class strings
|
def bp_class class_param
class_param.blank? ? '' : class_param.strip().html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sanitize_class_name(name)\n name.gsub(/[^_0-9A-Za-z:]/, '')\n end",
"def safe_class_name()\n self.class.name.downcase.gsub(/[^\\d\\w]/, '_')\n end",
"def formatClass(theLines)\n\n\treplaceVoids(\t\ttheLines);\n\tspaceMethods(\t\ttheLines);\n\tindentMembers(\t\ttheLines);\n\talignParams(\t\ttheLines);\n\talignSpecifiers(\ttheLines);\n\nend",
"def cr_class_name(attr_name)\n instance_var = attr_name.gsub('/','_').downcase()\n instance_var.gsub!(' ','_')\n instance_var = instance_var.gsub('-','_')\n class_name = \"Cr\" + camelise(instance_var)\n return class_name\nend",
"def pretty_class_name\n return self.class.to_s.split(/(?=[A-Z])/).join(' ')\n end",
"def formatted_class_name(class_name)\n class_name = class_name.split(':')[-1]\n (class_name.gsub!(/(.)([A-Z])/, '\\1_\\2') || class_name).upcase\n end",
"def class_name\r\n r = \"\"\r\n up = true\r\n each_byte do |c|\r\n if c == 95\r\n if up\r\n r << \"::\"\r\n else\r\n up = true\r\n end\r\n else\r\n m = up ? :upcase : :to_s\r\n r << (c.chr.send(m))\r\n up = false\r\n end\r\n end\r\n r\r\n end",
"def to_class_name\n to_s.gsub('&', 'and').gsub(/[\\- ]/, '_').camelize(:upper)\n end",
"def strclass() @records.get_data(GRT_STRCLASS); end",
"def formatAPA\n \"Not format abstract class\"\n end",
"def class_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 1]\n end",
"def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end",
"def to_class_name\n parts = downcase.split('/')\n parts.each(&:capitalize!)\n parts.join('').gsub(%r{-}, '')\n end",
"def class_name; end",
"def class_name; end",
"def strclass_record() @records.get(GRT_STRCLASS); end",
"def class_name object\n return object.class.to_s.split(/(?=[A-Z])/).join(' ')\n end",
"def print_class(*) end",
"def human_name(klass = T.unsafe(nil)); end",
"def human_name(klass = T.unsafe(nil)); end",
"def class_to_filename (c)\n c.split(/::/).map {|i| i.gsub(/([A-Z])/, '_\\1').sub(/_/, '').downcase}.\n join('/')\nend",
"def to_s\n \"#{DbAgile::RubyTools::unqualified_class_name(self.class)}: #{name} #{definition.inspect}\"\n end",
"def base_filename; class_to_filename(name.gsub(/.*:/, '')); end",
"def class_titleize\n self.class.to_s.titleize\n end",
"def sanitize_model_class( model )\n model.name.split(\"::\").last\n end",
"def className _args\n \"className _args;\" \n end",
"def stripped_class_name\n name.demodulize\n end",
"def strclass=(val) @records.set(GRT_STRCLASS, val); end",
"def display_class_info\n end",
"def class_name()\n return self.id.downcase.gsub(/\\Ah?l_/i, \"\")\n end",
"def is_strclass?(); @type == GRT_STRCLASS; end",
"def class_name_for(object)\n object.name.split('.').first.downcase.tr('_', '-')\n end",
"def parse_classname(full_cname)\n names=full_cname.split(\"::\")\n return names[0..-2].join('::'), names[-1], names.join(\"/\") \n end",
"def css_class *a; CssString.new a.flatten.unshift(self).join '.' end",
"def class_name_id object\n return object.class.to_s.split(/(?=[A-Z])/).join('-').downcase\n end",
"def css_class value\n value.to_s.strip.downcase.gsub(' ','') # TODO update to strip out all non alphanumeric characters\n end",
"def display_name_for_class(klass)\n klass.gsub(/^(?:[A-Z]{2})?[A-Z]{3}/) { |match| match.last }.underscore.humanize\n end",
"def to_s\n \"#{DbAgile::RubyTools::unqualified_class_name(self.class)}: #{name}\"\n end",
"def to_class_name\n self.to_method_name.gsub(/\\/(.?)/) { \"#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def make_classy( line, file_identifier )\n\t\t# TODO: should add file name to end of class\n\t\tStayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|\n\t\t\tif line.include?( \"<#{ tag }\" ) && !line.include?( \"class=\" )\n\t\t\t\tline = line.gsub( \"<#{ tag }\", \"<#{ tag } class=\\\"#{ @prefix }#{ tag }_#{ file_identifier }\\\"\" )\n\t\t\tend\n\t\tend\n\t\treturn line\n\tend",
"def convert_class(klass)\n ::ActiveSupport::Inflector.underscore(klass.name).gsub(\"/\", \"_\")\n end",
"def extract_class(string)\n uncapitalize(string.split('::').last)\n end",
"def formatConstructor(theLines)\n\n\treplaceVoids(\t\ttheLines);\n\tspaceFirstComment(\ttheLines);\n\nend",
"def constantize(klass_string) \n BentoSearch::Util.constantize(klass_string) \n end",
"def class_to_str(obj)\n obj.class.to_s.downcase\n end",
"def full_class_name\n @class_names.join(\"::\")\n end",
"def field_class\n css = (options[:class]||\"\").split(' ')\n css << 'exergue' if exergue\n css << 'warning' if warning\n css.join(' ')\n end",
"def class_name_to_attribute_name(name)\r\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\r\n end",
"def class_name_to_attribute_name(name)\r\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\r\n end",
"def comp_class\n @xml += '<class> '\n while @i < @tokens.length\n case @tokens[@i].val\n when 'static', 'field'\n comp_class_var_dec\n next\n when 'constructor', 'function', 'method'\n comp_subroutine\n next\n else\n comp_line\n end\n end\n @xml += '</class> '\n @xml\n end",
"def class_name\n Jaspion::Kilza::Class.normalize(@original_name)\n end",
"def remove_name_classifications(proto_record)\n proto_record[:full_name] = proto_record[:full_name].sub(/\\s-\\s[A-Z\\s]*/, \"\")\n end",
"def full_name\n klass.name\n end",
"def file2klass(str)\n\t\t\tstr.split(\"/\").map {|c|\n\t\t\t\tc.split(/_/).collect {|i| i.capitalize }.join(\"\")\n\t\t\t}.join(\"::\")\n\t\tend",
"def format\n self.class.name.split('::').last.downcase.to_sym\n end",
"def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end",
"def remove_name_classifications(proto_record)\n proto_record[:full_name] = proto_record[:full_name].sub(/\\s-\\s[A-Z\\s]*/, '')\n end",
"def ruby_classname_to_java(class_name:)\r\n\r\n parts = class_name.to_s.split('::')\r\n packageless_class_name = parts.pop\r\n\r\n parts.map! do |package_part|\r\n package_part[0] = package_part[0].downcase\r\n package_part\r\n end\r\n\r\n parts << packageless_class_name\r\n parts.join('.')\r\n end",
"def class=(str)\n `this.__native__.className=str.__value__`\n return str\n end",
"def print_class\n\n puts \"* #{name.capitalize} *\".colorize(:light_green).bold.indent(10)\n puts\n puts short_description.to_s.colorize(:green).indent(10)\n puts\n stats.each_pair do |name, value|\n print \"| \".colorize(:green).indent(10)\n print \" #{name.capitalize} :\".colorize(:light_green)\n print \" #{value}\"\n print \" |\".colorize(:green)\n end\n puts\n puts\n\n end",
"def demodulize(class_name_in_module)\n class_name_in_module.to_s.gsub(/^.*::/, '')\n end",
"def class; end",
"def class; end",
"def class_name_to_attribute_name(name)\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\n end",
"def class_name_to_attribute_name(name)\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\n end",
"def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end",
"def base_class_name\n split('::').last\n end",
"def validate_class_names\n bpmn_xml.modularized_class_names.each do |class_name|\n validate_constant_name(class_name.demodulize, module_name)\n end\n puts set_color(\"External tasks with the same topic name as the BPMN id will be created.\", :bold)\n colorized_class_names = bpmn_xml.modularized_class_names.map! { |class_name| set_color class_name, :red }\n puts colorized_class_names.join(\"\\n\")\n end",
"def readable_klass(klass_name)\n\t\tklass_name.blank? ? '' : klass_name.underscore.humanize.titleize\n\tend",
"def definition\n \"class #{full_name}\"\n end",
"def to_s\n \"#<#{classname}>\"\n end",
"def class_info?; \"#{self.class.name}\" end",
"def capitalizeresource(resource)\n res = \"\"\n\n if resource[0] =~ /class/i\n res << \"Class[\"\n res << resource[1].split(/::/).map{|r| r.capitalize}.join(\"::\")\n res << \"]\"\n else\n res << resource[0].capitalize\n res << \"[\" << resource[1] << \"]\"\n end\n\n res\nend",
"def name_and_class\n [name, self['class']].compact.join('.')\n end",
"def demodulize(class_name_in_module)\n class_name_in_module.to_s.gsub(/^.*::/, '')\n end",
"def demodulize(class_name_in_module)\n class_name_in_module.to_s.gsub(/^.*::/, '')\n end",
"def to_s; \"#{self.class} #{super}\"; end",
"def check_class_name\n\t\tspecial = \"!?<>',?[]}{=-)(*&|^%$#`~{}/\\\\:;\"\n\t\tregex = /[#{special.gsub(/./){|char| \"\\\\#{char}\"}}]/\n\t\tif class_name =~ regex\n\t\t\treturn \"The file name cannot contain special characters\"\n\t\telsif class_name.include?(\"\\n\")\n\t\t\treturn \"The file name cannot contain line breaks\"\n\t\telsif class_name.include?(\" \") || class_name.include?(\"\\t\")\n\t\t\treturn \"The file name cannot contain white spaces\"\n\t\telsif class_name == \"\"\n\t\t\treturn \"The file name cannot be empty\"\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend",
"def underscore(class_name)\n class_name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def append_class_name(original_value, new_value)\n (original_value || \"\") << \" #{new_value}\"\n end",
"def to_s\n 'Example Class'\n end",
"def objective_class_name namespace_name\t\n\tif namespace_name.scan(/::/).count > 0\n\t\tnamespace_name.split(\"::\").map { |word|\n\t\t\tif word.scan(/[A-Z]/).count > 0\n\t\t\t\tword\n\t\t\telse\n\t\t\t\tword.capitalize\n\t\t\tend\n\t\t}.join\n\telsif namespace_name.scan(/_/).count > 0\n\t\tnamespace_name.split(\"_\").map { |w|\n\t\t\tw.capitalize\n\t\t}.join\n\telsif namespace_name[0].scan(/[A-Z]/).count > 0\n\t\tnamespace_name\n\telse\n\t\tnamespace_name.capitalize\n\tend\nend",
"def test_subclass_name\n bo1 = Pt::Boundary::MyA.new(\"\\n===\\n\")\n assert_equal \"Part::Boundary::MyA\", bo1.subclass_name\n assert_equal \"Boundary::MyA\", bo1.subclass_name(index_ini: 1)\n assert_equal \"MyA\", bo1.subclass_name(index_ini: 2)\n\n ss = PlainText::Part::Section::Subsection.new [\"abc\"]\n assert_equal \"Part::Section::Subsection\", ss.subclass_name\n assert_equal \"Section::Subsection\", ss.subclass_name(index_ini: 1)\n end",
"def pearified_classname\n self\n end",
"def defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z]/ \r\n script.close\r\n return $1.strip\r\n end\r\n end \r\n script.close \r\n \"\"\r\nend",
"def class_attributes; end",
"def construct_klass(name)\n name.to_s.split('_').map{|i|i.capitalize}.join\n end",
"def display_name\n class_name\n end",
"def class=(_arg0); end",
"def append_class(name); end",
"def append_class(name); end",
"def class_name_from_legacy_performable_method(payload_object)\n payload_object.object.split(LEGACY_DJ_FORMAT_DELIMITER)[1] || LEGACY_DJ_DEFAULT_CLASS\n end",
"def to_s\n \"#{self.class.name.demodulize}s\"\n end",
"def klass\n @properties.map { |symbol|\n symbol.to_s\n }.join(\" \") unless @properties.empty?\n end",
"def class() end",
"def downcased_class_name(obj)\n obj.class.to_s.downcase\n end",
"def css_class\n result = [self.project.try(:css_class), self.try(:format).try(:css_class)].join(' ')\n result = 'other' unless CSS_CLASSES.include?(result)\n result += ' invisible' unless self.is_visible\n result\n end",
"def to_s\n c = self.class.to_s\n super.sub(c, c + \"+Bondage\")\n end",
"def inspect_class_name\n s = \"#{element_type.to_s.scan(/Elem|Obj|V|E/).last}\"\n s = \"#{s}-#{function.name.split('::').last.sub(/Filter|Route$/, '')}\" if function\n s = \"#{s} #{ @info }\" if @info\n s\n end",
"def fix_format_string(fmt)\n\t\t\tfmt.gsub(\"__\",\"%s\").gsub(\"_\",\"%s\")\n\tend"
] |
[
"0.65835106",
"0.635127",
"0.62413734",
"0.62387645",
"0.6185513",
"0.613174",
"0.6123613",
"0.60226506",
"0.6001884",
"0.59962213",
"0.5991192",
"0.5987389",
"0.5956613",
"0.59025335",
"0.59025335",
"0.58830607",
"0.5874535",
"0.5852366",
"0.5786725",
"0.5786725",
"0.5760469",
"0.5740975",
"0.5736125",
"0.57318085",
"0.57316446",
"0.5720204",
"0.5711861",
"0.56989336",
"0.56800884",
"0.56732327",
"0.56683064",
"0.56330407",
"0.5611778",
"0.56066686",
"0.55821717",
"0.5575749",
"0.55648845",
"0.55632573",
"0.5552033",
"0.5548482",
"0.5538591",
"0.5535593",
"0.55204135",
"0.55091405",
"0.5504935",
"0.5487122",
"0.5483932",
"0.54738635",
"0.54738635",
"0.5457246",
"0.54551905",
"0.545089",
"0.5450856",
"0.5446522",
"0.54265374",
"0.5416728",
"0.541639",
"0.54101557",
"0.5407237",
"0.5404245",
"0.54004425",
"0.5399379",
"0.5399379",
"0.5397885",
"0.5397885",
"0.53860414",
"0.5376251",
"0.53738976",
"0.53665143",
"0.5363978",
"0.53601384",
"0.53596044",
"0.53576404",
"0.53571737",
"0.53470665",
"0.53470665",
"0.53338134",
"0.53281087",
"0.5326994",
"0.5320546",
"0.5319484",
"0.5319002",
"0.53157383",
"0.5308273",
"0.53025293",
"0.52950233",
"0.5286739",
"0.52849096",
"0.52771324",
"0.5269124",
"0.5269124",
"0.52672315",
"0.5265296",
"0.5264774",
"0.5259719",
"0.5256548",
"0.5255168",
"0.52496076",
"0.52472574",
"0.52448416"
] |
0.6800241
|
0
|
::: bp_html_print ::: 31/05/2012 ................................................................................................... Format and print final HTML code Supports: crude html code Returns: Safe html without spaces
|
def bp_html_print html
if html.blank?
out = 'The helper <b>bp_html_print</b> received <b>empty</b> or <b>null</b>.'
else
out = html.gsub(/ /, ' ')
out = out.gsub('id=""', '')
out = out.gsub('class=""', '')
out = out.gsub('style=""', '')
end
out.try(:html_safe)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lstrip_html\n return if self.blank?\n\n m = self.match(/\\A(\\s*?[^<]|(.*?)>\\s*[^<])/) #Find first printing character\n return self unless m\n \n ldr = m[0]\n ldr_last = ldr.slice(ldr.size-1, ldr.size)\n ldr = ldr.slice(0,ldr.size-1) # portion up to the first printing character\n bdy = ldr_last + m.post_match # portion following the first printing character\n \n cln_ldr = ldr.gsub(/<p/mi, \"<span\")\n cln_ldr = cln_ldr.gsub(/<\\/p/mi, \"</span\")\n cln_ldr = cln_ldr.gsub(/<br(.*?)>/mi, \"\")\n \n m = bdy.match(/(\\A.*?)<p/mi)\n if !m\n bdy = bdy.sub(/<\\/p/mi, \"</span\") # change first closing </p> from an open <p> remaining from ldr\n else\n l = m.post_match\n f_cln = m[0].gsub(/<\\/p/mi, \"</span\") # change any closing </p> from and open <p> remaining from ldr\n bdy = f_cln + l \n end\n return cln_ldr + bdy \n end",
"def com_quebra_html\n return self if self.blank?\n self.gsub(\"\\n\", '<br/>').gsub('\\n', '<br/>')\n end",
"def cut_htmlpage(title, form_name, form_action, script='', append_body='')\n html = %Q{\n <html>\n <head>\n <title>#{title}</title>\n <style type=\"text/css\">\n #{cut_htmlstylesheet}\n </style>\n <script language=\"JavaScript\">\n #{script}\n </script>\n </head>\n <body onload=\"javascript: loadScript();\">\n <form name=\"#{form_name}\" action=\"#{form_action}\" method=\"post\">\n #{cut_html}\n </form>\n #{append_body}\n </body>\n </html>\n }\n #return html\n return PrettyXML.pretty(html, 2)\n end",
"def html_string\n @html.join(\"\")\n end",
"def print_html(no_page = 0)\n @pages[no_page].print_html\n end",
"def show_html(out = nil)\n print out if out\n exit 205\n end",
"def safe(html = nil)\n output = html || raw\n output.respond_to?(:html_safe) ? output.html_safe : output\n end",
"def get_body_for_html_display\n text = self.body.strip\n text = CGI.escapeHTML(text)\n text = MySociety::Format.make_clickable(text, :contract => 1)\n text = text.gsub(/\\n/, '<br>')\n return text\n end",
"def escape_once(html); end",
"def as_text\n return self if self.blank?\n mytext = self.gsub(/<p>(.*?)<\\/p>/mi,'\\1'+\"\\n\\n\")\n mytext = mytext.gsub(/<br(.*?)>/mi,\"\\n\") \n mytext = mytext.gsub(/<p(.*?)>/mi,\"\\n\\n\") \n mytext = mytext.gsub(/<\\/p>/mi,\"\") \n mytext = mytext.gsub(/<div(.*?)>/mi, \"\")\n mytext = mytext.gsub(/<\\/div>/mi,\"\") \n # Go ahead and strip all the other html tags as well\n mytext = mytext.gsub(/<\\/?[^>]*>/, \"\")\n CGI.unescapeHTML(mytext).strip\n end",
"def html_safe\n self\n end",
"def escape_html(html)\n html.to_s.gsub(/&/n, '&').gsub(/\\\"/n, '"').gsub(/>/n, '>').gsub(/</n, '<').gsub(/\\//, '/')\n end",
"def simple_format(text, html_options={})\n # text = text.to_s.dup\n # text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n # text.gsub!(/\\n\\n+/, \"</p>\\n\\n<p>\") # 2+ newline -> paragraph\n # text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />' + \"\\n\") # 1 newline -> br\n # text.insert 0, \"<p>\"\n # text << \"</p>\"\n text\nend",
"def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html\n __html__.dup.scrub!(:escape).to_html\n end",
"def to_html\n @html ||= format_html\n end",
"def fix_html(ary)\n text = \"\"\n\n ary.each do |s|\n temp = s.gsub('<', '<').gsub('>', '>')\n temp = temp.gsub('&b', '<b>').gsub('&/b', '</b>')\n temp = temp.gsub('&i', '<i>').gsub('&/i', '</i>')\n\n text += \" #{temp}<br />\\n\"\n end\n\n return text\nend",
"def to_html\n str = self\n str.gsub!(/\\r/,'')\n str = str.split(\"\\n\\n\").collect { |p| \"<p>#{p}</p>\" }.join('')\n str.gsub(/\\n/,'<br />')\n return str\n end",
"def as_html_deprecated #use TextEncoder.convert_to_html instead.\n return self if self.blank?\n mytext = self\n #mytext = CGI.escapeHTML(mytext)\n mytext.gsub!(NpbConstants::URL_DETECTION){|web_link| %{ <a href=\"#{web_link.strip}\">#{web_link.strip}</a> }}\n #mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{\\1<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{#{$1}<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(/\\A +/) {|l_spaces| (\" \"*l_spaces.size)} \n mytext.gsub!(/\\n +/) {|l_spaces| (\"\\n\" + (\" \"*(l_spaces.size-1)))}\n mytext.gsub!(/\\n{2,}/,'</p><p>')\n mytext.gsub!(/(\\n)([^\\n])/, '<br/>\\2')\n mytext\n end",
"def html_markup_html(text); end",
"def html_postprocess(field,html)\n html\n end",
"def html=(b); end",
"def escape_html(str)\n\t\t\t#table = HTML_ESC # optimize\n\t\t\t#str.gsub(/[&\"<>]/) {|s| table[s] }\n\t\t\treturn str\n\t\tend",
"def better_format(text, html_options = {}, options = {})\n wrapper_tag = options.fetch(:wrapper_tag, :p)\n\n text = sanitize(text) if options.fetch(:sanitize, true)\n paragraphs = split_paragraphs(text)\n\n if paragraphs.empty?\n content_tag(wrapper_tag, nil, html_options)\n else\n paragraphs.map { |paragraph|\n # paragraph = \"<br />\" if paragraph.empty? || paragraph =~ /\\A\\s+\\z/ \n paragraph.gsub!(/(?:^\\s)|\\G\\s/m, \" \") if !(paragraph[0..4]==\"<pre>\" && paragraph[-6..-1]==\"</pre>\")\n content_tag(wrapper_tag, paragraph, html_options, options[:sanitize])\n }.join(\"\\n\\n\").html_safe\n end\n end",
"def dumpAsHTML\n\t\tvalue = dumpAsString\n\t\treturn CGI.escapeHTML(value)\n\tend",
"def to_html_msg(str)\n str.gsub!(\"<stdin>:\", \"\") # Output from the compiler\n str.gsub!(\"<\", \"<\")\n str.gsub!(\">\", \">\")\n str.gsub!(/[\\n|\\r\\n]/, '<br\\>') # Replace newlines with line breaks \n str\n end",
"def dumpAsHTML\n\t\treturn \"File is Binary: Not dumped here.\"\n\tend",
"def presentable_html(html)\n # sanitize edited, tags: %w(body p span a h1 h2 h3 h4 h5 h6 ul ol li) if work.file_content_html %> -->\n # doc = Nokogiri::HTML(html_junk)\n # body = doc.at_xpath(\"//body\")\n # body.css('*').remove_attr('class')\n # edited = body.to_html\n return raw html\n end",
"def simple_format(text, html_options={})\n start_tag = open_tag('p', html_options)\n text = text.to_s.dup\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, \"</p>\\n\\n#{start_tag}\") # 2+ newline -> paragraph\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.insert 0, start_tag\n text << \"</p>\"\n end",
"def dumpAsHTML\n\t\tmarkup = \"\"\n\t\t@LoadString.each_line do |line|\n\t\t\tmarkup += \"#{CGI.escapeHTML(line.chomp)}<br />\\n\"\n\t\tend\n\t\treturn markup\n\tend",
"def html_out(*args, &block)\n self.html_out_proc = block\n self.html_out_args = args\n end",
"def strip_tags(html); end",
"def strip_tags(html); end",
"def strip_tags(html); end",
"def sanitize_html(content)\n require 'cgi'\n CGI.escapeHTML(content)\n end",
"def wrap(html); end",
"def wrap(html); end",
"def to_html(rawtext)\n return \"\" if rawtext.nil?\n \n r = RedCloth.new h(rawtext)\n r.to_html \n end",
"def display(text, html_options = nil)\n if html_options\n html_options = html_options.stringify_keys\n tag_options = tag_options(html_options)\n else\n tag_options = nil\n end\n #sanitize(text).to_html.gsub(\"<p>\", \"<p#{tag_options}>\")\n markdown(sanitize(text.gsub(\"\\n\",\"<br/>\"))).gsub(\"<p>\", \"<p#{tag_options}>\")\n end",
"def escape_html(html)\n html.to_s.gsub(/[&\\\"<>\\/]/, ESCAPE_HTML)\n end",
"def old_simple_format(text, html_options={})\n start_tag = tag('p', html_options, true)\n text = text.to_s.dup\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, \"</p>\\n\\n#{start_tag}\") # 2+ newline -> paragraph\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.insert 0, start_tag\n text << \"</p>\"\n end",
"def html_markup_org(text); end",
"def simple_format_without_p(text, html_options={})\n #start_tag = tag('p', html_options, true)\n text = text.to_s.dup\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, '<br /><br />') # 2+ newline -> 2 br\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n \n return text\n end",
"def simple_format(text, html_options={})\n start_tag = tag('p', html_options.merge(:open => true))\n text = text.to_s.dup\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, \"</p>\\n\\n#{start_tag}\") # 2+ newline -> paragraph\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.insert 0, start_tag\n text << \"</p>\"\n end",
"def to_html\n map { |x| x.output(\"\") }.join\n end",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def to_html(options = T.unsafe(nil)); end",
"def to_html(options = T.unsafe(nil)); end",
"def plain_html\n self.class.to_html.to_html(text.dup)\n end",
"def escape_html_safe(html)\n html.html_safe? ? html : escape_html(html)\n end",
"def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end",
"def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end",
"def conv_html(txt)\n txt.\n gsub(/>/, '>').\n gsub(/</, '<').\n gsub(/"/, '\"').\n gsub(/&/, '&')\n \n end",
"def to_html\n self.load_page!\n self.parsed_page.to_xhtml indent: 3, indent_text: \" \"\n end",
"def to_html; end",
"def html_simple\n HtmlFormatter.new(self, options).to_s\n end",
"def htmlClean(html)\n html\nend",
"def _(data=\"\"); self.__ self.escape_html(data.to_s); end",
"def html(args)\n str = \"\"\n str << (@inden * level(args)) if pretty?(args)\n str << html_content\n str << @nl if pretty?(args)\n str\n end",
"def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end",
"def escape_html( string )\n\t\t\treturn \"nil\" if string.nil?\n\t\t\tstring = string.inspect unless string.is_a?( String )\n\t\t\tstring.\n\t\t\t\tgsub(/&/, '&').\n\t\t\t\tgsub(/</, '<').\n\t\t\t\tgsub(/>/, '>').\n\t\t\t\tgsub(/\\n/, '↵').\n\t\t\t\tgsub(/\\t/, '→')\n\t\tend",
"def escape_html( string )\n\t\t\treturn \"nil\" if string.nil?\n\t\t\tstring = string.inspect unless string.is_a?( String )\n\t\t\tstring.\n\t\t\t\tgsub(/&/, '&').\n\t\t\t\tgsub(/</, '<').\n\t\t\t\tgsub(/>/, '>').\n\t\t\t\tgsub(/\\n/, '↵').\n\t\t\t\tgsub(/\\t/, '→')\n\t\tend",
"def closing_html\n\t\t\"</body></html>\"\n\tend",
"def inner_html(*args); end",
"def inner_html(*args); end",
"def html?; end",
"def html?; end",
"def html?; end",
"def nice_html(indent=2)\n Nokogiri::HTML.fragment(self).to_xhtml(indent: indent)\n end",
"def strip_html(string=\"\")\n begin\n string = strip_tags(string)\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end",
"def inner_html(options = T.unsafe(nil)); end",
"def esc_html(text)\n \tsafe_text = wp_check_invalid_utf8(text)\n \tsafe_text = _wp_specialchars(safe_text, :ENT_QUOTES)\n \t# Filters a string cleaned and escaped for output in HTML.\n \tapply_filters('esc_html', safe_text, text)\n end",
"def sanitize_as_html!\n Engine.clean!(self)\n end",
"def sanitize_as_html!\n Engine.clean!(self)\n end",
"def strip_html_tags!\n @raw.gsub!(/<[^>]+?>/, ' ')\n end",
"def print_html(filename = @event.printed_name)\n confirm_filename(filename)\n filename << \"_html.txt\"\n File.open(filename, \"w+\") do |file|\n file.write EventPrinter::HTML::head(@event.printed_name)\n @list.map do |elt|\n file.write elt.html\n end\n file.write EventPrinter::HTML::foot\n end\n end",
"def to_html()\n @html ||= cmark(\"--to\", \"html\")\n @html\n end",
"def body_html\n white_list(RedCloth.new(self.body, [ :hard_breaks, :filter_html ]).to_html(:textile, :smilies)) if self.body\n end",
"def html_safe(phrase)\n return h(phrase).gsub(/'/,''').gsub(/\\r\\n/,\"<br/>\")\n end",
"def to_html\r\n html = ''\r\n text_runs.each { |text_run| html << text_run.to_html }\r\n styles = {}\r\n styles['font-size'] = \"#{font_size}pt\" unless font_size.nil?\r\n styles['text-align'] = @style.text_align unless @style.aligned_left?\r\n html_tag(:p, content: html, styles: styles)\r\n end",
"def html_open; \"<html>\"; end",
"def print_bbcode(no_page = 0)\n @pages[no_page].print_bbcode\n end",
"def html *args\n @html = true if args.size > 0\n @html\n end",
"def simple_format(text)\n text = html_escape(text.to_s.strip)\n text.gsub!(/ +\\n/, \"\\n\")\n text.gsub!(/\\n( +)/) {|s| \"\\n#{' ' * (s.length - 1)}\" }\n text.gsub!(/\\n/, \"<br>\")\n text\n end",
"def html\n @html ||= process_html!\n end",
"def escape_html(str, type = T.unsafe(nil)); end",
"def to_html\n end",
"def to_html(formatting, text)\n text\n end",
"def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&').gsub('<', '<').gsub('>', '>')\n \n # blockquote tag support\n s.gsub!(/\\n?<blockquote>\\n*(.+?)\\n*<\\/blockquote>/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('<(' + x + ')>(.+?)</('+x+')>',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/<a.+?href\\s*=\\s*['\"](.+?)[\"'].*?>(.+?)<\\/a>/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end",
"def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&').gsub('<', '<').gsub('>', '>')\n \n # blockquote tag support\n s.gsub!(/\\n?<blockquote>\\n*(.+?)\\n*<\\/blockquote>/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('<(' + x + ')>(.+?)</('+x+')>',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/<a.+?href\\s*=\\s*['\"](.+?)[\"'].*?>(.+?)<\\/a>/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end",
"def sanitize_html\n self.data = self.class.clean_html(self.data) unless self.data.nil?\n end",
"def write_html(indent,part)\n# \"<!-- #{indent} --> #{' '*(if indent<0 then 0 else indent end)}#{part}\\n\"\n \"#{' '*(if indent<0 then 0 else indent end)}#{part}\\n\"\n end",
"def add_html message\n # message.gsub(/</,HTML_LT).gsub(/>/,HTML_GT).gsub(/\\t/,HTML_TAB)\n message\n end"
] |
[
"0.67625797",
"0.6468834",
"0.64069545",
"0.6398988",
"0.6371578",
"0.63500065",
"0.6339608",
"0.6325233",
"0.6299458",
"0.62365186",
"0.62347203",
"0.6229011",
"0.6223172",
"0.62172127",
"0.6183147",
"0.6183147",
"0.6183147",
"0.6183147",
"0.61737597",
"0.6169585",
"0.61558765",
"0.6132887",
"0.61311066",
"0.6111003",
"0.6070853",
"0.60587364",
"0.605481",
"0.60352963",
"0.6030582",
"0.6020554",
"0.60204756",
"0.6017997",
"0.60162735",
"0.60034126",
"0.60005826",
"0.5989251",
"0.5989251",
"0.5989251",
"0.59859675",
"0.5972069",
"0.5972069",
"0.5962488",
"0.5958115",
"0.5954503",
"0.5948224",
"0.5944033",
"0.59412324",
"0.59331566",
"0.5929004",
"0.5926657",
"0.5926657",
"0.5926657",
"0.5926657",
"0.5924367",
"0.5924367",
"0.5922585",
"0.59159905",
"0.59031904",
"0.59031904",
"0.58884436",
"0.58847964",
"0.58765346",
"0.5872878",
"0.58696216",
"0.58560187",
"0.5846989",
"0.58420384",
"0.581819",
"0.581819",
"0.5816927",
"0.5811997",
"0.5811997",
"0.5800816",
"0.5800816",
"0.5800816",
"0.5791079",
"0.5790439",
"0.57868123",
"0.57792354",
"0.57692885",
"0.57692885",
"0.57666206",
"0.57603776",
"0.57513714",
"0.57386047",
"0.5728022",
"0.57274723",
"0.5711733",
"0.57018226",
"0.569806",
"0.56959957",
"0.56921166",
"0.5679272",
"0.56753373",
"0.56751525",
"0.5671513",
"0.5671513",
"0.5666341",
"0.5665008",
"0.56639445"
] |
0.82362944
|
0
|
::: bp_buttons ::: 18/03/2013 ................................................................................................... Creates a space for buttons
|
def bp_buttons(*args, &block)
if block_given?
options = args.first || {}
html_options = args.second
bp_buttons(capture(&block), options, html_options)
else
html_buttons = args.first
options = args.second || {}
options_hash = options
options_hash[:class] = options[:class].blank? ? 'bp-box-buttons' : bp_class("bp-box-buttons #{options[:class]}")
label = options[:label].blank? ? '' : content_tag(:div, bp_html_print(options[:label]), :class=>'label')
out = label
out += html_buttons
content_tag :div, bp_html_print(out), options_hash
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def buttons; end",
"def buttons(&block)\n content = @template.capture(self, &block)\n @template.concat '<div class=\"buttons\">'\n @template.concat content\n @template.concat '</div>'\n end",
"def how_to_create_buttons args\n # Define a button style\n args.state.button_style = { w: 82, h: 10, }\n\n # Render instructions\n args.state.button_message ||= \"Press a Button!\"\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 82,\n text: args.state.button_message,\n alignment_enum: 1)\n\n\n # Creates button one using a border and a label\n args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)\n args.nokia.borders << args.state.button_one_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_one_border.x + 2,\n y: args.state.button_one_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button One\")\n\n # Creates button two using a border and a label\n args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)\n\n args.nokia.borders << args.state.button_two_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_two_border.x + 2,\n y: args.state.button_two_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button Two\")\n\n # Initialize the state variable that tracks which button was clicked to \"\" (empty stringI\n args.state.last_button_clicked ||= \"--\"\n\n # If a click occurs, check to see if either button one, or button two was clicked\n # using the inside_rect? method of the mouse\n # set args.state.last_button_clicked accordingly\n if args.nokia.mouse_click\n if args.nokia.mouse_click.inside_rect? args.state.button_one_border\n args.state.last_button_clicked = \"One Clicked!\"\n elsif args.nokia.mouse_click.inside_rect? args.state.button_two_border\n args.state.last_button_clicked = \"Two Clicked!\"\n else\n args.state.last_button_clicked = \"--\"\n end\n end\n\n # Render the current value of args.state.last_button_clicked\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 5,\n text: args.state.last_button_clicked,\n alignment_enum: 1)\nend",
"def add_buttons\n @p_button = Chingu::Rect.new(510,5,20,20)\n Chingu::Text.create(:text=>\"p\",:x=>513,:y=>5,:factor_x =>1.5)\n @m_button = Chingu::Rect.new(540,5,20,20)\n Chingu::Text.create(:text=>\"m\",:x=>540,:y=>5,:factor_x =>1.5)\n @o_button = Chingu::Rect.new(570,5,20,20)\n Chingu::Text.create(:text=>\"o\",:x=>575,:y=>5,:factor_x =>1.5)\n @save_button = Chingu::Rect.new(5,5,45,20)\n Chingu::Text.create(:text=>\"save\",:x=>5,:y=>5,:factor_x =>1.5)\n @load_button = Chingu::Rect.new(60,5,45,20)\n Chingu::Text.create(:text=>\"load\",:x=>65,:y=>5,:factor_x =>1.5)\n end",
"def create_buttons\n @buttons = Array.new(@image_indexes.size) do |i|\n UI::PSDKMenuButton.new(@viewport, @image_indexes[i], i)\n end\n end",
"def create_buttons buttons, parent = nil\n\n buttons.each do |label, options|\n button = create_button(label)\n\n modifiers = options[:modifiers] || @accelerator_mods\n parent = options[:parent] || parent\n\n options[:keys].each do |key|\n\n key = Gdk::Keyval.from_name(key) if key.is_a? String\n\n button.add_accelerator(\n \"activate\", # event to call\n @accelerator_group, # accelerator group\n key, # Value of the key that will call this event\n modifiers, # any key modifiers (shift, ctrl, etc)\n @accelerator_flags # accelerator flags\n )\n end\n\n # if the parent exists, add this button to the parent\n parent.pack_start(button, true, true) unless !parent\n\n @buttons[label] = button\n end\n\n end",
"def create_action_buttons *labels\n @action_buttons = []\n _row = @height-3\n _col = (@width-(labels.count*8))/2\n _col = 5 if _col < 1\n\n labels.each_with_index do |l, ix|\n b = Button.new text: l, row: _row, col: _col\n _col += l.length+5\n @action_buttons << b\n @form.add_widget b\n b.command do\n @selected_index = ix\n throw(:close, ix)\n end\n end\n ## 2018-05-17 - associate RETURN ENTER key with first button (FIXME) should be Ok or Okay or user \n ## should have some say in this. Same for associating ESC with Cancel or Quit.\n @form.bind_key(10, \"Fire Ok button\") { @action_buttons.first.fire }\n end",
"def buttons attrs = {}, &block\n Tagz.tag :div, { :class => 'form-buttons' }.merge(attrs), &block\n end",
"def create_extra_buttons()\n Rectangle.new(x:5,y:50,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:16,y:66,width:18,height:9,color:\"#ff7eec\",z:1)\n Rectangle.new(x:5,y:100,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:14,y:110,width:21,height:25,color:'#808080',z:1)\n Rectangle.new(x:14,y:110,width:21,height:5,color:'blue',z:1)\n Rectangle.new(x:5,y:150,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:180,y2:180,y3:160,color:\"black\",z:1)\n Rectangle.new(x:5,y:200,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:210,y2:210,y3:230,color:\"black\",z:1)\nend",
"def _button_4_command(*args)\n\n end",
"def buttons(f, cf0925)\n # content_tag :div, class: 'form-inline' do\n [f.submit(\"Save\", class: \"btn btn-primary\"),\n f.button(\"Reset\", type: \"reset\", class: \"btn btn-primary\"),\n print_button(cf0925),\n home_button].join(\" \").html_safe\n # end\n end",
"def _recreate_buttons\n $log.debug \" inside recreate_buttons: #{@tabs.size} \"\n r = @row\n col = @col + 1\n @buttons ||= []\n if !@buttons.empty?\n @buttons.each {|e| @form.remove_widget(e) }\n end\n @buttons = []\n button_gap = 4\n # the next line necessitates a clear on the pad\n # button_gap = 1 if @tabs.size > 6 # quick dirty fix, we need something that checks fit\n # we may also need to truncate text to fit\n\n @buttonpad.wclear\n ## create a button for each tab\n $tabradio = Variable.new # so we know which is highlighted\n @tabs.each do |tab|\n text = tab.text\n $log.debug \" TABS EACH #{text} \"\n @buttons << RubyCurses::TabbedButton.new(@form) do\n variable $tabradio\n text text\n name text\n value text\n row r + 1\n col col\n end\n col += text.length + button_gap\n # if col exceeds pad_w then we need to expand pad\n # but here we don't know that a pad is being used\n $log.debug \" button col #{col} \" \n form = tab.form\n form.set_parent_buffer(@window) if form\n\n b = @buttons.last\n b.command(b) { \n $log.debug \" calling display form from button press #{b.name} #{b.state} \"\n # form.rep essentially sees that buttons get correct attributes\n # when triggering M-<char>. This button should get highlighted.\n tab.repaint\n button_form_repaint #( b.state == :HIGHLIGHTED )\n if @display_tab_on_traversal\n # set as old tab so ONLY on going down this becomes current_tab\n @old_tab = tab\n else\n # next line means next key is IMMED taken by the tab not main form\n @current_tab = tab\n end\n fire_event tab, tab.index, :OPEN\n }\n end\n @recreate_buttons = false\n # make the buttons visible now, not after next handle_key\n @form.repaint\n end",
"def apphelp_protected_buttons_to( *button_data )\n buttons = ''\n\n button_data.each do | data |\n next if ( data.nil? )\n\n action = data[ 0 ] # NB: This is the action the button will represent, not the current, user-requested action for the enclosing page.\n options_for_link = data[ 1 ] || {}\n options_for_url = data[ 2 ]\n\n case action_name.to_sym # NB: This is the current, user-requested action for the enclosing page, not the action the button will represent.\n when :new, :create, :edit, :update\n mapping_hash = @@apphelp_button_mappings[ :for_read_write_pages ]\n when :show, :index\n mapping_hash = @@apphelp_button_mappings[ :for_read_only_pages ]\n else\n mapping_hash = @@apphelp_button_mappings[ :for_general_use ]\n end\n\n mapping = mapping_hash[ action ] || @@apphelp_button_mappings[ :for_general_use ][ :default ]\n ctrl = options_for_link[ :controller ] || controller.class\n variant = options_for_link.delete( :variant ) || mapping[ :variant ]\n icon = options_for_link.delete( :icon ) || mapping[ :icon ]\n text = options_for_link.delete( :text ) || apphelp_heading( ctrl, action )\n\n options_for_link[ :class ] ||= \"#{ variant } round\"\n\n buttons += ' ' unless ( buttons.empty? )\n buttons += apphelp_protected_link_to(\n action,\n options_for_link,\n options_for_url\n ) do\n image_tag(\n \"icons/#{ icon }.png\",\n :alt => '' # Explicit empty ALT text => icon not important for screen reading\n ) << text\n end\n end\n\n return buttons\n end",
"def button_up(id)\n super(id)\n @buttons_up << id unless @buttons_up.include?(id)\n end",
"def btn_area_first\n\n\t\t@layer_btns = HBox.new( true, 0 )\n\t\t@layer_btns.set_size_request( 800 , 40 )\n\n\t\t@btn_sintrom = Button.new(\"Sintrom\")\n\t\t@btn_sintrom.set_size_request( 100, 40 )\n\t\t@btn_sintrom.signal_connect( \"clicked\" ) do\n\t\t\tmain_area_sintrom\n\t\tend\n\t\t@btn_agenda = Button.new(\"Agenda\")\n\t\t@btn_agenda.set_size_request( 100, 40 )\n\t\t@btn_agenda.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_bdays = Button.new(\"Cumpleaños\")\n\t\t@btn_bdays.set_size_request( 100, 40 )\n\t\t@btn_bdays.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_shifts = Button.new(\"Turnos\")\n\t\t@btn_shifts.set_size_request( 100, 40 )\n\t\t@btn_shifts.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_exit = Button.new(\"Exit\")\n\t\t@btn_exit.set_size_request( 100, 40 )\n\t\t@btn_exit.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\n\t\t@layer_btns.add( @btn_sintrom )\n\t\t@layer_btns.add( @btn_agenda )\n\t\t@layer_btns.add( @btn_bdays )\n\t\t@layer_btns.add( @btn_shifts )\n\t\t@layer_btns.add( @btn_exit )\n\n\t\t@layer_general.put( @layer_btns, 0, 760 )\n\n\tend",
"def _button_3_command(*args)\n\n end",
"def navbar_buttons param, buttons, args={}\n\t\t\ta = []\n\t\t\tbuttons.each do |b|\n\t\t\t\thtml = \"<a type='button' class='btn btn-default \"\n\t\t\t\tp = chk_qs(param,b) \n\t\t\t\thtml += \"active\" if (p || p.nil? && UI_DEFAULTS[param] == b) || args[:active]\n\t\t\t\thtml += \"' href='\"+ chg_qs(param, b) +\"'>\"+b+\"</a>\"\n\t\t\t\ta << html\n\t\t\tend\n\t\t\ta\n\t\tend",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w(vms instances images).include?(@display)\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n return tag(\"CloudTenant\") if params[:pressed] == 'cloud_tenant_tag'\n if params[:pressed].starts_with?(\"vm_\", # Handle buttons from sub-items screen\n \"miq_template_\",\n \"guest_\",\n \"image_\",\n \"instance_\")\n\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n process_vm_buttons(pfx)\n return if [\"#{pfx}_policy_sim\", \"#{pfx}_compare\", \"#{pfx}_tag\", \"#{pfx}_retire\",\n \"#{pfx}_protect\", \"#{pfx}_ownership\", \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show\n end\n elsif params[:pressed] == \"custom_button\"\n custom_buttons\n # custom button screen, so return, let custom_buttons method handle everything\n return\n end\n render_button_partial(pfx)\n end",
"def buttons(*args, &block)\n html_options = args.extract_options!\n html_options[:class] ||= \"buttons\"\n\n if block_given?\n field_set_and_list_wrapping(html_options, &block)\n else\n args = [:commit] if args.empty?\n contents = args.map { |button_name| send(:\"#{button_name}_button\") }\n field_set_and_list_wrapping(html_options, contents)\n end\n end",
"def _button_2_command(*args)\n\n end",
"def _button_2_command(*args)\n\n end",
"def multi_buttons\n box = JPanel.new\n\n new_button = JButton.new('New')\n new_button.add_action_listener do |e| \n @combo.editable = true\n @combo.editor.select_all\n @last_button_text = 'New'\n end\n box.add(new_button)\n\n copy_button = JButton.new('Copy')\n copy_button.add_action_listener do |e| \n copy = \"Copy of #{@combo.selected_item}\"\n @dialog_defaults[copy] = @dialog_defaults[@combo.selected_item].dup\n @combo.add_item(copy)\n @combo.selected_item = copy\n @combo.editable = true\n @combo.editor.select_all\n @last_button_text = 'Copy'\n end\n box.add(copy_button)\n\n delete_set = JButton.new('Delete')\n delete_set.add_action_listener {|e| delete_current_set}\n box.add(delete_set)\n box\n end",
"def button_contents\n return if helpers.controller.blacklight_config.bootstrap_version == 5\n\n tag.span '×'.html_safe, aria: { hidden: true }\n end",
"def form_buttons(**opt)\n opt.reverse_merge!('data-manifest': object.id)\n buttons = super\n buttons << submission_button(**opt)\n buttons << export_button(**opt)\n buttons << import_button(**opt)\n buttons << comm_status(**opt)\n block_given? ? yield(buttons) : buttons\n end",
"def new_button_prefab x, y, message\n w, h = 300, 50\n button = state.new_entity(:button_with_fade)\n button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders\n button.border = [x, y, w, h] # sets border definition\n button\n end",
"def tick_button_prefab button\n outputs.labels << button.label # outputs button's label and border\n outputs.borders << button.border\n\n if button_clicked? button # if button is clicked\n button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked\n end\n\n if button.clicked_at # if clicked_at has a frame value and is not nil\n # button is output; color changes and transparency changes for 0.25 seconds after click occurs\n outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,\n 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds\n end\n end",
"def createListTypeButtons\n @listTypeGroup = Qt::ButtonGroup.new\n allBtn = KDE::PushButton.new('All') do |w|\n w.objectName = 'switchButton'\n w.checkable = true\n w.autoExclusive = true\n connect(w, SIGNAL(:clicked), self, SLOT(:getList))\n end\n\n highlightsBtn = KDE::PushButton.new('Highlights') do |w|\n w.objectName = 'switchButton'\n w.setMinimumWidth(80)\n w.checkable = true\n w.autoExclusive = true\n connect(w, SIGNAL(:clicked), self, SLOT(:getList))\n end\n\n mostBtn = KDE::PushButton.new('Most Popular') do |w|\n w.objectName = 'switchButton'\n w.checkable = true\n w.autoExclusive = true\n connect(w, SIGNAL(:clicked), self, SLOT(:getList))\n end\n listTypeHLayout = Qt::HBoxLayout.new\n listTypeHLayout.addWidget(allBtn, 54) # 2nd parameter is stretch.\n listTypeHLayout.addWidget(highlightsBtn, 180)\n listTypeHLayout.addWidget(mostBtn,235)\n\n @listTypeGroup.addButton(allBtn, 0)\n @listTypeGroup.addButton(highlightsBtn, 1)\n @listTypeGroup.addButton(mostBtn, 2)\n @listTypeGroup.exclusive = true\n\n listTypeHLayout\n end",
"def all_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@menu_tag.find.div.className(\"mm-content-base\").find.a.className(\"mainButton\"), format_method(__method__))\n end",
"def button_elements(identifier)\n platform.buttons_for(identifier.clone)\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n\n params[:display] = @display if [\"instances\"].include?(@display) # Were we displaying vms/hosts/storages\n params[:page] = @current_page if @current_page.nil? # Save current page for list refresh\n\n if params[:pressed] == \"custom_button\"\n custom_buttons\n return\n end\n\n if params[:pressed].starts_with?(\"instance_\") # Handle buttons from sub-items screen\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n process_vm_buttons(pfx)\n\n # Control transferred to another screen, so return\n return if [\"#{pfx}_policy_sim\", \"#{pfx}_compare\", \"#{pfx}_tag\",\n \"#{pfx}_retire\", \"#{pfx}_protect\", \"#{pfx}_ownership\",\n \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show # Handle VMs buttons\n end\n elsif params[:pressed] == \"make_ot_orderable\"\n make_ot_orderable\n return\n elsif params[:pressed] == \"orchestration_template_copy\"\n orchestration_template_copy\n return\n elsif params[:pressed] == \"orchestration_templates_view\"\n orchestration_templates_view\n return\n else\n params[:page] = @current_page if @current_page.nil? # Save current page for list refresh\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n case params[:pressed]\n when \"orchestration_stack_delete\"\n orchestration_stack_delete\n when \"orchestration_stack_retire\"\n orchestration_stack_retire\n when \"orchestration_stack_retire_now\"\n orchestration_stack_retire_now\n return\n when \"orchestration_stack_tag\"\n tag(OrchestrationStack)\n when params[:pressed] == \"custom_button\"\n custom_buttons\n return\n end\n return if %w[orchestration_stack_retire orchestration_stack_tag].include?(params[:pressed]) &&\n @flash_array.nil? # Tag screen showing, so return\n end\n\n check_if_button_is_implemented\n\n if single_delete_test\n single_delete_redirect\n elsif params[:pressed].ends_with?(\"_edit\") || [\"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n render_or_redirect_partial(pfx)\n elsif @refresh_div == \"main_div\" && @lastaction == \"show_list\"\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n end",
"def all_topic_follow_unfollow_buttons\n @browser.buttons(:class => \"btn-default icon\")\n end",
"def add_button b\n return self unless b.is_a? MaterializeComponents::ButtonSkeleton\n @buttons << b\n @buttons.flatten!\n return self\n end",
"def agroup_components\n table = Gtk::Table.new(11,8)\n (0..8).each{|i|\n x = $glob.btns[i].x\n y = $glob.btns[i].y\n table.attach($glob.btns[i],(x*2)+1,(x*2)+2,(y*2)+1,(y*2)+2)\n }\n (0..3).each{|i|\n table.attach(Gtk::VSeparator.new,i*2,(i*2)+1,0,8)\n table.attach(Gtk::HSeparator.new,0,8,i*2,(i*2)+1) \n }\n table.attach(@new_btn,0,8,8,9) \n table.attach(@default_size_btn,0,8,9,10)\n table.attach(@quit_btn,0,8,10,11)\n self.add(table)\n end",
"def button(&button_proc)\n @buttons << button_proc\n end",
"def b(*args)\n JButton.new *args\n end",
"def create_color_buttons()\n Rectangle.new(x:5,y:450,width:45,height:45,color:'red',z:1)\n Rectangle.new(x:55,y:450,width:45,height:45,color:'orange',z:1)\n Rectangle.new(x:105,y:450,width:45,height:45,color:'yellow',z:1)\n Rectangle.new(x:155,y:450,width:45,height:45,color:'green',z:1)\n Rectangle.new(x:205,y:450,width:45,height:45,color:'blue',z:1)\n Rectangle.new(x:255,y:450,width:45,height:45,color:'#EE82EE',z:1)\n Rectangle.new(x:305,y:450,width:45,height:45,color:'black',z:1)\n Rectangle.new(x:355,y:450,width:45,height:45,color:'#808080',z:1)\n Rectangle.new(x:405,y:450,width:45,height:45,color:'white',z:1)\nend",
"def generateButtons\n @moves = @battler.moves\n @nummoves = 0\n @oldindex = -1\n @x = []; @y = []\n for i in 0...4\n @button[\"#{i}\"].dispose if @button[\"#{i}\"]\n @nummoves += 1 if @moves[i] && @moves[i].id\n @x.push(@viewport.width/2 + (i%2==0 ? -1 : 1)*(@viewport.width/2 + 99))\n @y.push(@viewport.height - 90 + (i/2)*44)\n end\n for i in 0...4\n @y[i] += 22 if @nummoves < 3\n end\n @button = {}\n for i in 0...@nummoves\n # get numeric values of required variables\n movedata = GameData::Move.get(@moves[i].id)\n category = movedata.physical? ? 0 : (movedata.special? ? 1 : 2)\n type = GameData::Type.get(movedata.type).id_number\n # create sprite\n @button[\"#{i}\"] = Sprite.new(@viewport)\n @button[\"#{i}\"].param = category\n @button[\"#{i}\"].z = 102\n @button[\"#{i}\"].bitmap = Bitmap.new(198*2, 74)\n @button[\"#{i}\"].bitmap.blt(0, 0, @buttonBitmap, Rect.new(0, type*74, 198, 74))\n @button[\"#{i}\"].bitmap.blt(198, 0, @buttonBitmap, Rect.new(198, type*74, 198, 74))\n @button[\"#{i}\"].bitmap.blt(65, 46, @catBitmap, Rect.new(0, category*22, 38, 22))\n @button[\"#{i}\"].bitmap.blt(3, 46, @typeBitmap, Rect.new(0, type*22, 72, 22))\n baseColor = @buttonBitmap.get_pixel(5, 32 + (type*74)).darken(0.4)\n pbSetSmallFont(@button[\"#{i}\"].bitmap)\n pbDrawOutlineText(@button[\"#{i}\"].bitmap, 198, 10, 196, 42,\"#{movedata.real_name}\", Color.white, baseColor, 1)\n pp = \"#{@moves[i].pp}/#{movedata.total_pp}\"\n pbDrawOutlineText(@button[\"#{i}\"].bitmap, 0, 48, 191, 26, pp, Color.white, baseColor, 2)\n pbSetSystemFont(@button[\"#{i}\"].bitmap)\n text = [[movedata.real_name, 99, 4, 2, baseColor, Color.new(0, 0, 0, 24)]]\n pbDrawTextPositions(@button[\"#{i}\"].bitmap, text)\n @button[\"#{i}\"].src_rect.set(198, 0, 198, 74)\n @button[\"#{i}\"].ox = @button[\"#{i}\"].src_rect.width/2\n @button[\"#{i}\"].x = @x[i]\n @button[\"#{i}\"].y = @y[i]\n end\n end",
"def render_buttons(doc, object)\n pid = doc['id']\n apo_pid = doc.apo_pid\n\n buttons = []\n if can?(:manage_content, object)\n buttons << {\n url: close_version_ui_item_path(pid),\n label: 'Close Version',\n check_url: workflow_service_closeable_path(pid)\n }\n\n buttons << {\n url: open_version_ui_item_path(pid),\n label: 'Open for modification',\n check_url: workflow_service_openable_path(pid)\n }\n end\n\n if can?(:manage_item, object)\n if object.is_a? Dor::AdminPolicyObject\n buttons << { url: edit_apo_path(pid), label: 'Edit APO', new_page: true }\n buttons << { url: new_apo_collection_path(apo_id: pid), label: 'Create Collection' }\n end\n\n buttons << {\n url: dor_reindex_path(pid: pid),\n label: 'Reindex',\n new_page: true\n }\n\n # note that the backend will also check can?(:manage_governing_apo, object, new_apo_id), but\n # we can't do that here, since we don't yet know what APO the user might move the object to.\n # so it's possible that the user will get this button even if there are no other APOs they're\n # allowed to move the object to.\n buttons << {\n url: set_governing_apo_ui_item_path(id: pid),\n label: 'Set governing APO',\n disabled: !object.allows_modification?\n }\n\n buttons << { url: new_item_workflow_path(item_id: pid), label: 'Add workflow' }\n\n buttons << {\n url: dor_path(pid: pid),\n label: 'Republish',\n check_url: workflow_service_published_path(pid),\n new_page: true\n }\n\n buttons << {\n url: purge_item_path(id: pid),\n label: 'Purge',\n new_page: true,\n confirm: 'This object will be permanently purged from DOR. This action cannot be undone. Are you sure?',\n disabled: !registered_only?(doc)\n }\n\n buttons << { url: source_id_ui_item_path(id: pid), label: 'Change source id' }\n buttons << { url: tags_ui_item_path(id: pid), label: 'Edit tags' }\n if [Dor::Item, Dor::Set].any? { |clazz| object.is_a? clazz } # these only apply for items, sets and collections\n buttons << { url: catkey_ui_item_path(id: pid), label: 'Manage catkey' }\n buttons << { url: collection_ui_item_path(id: pid), label: 'Edit collections' }\n end\n if object.datastreams.include? 'contentMetadata'\n buttons << { url: item_content_type_path(item_id: pid), label: 'Set content type' }\n end\n if object.datastreams.include? 'rightsMetadata'\n buttons << { url: rights_item_path(id: pid), label: 'Set rights' }\n end\n if object.datastreams.include?('identityMetadata') && object.identityMetadata.otherId('catkey').present? # indicates there's a symphony record\n buttons << { url: refresh_metadata_item_path(id: pid), label: 'Refresh descMetadata', new_page: true, disabled: !object.allows_modification? }\n end\n buttons << { url: manage_release_solr_document_path(pid), label: 'Manage release' }\n\n # TODO: add a date picker and button to change the embargo date for those who should be able to.\n buttons << { label: 'Update embargo', url: embargo_form_item_path(pid) } if object.is_a?(Dor::Item) && object.embargoed?\n\n end\n\n buttons\n end",
"def buttons(buttonArray, default = true)\n return if (buttonArray = filterList(buttonArray)).empty? || !@buttonList.empty?\n theButton = nil\n buttonArray.reverse.each do |aButton| # buttons added right-to-left, top-to-bottom\n destructive = aButton.chomp! # newline?\n theButton = @alert.addButtonWithTitle(aButton)\n theButton.hasDestructiveAction = true if !destructive.nil? && theButton.respondsToSelector(\"hasDestructiveAction\")\n @buttonList << aButton\n unless default == true # normal focus, default index as specified\n theButton.keyEquivalent = '' unless aButton == 'Cancel'\n theButton.keyEquivalent = \"\\r\" if default == @buttonList.count - 1\n end\n end\n @alert.window.initialFirstResponder = theButton unless @buttonList.empty? # last one\n @buttonList\n end",
"def hc_modal_button\n @hc_modal_button ||= button(\n :frame => [264, 12, 100, 28],\n :bezel => :textured_square, \n :layout => {:start => false})\n end",
"def create_back_button(x, y)\n\t\tbutton = Button.new(@window, \n\t\t\t\t\t\t\t@window.user_messages.message(:back), \n\t\t\t\t\t\t\tConstants::BT_TEXT_HEIGHT,\n\t\t\t\t\t\t\tConstants::FONT_NAME)\n\t\tbutton.add_callback(:release, lambda {@main.current_menu = @parent})\n\t\tbutton.x = x\n\t\tbutton.y = y\n\t\tbutton\n\tend",
"def textile_editor_button(text, options={})\n return textile_editor_button_separator if text == :separator\n button = content_tag(:button, text, options)\n button = \"TextileEditor.buttons.push(\\\"%s\\\");\" % escape_javascript(button)\n (@textile_editor_buttons ||= []) << button\n end",
"def init_vars\n self.resize(200,250)\n @new_btn = Gtk::Button.new('')\n @default_size_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n end",
"def generate_buttons(buttons:)\n fb_buttons = buttons.collect do |button|\n case button['type']\n when 'url'\n _button = {\n \"type\" => \"web_url\",\n \"url\" => button[\"url\"],\n \"title\" => button[\"text\"]\n }\n\n if button[\"webview_height\"].present?\n _button[\"webview_height_ratio\"] = button[\"webview_height\"]\n end\n\n if button['messenger_extensions'].present?\n _button['messenger_extensions'] = true\n end\n\n _button\n\n when 'payload'\n _button = {\n \"type\" => \"postback\",\n \"payload\" => button[\"payload\"],\n \"title\" => button[\"text\"]\n }\n\n when 'call'\n _button = {\n \"type\" => \"phone_number\",\n \"payload\" => button[\"phone_number\"],\n \"title\" => button[\"text\"]\n }\n\n when 'login'\n _button = {\n \"type\" => \"account_link\",\n \"url\" => button[\"url\"]\n }\n\n when 'logout'\n _button = {\n \"type\" => \"account_unlink\"\n }\n\n when 'nested'\n _button = {\n \"type\" => \"nested\",\n \"title\" => button[\"text\"],\n \"call_to_actions\" => generate_buttons(buttons: button[\"buttons\"])\n }\n\n else\n raise(Stealth::Errors::ServiceImpaired, \"Sorry, we don't yet support #{button[\"type\"]} buttons yet!\")\n end\n\n _button\n end\n\n fb_buttons\n end",
"def additional_action_buttons\n nil\n end",
"def toolbar_button(options = {})\n options.symbolize_keys!\n defaults = {\n :overlay => true,\n :skip_permission_check => false,\n :active => false,\n :link_options => {},\n :overlay_options => {},\n :loading_indicator => true\n }\n options = defaults.merge(options)\n button = content_tag('div', :class => 'button_with_label' + (options[:active] ? ' active' : '')) do\n link = if options[:overlay]\n link_to_overlay_window(\n render_icon(options[:icon]),\n options[:url],\n options[:overlay_options],\n {\n :class => 'icon_button',\n :title => options[:title],\n 'data-alchemy-hotkey' => options[:hotkey]\n }.merge(options[:link_options])\n )\n else\n link_to options[:url], {:class => (\"icon_button#{options[:loading_indicator] ? ' please_wait' : nil}\"), :title => options[:title], 'data-alchemy-hotkey' => options[:hotkey]}.merge(options[:link_options]) do\n render_icon(options[:icon])\n end\n end\n link += content_tag('label', options[:label])\n end\n if options[:skip_permission_check]\n return button\n else\n if options[:if_permitted_to].blank?\n action_controller = options[:url].gsub(/^\\//, '').split('/')\n options[:if_permitted_to] = [action_controller.last.to_sym, action_controller[0..action_controller.length-2].join('_').to_sym]\n end\n if permitted_to?(*options[:if_permitted_to])\n return button\n else\n return \"\"\n end\n end\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w[all_vms vms resource_pools].include?(@display) # Were we displaying sub-items\n\n @refresh_div = 'main_div' unless @display # Default div for button.rjs to refresh\n case params[:pressed]\n when 'resource_pool_delete'\n deleteresourcepools\n if @refresh_div == 'main_div' && @lastaction == 'show_list'\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n when 'resource_pool_protect'\n assign_policies(ResourcePool)\n else\n super\n end\n end",
"def createButtonsUpList\n for x in 1..(@numberOfFloors - 1) do\n @buttonsUpList.append(Button.new(x, ButtonStatus::OFF, x))\n # puts \"button up #{@buttonsUpList[x - 1].id} created\"\n end\n end",
"def button(button_text)\n element(damballa(button_text+\"_button\")) { |b| b.button(:value=>button_text) }\n action(damballa(button_text)) { |b| b.button(:value=>button_text).click }\n end",
"def createButtonsDownList\n for x in 2..@numberOfFloors do\n @buttonsDownList.append(Button.new(x, ButtonStatus::OFF, x))\n # puts \"button down #{@buttonsDownList[x - 2].id} created\"\n end\n end",
"def button\n options.fetch(:button, false)\n end",
"def include_pretty_buttons\n stylesheet_link_tag 'buttons'\n end",
"def primary_button_small\n \"highlight-button-dark btn btn-small button\"\n end",
"def buttons(value = false)\n return tags UIAButton unless value\n eles_by_json_visible_contains UIAButton, value\n end",
"def create_button_slider(cach_button_bmp)\n @button_slider_sprite = push 0, 0, nil\n @button_slider_sprite.set_bitmap(cach_button_bmp).set_rect_div(0, 0, 1, 2)\n end",
"def alt_button_id\n 'alt_button'\n end",
"def shipping_add_back_button\n # unit_test_no_generate: shipping_add_back_button, button.className(create_ats_regex_string(\"ats-wis-backtoshipaddedit\"))\n\t\t$tracer.trace(__method__)\n\t return ToolTag.new(button.className(create_ats_regex_string(\"ats-wis-backtoshipaddedit\")), __method__)\n\tend",
"def mgs_buy_as_guest_btn\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(button.className(create_ats_regex_string(\"ats-buyasguest\")), __method__)\n\tend",
"def button # :nodoc:\n @properties['button'].dup\n end",
"def default_bbar\n [\n :add.action, :edit.action, :apply.action, :del.action,\n \"-\", # Adds a separator\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end",
"def setup_action_buttons\n content_for :action_buttons do\n render :partial => '/home/action_buttons'\n end\n end",
"def setup_action_buttons\n content_for :action_buttons do\n render :partial => '/home/action_buttons'\n end\n end",
"def govuk_continuation_buttons(page_description, form_builder, secondary_button = true, return_link = true, primary_button = true, red_secondary_button = false, primary_btn_as_link = false, secondary_btn_as_link = false)\n buttons = ActiveSupport::SafeBuffer.new\n\n buttons << govuk_first_button(page_description, form_builder, red_secondary_button, primary_btn_as_link) if primary_button\n buttons << govuk_second_button(page_description, form_builder, red_secondary_button, secondary_btn_as_link) if secondary_button\n\n if (secondary_button || primary_button) && return_link\n buttons << tag.br\n buttons << link_to(page_description.navigation_details.return_text, page_description.navigation_details.return_url, class: 'govuk-link govuk-!-font-size-19', aria: { label: page_description.navigation_details.return_text })\n end\n\n tag.div(class: 'govuk-!-margin-top-5') do\n buttons\n end\n end",
"def button_tech_demo\n x, y, w, h = 460, 160, 300, 50\n state.button ||= state.new_entity(:button_with_fade)\n\n # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.\n state.button.label ||= [x + w.half, y + h.half + 10, \"click me and watch me fade\", 0, 1]\n state.button.border ||= [x, y, w, h]\n\n if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border\n state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred\n end\n\n outputs.labels << state.button.label\n outputs.borders << state.button.border\n\n if state.button.clicked_at # if button was clicked (variable has a value and is not nil)\n\n # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.\n # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.\n # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.\n outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]\n end\n end",
"def createNewHypothesisButton()\n\t\treturn ButtonCreator.new(\n\t\t\t:assetName => 'plus.png', \n\t\t\t:assetSize => 40, \n\t\t\t:parent => self,\n\t\t\t:clicked => :btn_new_clicked\n\t\t)\n\tend",
"def additional_index_buttons\n nil\n end",
"def xbutton\n content_tag :span, '×'.html_safe, aria: { hidden: true }\n end",
"def brew_button_status; end",
"def store_all_buttons variable_name\r\n command 'storeAllButtons', variable_name\r\n end",
"def button_up(id)\n\n end",
"def add_button_to_query(button); end",
"def button_up(id)\n end",
"def buttons(value = false)\n return _button_visible_selectors_xpath unless value\n\n i = find_elements :xpath, _button_contains_string_xpath(BUTTON, value)\n e = find_elements :xpath, _button_contains_string_xpath(IMAGE_BUTTON, value)\n i + e\n end",
"def button_up(id); end",
"def button_down; end",
"def custom_form_button(label, options = {})\n options.reverse_merge!({:size => \"35\"})\n\n content_tag :button, :type => \"submit\", :class => \"custom-button-#{options[:size]}\" do\n content_tag(:span, :class => \"left\") do\n concat content_tag(:span, label, :class => \"normal\")\n concat content_tag(:span, label, :class => \"shadow\")\n end\n end\n end",
"def default_bbar\n [\n :add.action, :edit.action, :apply.action, :del.action,\n \"-\", # Adds a separator\n :search.action,\n \"-\", # Adds a separator\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end",
"def page_buttons(pens)\n if pens.first_page?\n next_page_button(pens)\n elsif pens.last_page?\n prev_page_button(pens)\n else\n prev_page_button(pens) +\n next_page_button(pens)\n end\n end",
"def default_bbar\n [\n :show_details.action,\n :ctrl_manage.action,\n :search.action,\n \"-\", # Adds a separator\n :add.action, :edit.action, :del.action,\n :apply.action,\n \"-\",\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\",\n :row_counter.action\n ]\n end",
"def push_button(floor)\n\t\t@buttons[floor] = true\n\tend",
"def createButtonsPanel(iParent)\n rResult = Wx::Panel.new(iParent)\n\n # Create buttons\n lBOK = Wx::Button.new(rResult, Wx::ID_OK, 'OK')\n lBCancel = Wx::Button.new(rResult, Wx::ID_CANCEL, 'Cancel')\n\n # Put them in sizers\n lMainSizer = Wx::StdDialogButtonSizer.new\n rResult.sizer = lMainSizer\n lMainSizer.add_button(lBOK)\n lMainSizer.add_button(lBCancel)\n lMainSizer.realize\n\n return rResult\n end",
"def mgs_buy_as_new_account_btn\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(button.className(create_ats_regex_string(\"ats-buyasnew\")), __method__)\n\tend",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n\n params[:display] = @display if [\"vms\", \"hosts\", \"storages\", \"instances\", \"images\", \"orchestration_stacks\"].include?(@display) # Were we displaying vms/hosts/storages\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n\n # Handle buttons from sub-items screen\n if params[:pressed].starts_with?(\"availability_zone_\",\n \"cloud_network_\",\n \"cloud_object_store_container_\",\n \"cloud_subnet_\",\n \"cloud_tenant_\",\n \"cloud_volume_\",\n \"ems_cluster_\",\n \"flavor_\",\n \"floating_ip_\",\n \"guest_\",\n \"host_\",\n \"image_\",\n \"instance_\",\n \"load_balancer_\",\n \"miq_template_\",\n \"network_port_\",\n \"network_router_\",\n \"orchestration_stack_\",\n \"security_group_\",\n \"storage_\",\n \"vm_\")\n\n case params[:pressed]\n # Clusters\n when \"ems_cluster_compare\" then comparemiq\n when \"ems_cluster_delete\" then deleteclusters\n when \"ems_cluster_protect\" then assign_policies(EmsCluster)\n when \"ems_cluster_scan\" then scanclusters\n when \"ems_cluster_tag\" then tag(EmsCluster)\n # Hosts\n when \"host_analyze_check_compliance\" then analyze_check_compliance_hosts\n when \"host_check_compliance\" then check_compliance_hosts\n when \"host_compare\" then comparemiq\n when \"host_delete\" then deletehosts\n when \"host_edit\" then edit_record\n when \"host_protect\" then assign_policies(Host)\n when \"host_refresh\" then refreshhosts\n when \"host_scan\" then scanhosts\n when \"host_tag\" then tag(Host)\n when \"host_manageable\" then sethoststomanageable\n when \"host_introspect\" then introspecthosts\n when \"host_provide\" then providehosts\n # Storages\n when \"storage_delete\" then deletestorages\n when \"storage_refresh\" then refreshstorage\n when \"storage_scan\" then scanstorage\n when \"storage_tag\" then tag(Storage)\n # Edit Tags for Network Manager Relationship pages\n when \"availability_zone_tag\" then tag(AvailabilityZone)\n when \"cloud_network_tag\" then tag(CloudNetwork)\n when \"cloud_object_store_container_tag\" then tag(CloudObjectStoreContainer)\n when \"cloud_subnet_tag\" then tag(CloudSubnet)\n when \"cloud_tenant_tag\" then tag(CloudTenant)\n when \"cloud_volume_tag\" then tag(CloudVolume)\n when \"flavor_tag\" then tag(Flavor)\n when \"floating_ip_tag\" then tag(FloatingIp)\n when \"load_balancer_tag\" then tag(LoadBalancer)\n when \"network_port_tag\" then tag(NetworkPort)\n when \"network_router_tag\" then tag(NetworkRouter)\n when \"orchestration_stack_tag\" then tag(OrchestrationStack)\n when \"security_group_tag\" then tag(SecurityGroup)\n end\n\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n # Handle Host power buttons\n if [\"host_shutdown\", \"host_reboot\", \"host_standby\", \"host_enter_maint_mode\", \"host_exit_maint_mode\",\n \"host_start\", \"host_stop\", \"host_reset\"].include?(params[:pressed])\n powerbutton_hosts(params[:pressed].split(\"_\")[1..-1].join(\"_\")) # Handle specific power button\n else\n process_vm_buttons(pfx)\n # Control transferred to another screen, so return\n return if [\"host_tag\", \"#{pfx}_policy_sim\", \"host_scan\", \"host_refresh\", \"host_protect\",\n \"host_compare\", \"#{pfx}_compare\", \"#{pfx}_tag\", \"#{pfx}_retire\",\n \"#{pfx}_protect\", \"#{pfx}_ownership\", \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\", \"storage_tag\", \"ems_cluster_compare\",\n \"ems_cluster_protect\", \"ems_cluster_tag\", \"#{pfx}_resize\", \"#{pfx}_live_migrate\",\n \"#{pfx}_evacuate\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"host_edit\", \"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show # Handle EMS buttons\n end\n end\n else\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n redirect_to :action => \"new\" if params[:pressed] == \"new\"\n deleteemss if params[:pressed] == \"#{@table_name}_delete\"\n arbitration_profile_edit if params[:pressed] == \"arbitration_profile_new\"\n arbitration_profile_edit if params[:pressed] == \"arbitration_profile_edit\"\n arbitration_profile_delete if params[:pressed] == \"arbitration_profile_delete\"\n refreshemss if params[:pressed] == \"#{@table_name}_refresh\"\n # scanemss if params[:pressed] == \"scan\"\n tag(model) if params[:pressed] == \"#{@table_name}_tag\"\n\n # Edit Tags for Middleware Manager Relationship pages\n tag(@display.camelize.singularize) if @display && @display != 'main' &&\n params[:pressed] == \"#{@display.singularize}_tag\"\n assign_policies(model) if params[:pressed] == \"#{@table_name}_protect\"\n check_compliance(model) if params[:pressed] == \"#{@table_name}_check_compliance\"\n edit_record if params[:pressed] == \"#{@table_name}_edit\"\n if params[:pressed] == \"#{@table_name}_timeline\"\n @showtype = \"timeline\"\n @record = find_by_id_filtered(model, params[:id])\n @timeline = @timeline_filter = true\n @lastaction = \"show_timeline\"\n tl_build_timeline # Create the timeline report\n drop_breadcrumb(:name => _(\"Timelines\"), :url => show_link(@record, :refresh => \"n\", :display => \"timeline\"))\n session[:tl_record_id] = @record.id\n javascript_redirect polymorphic_path(@record, :display => 'timeline')\n return\n end\n if params[:pressed] == \"#{@table_name}_perf\"\n @showtype = \"performance\"\n @record = find_by_id_filtered(model, params[:id])\n drop_breadcrumb(:name => _(\"%{name} Capacity & Utilization\") % {:name => @record.name},\n :url => show_link(@record, :refresh => \"n\", :display => \"performance\"))\n perf_gen_init_options # Intialize options, charts are generated async\n javascript_redirect polymorphic_path(@record, :display => \"performance\")\n return\n end\n if params[:pressed] == \"#{@table_name}_ad_hoc_metrics\"\n @showtype = \"ad_hoc_metrics\"\n @record = find_by_id_filtered(model, params[:id])\n drop_breadcrumb(:name => @record.name + _(\" (Ad hoc Metrics)\"), :url => show_link(@record))\n javascript_redirect polymorphic_path(@record, :display => \"ad_hoc_metrics\")\n return\n end\n if params[:pressed] == \"refresh_server_summary\"\n javascript_redirect :back\n return\n end\n if params[:pressed] == \"ems_cloud_recheck_auth_status\" ||\n params[:pressed] == \"ems_infra_recheck_auth_status\" ||\n params[:pressed] == \"ems_middleware_recheck_auth_status\" ||\n params[:pressed] == \"ems_container_recheck_auth_status\"\n if params[:id]\n table_key = :table\n _result, details = recheck_authentication\n add_flash(_(\"Re-checking Authentication status for this %{controller_name} was not successful: %{details}\") %\n {:controller_name => ui_lookup(:table => controller_name), :details => details}, :error) if details\n else\n table_key = :tables\n ems_ids = find_checked_items\n ems_ids.each do |ems_id|\n _result, details = recheck_authentication(ems_id)\n add_flash(_(\"Re-checking Authentication status for the selected %{controller_name} %{name} was not successful: %{details}\") %\n {:controller_name => ui_lookup(:table => controller_name),\n :name => @record.name,\n :details => details}, :error) if details\n end\n end\n add_flash(_(\"Authentication status will be saved and workers will be restarted for the selected %{controller_name}\") %\n {:controller_name => ui_lookup(table_key => controller_name)})\n render_flash\n return\n end\n\n custom_buttons if params[:pressed] == \"custom_button\"\n\n return if [\"custom_button\"].include?(params[:pressed]) # custom button screen, so return, let custom_buttons method handle everything\n return if [\"#{@table_name}_tag\", \"#{@table_name}_protect\", \"#{@table_name}_timeline\"].include?(params[:pressed]) &&\n @flash_array.nil? # Tag screen showing, so return\n check_if_button_is_implemented\n end\n\n if !@flash_array.nil? && params[:pressed] == \"#{@table_name}_delete\" && @single_delete\n javascript_redirect :action => 'show_list', :flash_msg => @flash_array[0][:message] # redirect to build the retire screen\n elsif params[:pressed] == \"host_aggregate_edit\"\n javascript_redirect :controller => \"host_aggregate\", :action => \"edit\", :id => find_checked_items[0]\n elsif params[:pressed] == \"cloud_tenant_edit\"\n javascript_redirect :controller => \"cloud_tenant\", :action => \"edit\", :id => find_checked_items[0]\n elsif params[:pressed] == \"cloud_volume_edit\"\n javascript_redirect :controller => \"cloud_volume\", :action => \"edit\", :id => find_checked_items[0]\n elsif params[:pressed].ends_with?(\"_edit\") || [\"arbitration_profile_new\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n render_or_redirect_partial(pfx)\n else\n if @refresh_div == \"main_div\" && @lastaction == \"show_list\"\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n end\n end",
"def button(found, date_id, new_date)\n ret_btn = \"<a href='#{button_href(date_id)}' \"\n ret_btn += \"class='#{button_classes(found)}'>\"\n ret_btn += \"#{button_text(found, new_date)}</a>\"\n ret_btn\n end",
"def command_btn(title:, key:, display:, help: nil, color: \"default\")\n button_tag(title,\n class: \"btn btn-#{color} btn-block\",\n title: help,\n id: \"#{key.to_s.downcase}_btn\",\n data: {\n toggle: \"cli\",\n target: cli_product_path(key, name: @product.name, type: @type),\n title: title,\n cmd: \"<code>#{display}</code>\"\n })\n end",
"def manageable_button(body, url, html_options = {})\n html_options[:class] = [html_options[:class], \"button\"].compact.join(\" \")\n icon = manageable_icon(html_options.delete(:icon), :small, :alt => body) if html_options[:icon]\n\n link_to url, html_options do\n [icon, body].compact.join(\" \").html_safe\n end\n end",
"def linkwizard_startover_button\n $tracer.trace(__method__)\n return ToolTag.new(form.id(\"StartOver\").button.className(\"/btn/\") ,__method__)\n end",
"def createHypothesisButtons(hypothesis)\n\t\tcss = self.btnCSS(hypothesis)\n\t\taccept = ButtonCreator.new(:assetName => 'check.png', :assetSize => 40, :css => css)\n\t\treject = ButtonCreator.new(:assetName => 'close.png', :assetSize => 40, :css => css)\n\n\t\taccept.signal_connect('clicked') { self.btn_accept_clicked(hypothesis) }\n\t\treject.signal_connect('clicked') { self.btn_reject_clicked(hypothesis) }\n\n\t\treturn GridCreator.fromArray([accept, reject], :vertical => true)\n\tend",
"def content_button_td_styles\n \"padding: 5px 10px; background: #08C; border: 1px solid #002A80; border-color: #3CF #002A80 #002A80 #3CF;\"\n end",
"def button_to(name, options = {}, html_options = {}) \n\t\thtml_options = check_options(html_options)\n\t\thtml_options[:class] << 'button'\n\t\tsuper(name, options, html_options)\n\tend",
"def bp_button(*args, &block)\n if block_given?\n options = args.first || {}\n html_options = args.second\n bp_button(capture(&block), options, html_options)\n else\n label = args.first\n href = args.second || '#'\n options = args.third || {}\n options_hash = options\n\n options_hash[:class] = options[:class].blank? ? 'btn' : bp_class(\"btn #{options[:class]}\")\n\n out = label\n out += '<i></i>'.html_safe\n\n content_tag :div, link_to(bp_html_print(out), href), options_hash\n end\n end",
"def canvas_editor_button!(params = {})\n set_canvas_ext_param(:editor_button, params)\n end",
"def button\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n\n case params[:pressed]\n when 'miq_request_delete' then deleterequests\n when 'miq_request_edit' then request_edit\n when 'miq_request_copy' then request_copy\n when 'miq_request_reload' then handle_request_reload\n else javascript_flash(:text => _('Button not yet implemented'), :severity => :error)\n end\n end",
"def create\n @button = Button.new(button_params)\n @button.family_id = @current_user.family_id\n\n respond_to do |format|\n if params[:commit] == \"作成する\"\n if @button.save\n format.html { redirect_to buttons_path, notice: 'ボタンを作成しました' }\n else\n format.html { render :new }\n end\n else params[:create_item] == \"作成 & 買い物リストに追加する\"\n if create_button_with_item\n format.html { redirect_to buttons_path, notice: \"#{@button.name}を買い物リストに追加しました\"}\n else\n format.html { render :new }\n end\n end\n end\n end",
"def render_button\n NfgUi::Components::Elements::Button.new({ **integrated_slat_action_button_component_options, body: (block_given? ? yield : body) }, view_context).render\n end",
"def btn_container\n\tbrowser.find_element(class: 'button-container')\n end",
"def fb_create_button(name, url)\n\t\t\t \t\"<fb:create-button href=\\\"#{url_for(url)}\\\">#{name}</fb:create-button>\"\n\t\t\tend",
"def fb_create_button(name, url)\n\t\t\t \t\"<fb:create-button href=\\\"#{url_for(url)}\\\">#{name}</fb:create-button>\"\n\t\t\tend",
"def designed_button_link(&block)\n content_tag :div, :class => \"op-control\" do \n content_tag :ul, :class => \"cf\" do\n content_tag :li do\n content_tag :button do\n yield\n end\n end\n end\n end \n end",
"def create_call_buttons\n \n for floor in 1..Elevator.num_floors do\n \n up_btn = CallButton.new(floor, \"up\", self)\n @up_call_buttons.append(up_btn)\n\n down_btn = CallButton.new(floor, \"down\", self)\n @down_call_buttons.append(down_btn)\n end\n end"
] |
[
"0.7562014",
"0.66310906",
"0.65998024",
"0.657379",
"0.6533267",
"0.64901876",
"0.6487519",
"0.64841187",
"0.64364743",
"0.64025056",
"0.6322279",
"0.63198626",
"0.6283257",
"0.626846",
"0.6196367",
"0.6170193",
"0.61690426",
"0.6159591",
"0.61555356",
"0.6129072",
"0.6129072",
"0.6122035",
"0.60992223",
"0.60944664",
"0.6094322",
"0.6092239",
"0.6077711",
"0.6063469",
"0.6019847",
"0.5981497",
"0.5977691",
"0.59484494",
"0.5945251",
"0.59385943",
"0.5931202",
"0.5929681",
"0.59273785",
"0.5924483",
"0.5921167",
"0.5899418",
"0.58792835",
"0.5869857",
"0.586346",
"0.58491457",
"0.58435947",
"0.58404535",
"0.5833888",
"0.581422",
"0.5779538",
"0.5766066",
"0.574994",
"0.5742004",
"0.5736437",
"0.5732459",
"0.57269514",
"0.5713723",
"0.57130045",
"0.5712037",
"0.5701518",
"0.5698187",
"0.5690213",
"0.5690213",
"0.5689881",
"0.5687672",
"0.56860065",
"0.5683044",
"0.56810015",
"0.5667073",
"0.5664041",
"0.5660066",
"0.56555086",
"0.56276035",
"0.56181824",
"0.5618003",
"0.56179464",
"0.5608655",
"0.56062865",
"0.5600379",
"0.5596535",
"0.55935746",
"0.5588685",
"0.5586071",
"0.5573163",
"0.55720174",
"0.55719084",
"0.5571721",
"0.5570119",
"0.55618453",
"0.5558402",
"0.5545255",
"0.5542667",
"0.55270576",
"0.5526221",
"0.5524029",
"0.5514849",
"0.5511107",
"0.5506766",
"0.5506766",
"0.55045617",
"0.5500125"
] |
0.6308454
|
12
|
::: bp_button ::: ................................................................................................... Default button helper
|
def bp_button(*args, &block)
if block_given?
options = args.first || {}
html_options = args.second
bp_button(capture(&block), options, html_options)
else
label = args.first
href = args.second || '#'
options = args.third || {}
options_hash = options
options_hash[:class] = options[:class].blank? ? 'btn' : bp_class("btn #{options[:class]}")
out = label
out += '<i></i>'.html_safe
content_tag :div, link_to(bp_html_print(out), href), options_hash
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def button\n options.fetch(:button, false)\n end",
"def buttons; end",
"def make_default_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-makedefaultbtn\")), format_method(__method__))\n end",
"def render\n _button.btn.btn_primary request, onClick: self.click, disabled: @disabled\n end",
"def form_button_for(obj, name = nil)\n name ||= obj.object.new_record? ? 'Create' : 'Update'\n\n obj.button name, class: 'btn btn-theme', data: { disable_with: raw(\"<i class='fa fa-circle-o-notch fa-spin'></i> Saving...\") }\n end",
"def button(button_text)\n element(damballa(button_text+\"_button\")) { |b| b.button(:value=>button_text) }\n action(damballa(button_text)) { |b| b.button(:value=>button_text).click }\n end",
"def button(value = nil, options = {})\n field = options[:name] || 'button'\n value = 'Button' if value.nil? || value == ''\n options[:value] ||= value\n single_tag(:input, set_options(:button, field, options))\n end",
"def render_button\n NfgUi::Components::Elements::Button.new({ **integrated_slat_action_button_component_options, body: (block_given? ? yield : body) }, view_context).render\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w[all_vms vms resource_pools].include?(@display) # Were we displaying sub-items\n\n @refresh_div = 'main_div' unless @display # Default div for button.rjs to refresh\n case params[:pressed]\n when 'resource_pool_delete'\n deleteresourcepools\n if @refresh_div == 'main_div' && @lastaction == 'show_list'\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n when 'resource_pool_protect'\n assign_policies(ResourcePool)\n else\n super\n end\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w(vms instances images).include?(@display)\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n return tag(\"CloudTenant\") if params[:pressed] == 'cloud_tenant_tag'\n if params[:pressed].starts_with?(\"vm_\", # Handle buttons from sub-items screen\n \"miq_template_\",\n \"guest_\",\n \"image_\",\n \"instance_\")\n\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n process_vm_buttons(pfx)\n return if [\"#{pfx}_policy_sim\", \"#{pfx}_compare\", \"#{pfx}_tag\", \"#{pfx}_retire\",\n \"#{pfx}_protect\", \"#{pfx}_ownership\", \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show\n end\n elsif params[:pressed] == \"custom_button\"\n custom_buttons\n # custom button screen, so return, let custom_buttons method handle everything\n return\n end\n render_button_partial(pfx)\n end",
"def _button_4_command(*args)\n\n end",
"def linkwizard_confirm_button\n $tracer.trace(__method__)\n return ToolTag.new(button.id(\"/btnSubmit/\") ,__method__)\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n\n unless @refresh_partial # if no button handler ran, show not implemented msg\n add_flash(_(\"Button not yet implemented\"), :error)\n @refresh_partial = \"layouts/flash_msg\"\n @refresh_div = \"flash_msg_div\"\n end\n end",
"def button\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n\n case params[:pressed]\n when 'miq_request_delete' then deleterequests\n when 'miq_request_edit' then request_edit\n when 'miq_request_copy' then request_copy\n when 'miq_request_reload' then handle_request_reload\n else javascript_flash(:text => _('Button not yet implemented'), :severity => :error)\n end\n end",
"def toolbar_button(options = {})\n options.symbolize_keys!\n defaults = {\n :overlay => true,\n :skip_permission_check => false,\n :active => false,\n :link_options => {},\n :overlay_options => {},\n :loading_indicator => true\n }\n options = defaults.merge(options)\n button = content_tag('div', :class => 'button_with_label' + (options[:active] ? ' active' : '')) do\n link = if options[:overlay]\n link_to_overlay_window(\n render_icon(options[:icon]),\n options[:url],\n options[:overlay_options],\n {\n :class => 'icon_button',\n :title => options[:title],\n 'data-alchemy-hotkey' => options[:hotkey]\n }.merge(options[:link_options])\n )\n else\n link_to options[:url], {:class => (\"icon_button#{options[:loading_indicator] ? ' please_wait' : nil}\"), :title => options[:title], 'data-alchemy-hotkey' => options[:hotkey]}.merge(options[:link_options]) do\n render_icon(options[:icon])\n end\n end\n link += content_tag('label', options[:label])\n end\n if options[:skip_permission_check]\n return button\n else\n if options[:if_permitted_to].blank?\n action_controller = options[:url].gsub(/^\\//, '').split('/')\n options[:if_permitted_to] = [action_controller.last.to_sym, action_controller[0..action_controller.length-2].join('_').to_sym]\n end\n if permitted_to?(*options[:if_permitted_to])\n return button\n else\n return \"\"\n end\n end\n end",
"def button_up(id); end",
"def button_up(id)\n end",
"def button(contents, attrs = {})\n current_form_context.button(contents, attrs)\n end",
"def button_up(id)\n\n end",
"def _button_2_command(*args)\n\n end",
"def _button_2_command(*args)\n\n end",
"def linkwizard_startover_button\n $tracer.trace(__method__)\n return ToolTag.new(form.id(\"StartOver\").button.className(\"/btn/\") ,__method__)\n end",
"def button_to( url, text = url, opts = {} )\n tag :button, text, opts.merge( url: url )\nend",
"def reset_button?(button_name); end",
"def button(opts = {})\n opts[:class] << ' button' if opts[:class]\n opts[:class] ||= 'button'\n opts[:class] << ' alert' if opts[:action] == :destroy\n link(opts)\n end",
"def button_to(name, options = {}, html_options = {}) \n\t\thtml_options = check_options(html_options)\n\t\thtml_options[:class] << 'button'\n\t\tsuper(name, options, html_options)\n\tend",
"def form_buttons(**opt)\n opt.reverse_merge!('data-manifest': object.id)\n buttons = super\n buttons << submission_button(**opt)\n buttons << export_button(**opt)\n buttons << import_button(**opt)\n buttons << comm_status(**opt)\n block_given? ? yield(buttons) : buttons\n end",
"def _button_3_command(*args)\n\n end",
"def submit_button_for(builder, value=nil, options={})\n value ||= builder.send(:submit_default_value)\n content_tag(:button, value, options.reverse_merge(:class => 'button big', :id => \"#{builder.object_name}_submit\"))\n end",
"def action_button(label, action, options = {})\n\t path = options.delete(:path) || 'javascript:void(0)'\n\t no_text = label.blank? ? 'no-text' : ''\n\t klass = \"action-button-link \"\n\t\tklass += options.delete(:class) if options[:class]\n\t link_to path, {:class => klass}.merge(options) do\n\t content_tag(:button, {:class => \"button button-gray #{no_text}\"}) do\n \t content_tag(:span, '', :class => action) + label\n \t end\n\t end\n\tend",
"def click_button(button = T.unsafe(nil)); end",
"def phx_button_for( model, captionSuffix, alternateCaptions, name, cssClass, disabled = false, remote = false, id = nil, overrideCaption = nil, tabindex = nil )\n\n buttonClass = \"btn btn-sm btn-default \" << cssClass\n if overrideCaption\n fullCaption = overrideCaption\n elsif !alternateCaptions.present?\n fullCaption = (model.object.persisted? ? \"Update \" : \"Create \") << captionSuffix\n else\n fullCaption = model.object.persisted? ? alternateCaptions[1] : alternateCaptions[0]\n end\n # let rails generate the html\n if tabindex\n button = capture do concat model.submit( fullCaption, name: name, class: buttonClass, disabled: disabled, remote: remote, id: id, tabindex: tabindex ) end\n else\n button = capture do concat model.submit( fullCaption, name: name, class: buttonClass, disabled: disabled, remote: remote, id: id ) end\n\n end\n\n button.html_safe\n\n end",
"def button_image\n raise 'Invalid option, only one of :confirm or :onclick allowed' if @options[:confirm] && @options[:onclick]\n\n if @options[:confirm]\n @options[:onclick] = \"return confirm('#{@options[:confirm]}');\" \n @options.delete(:confirm)\n end\n\n\n\n content_tag(\"button\",\n content_tag('span',@options[:content]),\n :type => 'submit',\n :onclick => @options[:onclick],\n :class => @options[:classes],\n :disabled => @options[:disabled],\n :style => @options[:styles],\n :value => @options[:value],\n :name => @options[:name] )\n end",
"def submit_button?(button_name); end",
"def html_button(*args, &block)\n label = args.first.presence\n symbols = only_symbols?(label)\n accessible_name?(*args) if Log.debug? && (symbols || label.blank?)\n args[0] = symbol_icon(label) if symbols\n html_tag(:button, *args, &block)\n end",
"def button(value = nil, options = {})\n\n value, options = nil, value if value.is_a?(Hash)\n value ||= submit_default_value\n\n value = [image_tag(icon, :class => 'icon'), value].join(' ') if icon = options.delete(:icon)\n klasses = (options.delete(:class) || \"\").split(\" \")\n klasses << \"button\"\n options['class'] = klasses.join(\" \")\n content_tag(:button, value.to_s.html_safe, options.reverse_merge!({ \"type\" => \"submit\", \"name\" => \"commit\" }))\n\n end",
"def command_btn(title:, key:, display:, help: nil, color: \"default\")\n button_tag(title,\n class: \"btn btn-#{color} btn-block\",\n title: help,\n id: \"#{key.to_s.downcase}_btn\",\n data: {\n toggle: \"cli\",\n target: cli_product_path(key, name: @product.name, type: @type),\n title: title,\n cmd: \"<code>#{display}</code>\"\n })\n end",
"def custom_form_button(label, options = {})\n options.reverse_merge!({:size => \"35\"})\n\n content_tag :button, :type => \"submit\", :class => \"custom-button-#{options[:size]}\" do\n content_tag(:span, :class => \"left\") do\n concat content_tag(:span, label, :class => \"normal\")\n concat content_tag(:span, label, :class => \"shadow\")\n end\n end\n end",
"def button(value=nil, options={})\n value, options = nil, value if value.is_a?(Hash)\n\n value ||= I18n.t(\"manageable.save\")\n options[:class] = [options[:class], \"button\"].compact.join(\" \")\n image = @template.image_tag(options.delete(:image) || \"/assets/manageable/icons/tick.png\", :alt => value)\n\n @template.button_tag(options) do\n [image, value].compact.join(\" \").html_safe\n end\n end",
"def button_link content = nil, options = nil, html_options = nil, &block\n UiBibz::Ui::ButtonLink.new(content, options, html_options, &block).render\n end",
"def button(text, options = {}, &block)\n Button.new(text, {parent: self}.merge!(options), &block)\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n\n params[:display] = @display if [\"instances\"].include?(@display) # Were we displaying vms/hosts/storages\n params[:page] = @current_page if @current_page.nil? # Save current page for list refresh\n\n if params[:pressed] == \"custom_button\"\n custom_buttons\n return\n end\n\n if params[:pressed].starts_with?(\"instance_\") # Handle buttons from sub-items screen\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n process_vm_buttons(pfx)\n\n # Control transferred to another screen, so return\n return if [\"#{pfx}_policy_sim\", \"#{pfx}_compare\", \"#{pfx}_tag\",\n \"#{pfx}_retire\", \"#{pfx}_protect\", \"#{pfx}_ownership\",\n \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show # Handle VMs buttons\n end\n elsif params[:pressed] == \"make_ot_orderable\"\n make_ot_orderable\n return\n elsif params[:pressed] == \"orchestration_template_copy\"\n orchestration_template_copy\n return\n elsif params[:pressed] == \"orchestration_templates_view\"\n orchestration_templates_view\n return\n else\n params[:page] = @current_page if @current_page.nil? # Save current page for list refresh\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n case params[:pressed]\n when \"orchestration_stack_delete\"\n orchestration_stack_delete\n when \"orchestration_stack_retire\"\n orchestration_stack_retire\n when \"orchestration_stack_retire_now\"\n orchestration_stack_retire_now\n return\n when \"orchestration_stack_tag\"\n tag(OrchestrationStack)\n when params[:pressed] == \"custom_button\"\n custom_buttons\n return\n end\n return if %w[orchestration_stack_retire orchestration_stack_tag].include?(params[:pressed]) &&\n @flash_array.nil? # Tag screen showing, so return\n end\n\n check_if_button_is_implemented\n\n if single_delete_test\n single_delete_redirect\n elsif params[:pressed].ends_with?(\"_edit\") || [\"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n render_or_redirect_partial(pfx)\n elsif @refresh_div == \"main_div\" && @lastaction == \"show_list\"\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n end",
"def ui_button_link(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Buttons::ButtonLink.new(content, options, html_options, &block).render\n end",
"def button_up(id)\n super(id)\n @buttons_up << id unless @buttons_up.include?(id)\n end",
"def button # :nodoc:\n @properties['button'].dup\n end",
"def show_button_template\n UI::FBButtonTemplate.new(SampleElements::BUTTON_TEMPLATE_TEXT,\n SampleElements::BUTTON_TEMPLATE_BUTTONS)\n .send(@user)\n end",
"def button_to(name, location, overrides={})\n button name, overrides.reverse_merge(href: location)\n end",
"def b(*args)\n JButton.new *args\n end",
"def edit_submit_button\n # unit_test_no_generate: edit_submit_button, button.className(create_ats_regex_string(\"ats-editsubmitbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(button.className(create_ats_regex_string(\"ats-editsubmitbtn\")), __method__)\n end",
"def first_button\n first_ele UIAButton\n end",
"def button_down; end",
"def button(type, *args, &block)\n options = args.extract_options!\n options.merge! :disabled => 'disabled'\n super(type, options, &block)\n end",
"def buttons(f, cf0925)\n # content_tag :div, class: 'form-inline' do\n [f.submit(\"Save\", class: \"btn btn-primary\"),\n f.button(\"Reset\", type: \"reset\", class: \"btn btn-primary\"),\n print_button(cf0925),\n home_button].join(\" \").html_safe\n # end\n end",
"def button_down(id)\n end",
"def mgs_hops_confirm_button\n $tracer.trace(__method__)\n return ToolTag.new(div.id(\"finish_button\"), __method__, self)\n\tend",
"def button_down id\n end",
"def mgs_buy_as_guest_btn\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(button.className(create_ats_regex_string(\"ats-buyasguest\")), __method__)\n\tend",
"def apply_now_button\n # unit_test_no_generate: apply_now_button, button.className(create_ats_regex_string(\"ats-applynowbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(button.className(create_ats_regex_string(\"ats-applynowbtn\")), __method__)\n end",
"def accept_now_button\n # unit_test_no_generate: accept_now_button, button.className(create_ats_regex_string(\"ats-acceptnowbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(button.className(create_ats_regex_string(\"ats-acceptnowbtn\")), __method__)\n end",
"def fixme_button(done, auto_check)\n content_tag(:div, class: \"col-sm-1\") do\n if !done && auto_check\n link_to url_helpers.edit_product_path(@review.product) do\n content_tag(:button, 'FIXME', type: \"button\", class: \"btn btn-warning btn-xs\")\n end\n end\n end\n end",
"def all_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@menu_tag.find.div.className(\"mm-content-base\").find.a.className(\"mainButton\"), format_method(__method__))\n end",
"def message_button(name)\n library_li(name).button(:class=>/sakai_sendmessage_overlay/)\n end",
"def bp_buttons(*args, &block)\n if block_given?\n options = args.first || {}\n html_options = args.second\n bp_buttons(capture(&block), options, html_options)\n else\n html_buttons = args.first\n options = args.second || {}\n options_hash = options\n\n options_hash[:class] = options[:class].blank? ? 'bp-box-buttons' : bp_class(\"bp-box-buttons #{options[:class]}\")\n label = options[:label].blank? ? '' : content_tag(:div, bp_html_print(options[:label]), :class=>'label')\n\n out = label\n out += html_buttons\n\n content_tag :div, bp_html_print(out), options_hash\n end\n end",
"def button_down(id); end",
"def alt_button_id\n 'alt_button'\n end",
"def button\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n timeprofile_delete if params[:pressed] == \"tp_delete\"\n copy_record if params[:pressed] == \"tp_copy\"\n edit_record if params[:pressed] == \"tp_edit\"\n\n if !@refresh_partial && @flash_array.nil? # if no button handler ran, show not implemented msg\n add_flash(_(\"Button not yet implemented\"), :error)\n @refresh_partial = \"layouts/flash_msg\"\n @refresh_div = \"flash_msg_div\"\n end\n\n if params[:pressed].ends_with?(\"_edit\", \"_copy\")\n javascript_redirect(:action => @refresh_partial, :id => @redirect_id)\n else\n build_tabs\n render :update do |page|\n page << javascript_prologue\n page.replace(\"flash_msg_div\", :partial => \"layouts/flash_msg\")\n page << \"miqScrollTop();\" if @flash_array.present?\n page.replace_html(\"main_div\", :partial => \"ui_4\") # Replace the main div area contents\n page << javascript_reload_toolbars\n end\n end\n end",
"def button(&button_proc)\n @buttons << button_proc\n end",
"def button_for(f, action, label)\n content_tag(\n :div,\n content_tag(\n :div,\n primary_button_for(f, action, label) +\n content_tag(:span, ' ') +\n cancel_button,\n class: \"#{OFFSET_CLASS} #{FIELD_WIDTH_CLASS}\"\n ),\n class: 'form-group'\n )\n end",
"def button_tag(name, content, type, html_options = {})\n content_tag(:button, content, html_options.merge(:type => type, :name => name, :id => name))\n end",
"def sexy_button(value=\"Submit\", options={})\n default_options = {\n :type => \"submit\",\n :value => value,\n :class => \"sexy-button\"\n }\n if options[:theme] or SexyButtons.default_theme != \"default\"\n theme = options[:theme] ? options.delete(:theme) : SexyButtons.default_theme\n default_options[:class] << \" sexy-button-#{theme}\"\n end\n if options[:class]\n options[:class] << \" #{default_options[:class]}\"\n end\n content_tag(:button, content_tag(:span, value), default_options.merge(options))\n end",
"def button(opts={})\n opts = {:value=>opts} if opts.is_a?(String)\n input = _input(:submit, opts)\n self << input\n input\n end",
"def submit_button \n\t\t@browser.button(id: @submit)\n\tend",
"def button(found, date_id, new_date)\n ret_btn = \"<a href='#{button_href(date_id)}' \"\n ret_btn += \"class='#{button_classes(found)}'>\"\n ret_btn += \"#{button_text(found, new_date)}</a>\"\n ret_btn\n end",
"def not_now_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(input.id(\"/btnNotNow$/\"), format_method(__method__))\n end",
"def new_button\n begin\n $results.log_action(\"button(#{@params[0..-1].join(' ')})\")\n if @params[1].nil?\n @driver.find_element(:link_text, 'New').click\n else\n # If the New Button has multiple options, choose the right one from the dropdown menu.\n buttons = @driver.find_elements(:class, 'caret')\n buttons[2].click\n @driver.find_element(:link_text, @params[1].capitalize).click\n end\n $session.wait_for_stale\n $results.success\n rescue => ex\n $results.fail(\"button(#{@params.join(' ')})\", ex)\n end\n end",
"def publicbuttong(flag)\n if flag == false\n return \"btn btn-success\"\n else\n return \"btn btn-danger\"\n end\n end",
"def submit_button_template(l = {})\n <<-END\n <div class=\"button\">#{l[:element]}</div>\n\t END\n end",
"def designed_button_link(&block)\n content_tag :div, :class => \"op-control\" do \n content_tag :ul, :class => \"cf\" do\n content_tag :li do\n content_tag :button do\n yield\n end\n end\n end\n end \n end",
"def custom\n begin\n $results.log_action(\"button(#{@params[0]})\")\n if @driver.find_element(:id, \"btn-\" + @params[0]).displayed?\n @driver.find_element(:id, \"btn-\" + @params[0]).click\n $results.success\n else\n $results.fail(\"button(#{@params[0]})\")\n end\n rescue NoMethodError => ex\n puts \"\\nAn error of type #{ex.class} happened in #{@params[0]}.\\n\"\n rescue Exception => ex\n puts \"\\nAn error of type #{ex.class} happened in #{@params[0]}.\\n\"\n $results.fail(\"button(#{@params[0]})\", ex)\n end\n end",
"def special_button(option)\n\t\t\tif defined? @_special_buttons and return_value = @_special_buttons[option.to_sym]\n\t\t\t\treturn_value\n\t\t\tend\n\t\tend",
"def button_tag(value, options = {})\n tag 'input', {:type => 'button', :value => value}.merge(options)\n end",
"def submit_button(value = nil, options = {})\n button value, options.reverse_merge(:data => { :disable_with => I18n.t(:please_wait) }, :class => \"btn btn-primary btn-submit\")\n end",
"def clicks_button(value = nil)\n button = value ? find_button(value) : submit_buttons.first\n return flunk(\"Could not find button #{value.inspect}\") if button.nil?\n add_form_data(button, button.attributes[\"value\"]) unless button.attributes[\"name\"].blank?\n submit_form(form_for_node(button))\n end",
"def linkwizard_next_button\n $tracer.trace(__method__)\n return ToolTag.new(button.className(\"/ats-search_button/\") ,__method__)\n end",
"def button(name, loading_text = 'Saving...')\n button_tag name, class: 'btn btn-theme', data: { disable_with: raw(\"<i class='fa fa-circle-o-notch fa-spin'></i> #{loading_text}\") }\n end",
"def button?\n\t\tcan_button? and show_button\n\tend",
"def select button\n if button.is_a? String\n ;\n else\n button = button.value\n end\n set_value button\n end",
"def submit_button_text(item)\n if item.new_record?\n if item.is_downloadable?\n t('submit_button.upload')\n else\n t('submit_button.create')\n end\n else\n t('submit_button.update')\n end\n end",
"def buttons attrs = {}, &block\n Tagz.tag :div, { :class => 'form-buttons' }.merge(attrs), &block\n end",
"def button_tag( title, url_hash, image=\"\", image_in_own_line=true, popup=false, class_name=\"\" )\n url = popup ? \"popWindow(\\\"#{url_for url_hash}\\\")\" : \"navigateTo(\\\"#{url_for url_hash}\\\")\";\n button_function_tag( title, url, image, image_in_own_line, class_name );\n end",
"def button(type, *args, &proc)\n options = args.extract_options!.dup\n options[:class] = [*options[:class]]\n\n # Add the specified class type.\n if options[:class].select { |cls| BUTTON_CLASSES.include?(cls) }.empty?\n if type.to_s == :submit.to_s.freeze\n options[:class] << 'btn-primary'\n else\n options[:class] << 'btn-default'\n end\n end\n args << options\n\n super(type, *args, &proc)\n end",
"def form_submit_button; @form_submit_button ||= 'Soumettre le quiz' end",
"def shipping_add_back_button\n # unit_test_no_generate: shipping_add_back_button, button.className(create_ats_regex_string(\"ats-wis-backtoshipaddedit\"))\n\t\t$tracer.trace(__method__)\n\t return ToolTag.new(button.className(create_ats_regex_string(\"ats-wis-backtoshipaddedit\")), __method__)\n\tend",
"def hc_modal_button\n @hc_modal_button ||= button(\n :frame => [264, 12, 100, 28],\n :bezel => :textured_square, \n :layout => {:start => false})\n end",
"def button(value = nil, options = {}, &block)\n value, options = nil, value if value.is_a?(Hash)\n if @inside_input_group\n options[:class] ||= ''\n options[:class] << ' input-group-button'\n end\n super\n end",
"def default_shipping_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.id(\"/DefaultAddressRadioButton$/\"), format_method(__method__))\n end",
"def delete_button(object_or_url, contents=\"Delete\", attrs = {})\n url = object_or_url.is_a?(String) ? object_or_url : resource(object_or_url)\n button_text = (contents || 'Delete')\n tag :form, :class => 'delete-btn', :action => url, :method => :post do\n tag(:input, :type => :hidden, :name => \"_method\", :value => \"DELETE\") <<\n tag(:input, attrs.merge(:value => button_text, :type => :submit))\n end\n end",
"def edit_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.id(\"/EditButton$/\"), format_method(__method__))\n end",
"def edit_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.id(\"/EditButton$/\"), format_method(__method__))\n end",
"def additional_action_buttons\n nil\n end"
] |
[
"0.7479003",
"0.7195787",
"0.70887244",
"0.7085129",
"0.7063926",
"0.7051321",
"0.70164204",
"0.69971424",
"0.69842225",
"0.6931993",
"0.6925709",
"0.69242513",
"0.6917327",
"0.69007224",
"0.6882008",
"0.6875467",
"0.6861053",
"0.6857063",
"0.68503994",
"0.68345666",
"0.68345666",
"0.67829025",
"0.6773914",
"0.6773233",
"0.6770493",
"0.6765182",
"0.6763314",
"0.6757671",
"0.6748011",
"0.67279714",
"0.6712302",
"0.67029923",
"0.6684823",
"0.6674607",
"0.6658195",
"0.66382897",
"0.6614136",
"0.66110015",
"0.66077",
"0.6606931",
"0.65946853",
"0.6592255",
"0.65646195",
"0.65557426",
"0.65548646",
"0.65527743",
"0.65452886",
"0.6538527",
"0.6531518",
"0.6512947",
"0.6508379",
"0.65081125",
"0.648575",
"0.6485255",
"0.6481985",
"0.64788765",
"0.6461868",
"0.6452948",
"0.64527166",
"0.6450098",
"0.6446221",
"0.64343274",
"0.643394",
"0.64316654",
"0.64110196",
"0.6401374",
"0.6400978",
"0.6388943",
"0.638831",
"0.63881737",
"0.63787925",
"0.6376754",
"0.63632756",
"0.6357996",
"0.63499755",
"0.63444895",
"0.6341827",
"0.6339737",
"0.6330581",
"0.632854",
"0.6325788",
"0.6308427",
"0.630322",
"0.6302134",
"0.6300899",
"0.63003963",
"0.6290296",
"0.62854916",
"0.62807494",
"0.6278469",
"0.6273417",
"0.6272032",
"0.62638134",
"0.626367",
"0.62627184",
"0.6257809",
"0.62438226",
"0.6236335",
"0.6236335",
"0.622916"
] |
0.7099949
|
2
|
::: bp_submit ::: ...................................................................................................
|
def bp_submit(*args, &block)
if block_given?
"No admite &block"
else
label = args.first
options = args.second || {}
#options_hash = options # Para que reciba cualquier atributo (sin filtrar)
options_hash = {}
options_hash[:class] = options[:class].blank? ? "btn" : bp_class("btn #{options[:class]}")
if !options[:id].blank?
options_hash[:id] = options[:id]
end
if options[:input_id].blank?
input_id = options_hash[:id].blank? ? "" : "input_#{options_hash[:id]}"
else
input_id = options[:input_id]
end
input_hash = {}
input_hash[:id] = input_id
content_tag :div, options_hash do
submit_tag label, input_hash
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def submit; end",
"def submits; end",
"def submit\n end",
"def submit!\n\tend",
"def click_submit\n end",
"def submit\n click_button 'SEND'\n self\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def submit\r\n assert_exists\r\n submit_form \r\n @o.wait\r\n end",
"def submit(form, button = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def submit locator\r\n command 'submit', locator\r\n end",
"def submit locator\r\n command 'submit', locator\r\n end",
"def submit_form\n @page = @form.submit\n end",
"def submit(button = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def submit_button \n\t\t@browser.button(id: @submit)\n\tend",
"def submit\n frm.button(:value=>\"Submit\").click\n SubmissionConfirmation.new(@browser)\n end",
"def submit\n frm.button(:value=>\"Submit\").click\n SubmissionConfirmation.new(@browser)\n end",
"def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end",
"def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end",
"def click_submit_button\n\t\tsubmit_button.click\n\tend",
"def submit(args = {})\n watercourse.set(args[:watercourse]) if args.key?(:watercourse)\n stop_day.set(args[:stop_day]) if args.key?(:stop_day)\n stop_month.set(args[:stop_month]) if args.key?(:stop_month)\n stop_year.set(args[:stop_year]) if args.key?(:stop_year)\n apply_day.set(args[:apply_day]) if args.key?(:apply_day)\n apply_month.set(args[:apply_month]) if args.key?(:apply_month)\n apply_year.set(args[:apply_year]) if args.key?(:apply_year)\n gauging_station.set(args[:gauging_station]) if args.key?(:gauging_station)\n hof_threshold.set(args[:hof_threshold]) if args.key?(:hof_threshold)\n contact_name.set(args[:contact_name]) if args.key?(:contact_name)\n contact_details.set(args[:contact_details]) if args.key?(:contact_details)\n sender_name.set(args[:sender_name]) if args.key?(:sender_name)\n sender_role.set(args[:sender_role]) if args.key?(:sender_role)\n sender_address.set(args[:sender_address]) if args.key?(:sender_address)\n submit_button.click\n end",
"def submit_result\n process_submit_response(submit_request) if @score > 1363\n end",
"def submit\n\t\tif save\n\t\t\tsubmit_request\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def fb_request_form_submit\n tag \"fb:request-form-submit\"\n end",
"def submit_form\n click_button 'submit'\n end",
"def onSubmit(request, response, form, errors)\r\n\t # Check the errors first.\r\n if (errors.getErrorCount() > 0)\r\n # Revert back to the entry screen\r\n form.viewName = \"pipes/remote_sync\"\r\n return form\r\n end\r\n \r\n cur_session = BotListSessionManager.safeCheckSession(request)\r\n requestKey = cur_session.getAttribute(BotListWebCore::SESSION_REMOTE_SYNC_KEY)\r\n # Compare incoming request key\r\n if requestKey != form.remoteSyncKey\r\n\t raise \"Invalid Remote Sync\"\r\n end\r\n \r\n # Run through the basic validation (fail on error)\r\n # Max length of data is 20k\r\n if form.remoteData.length > MAX_DATA_LEN\r\n\t raise \"Invalid Remote Sync\"\r\n end\r\n \r\n entityLinkGroup = BotListLinksManager::EntityLinkGroup.new\r\n entityLinkGroup.daohelper = @daohelperlink\r\n entityLinkGroup.remote_content = form.remoteData\r\n entityLinkGroup.parse\r\n passed = entityLinkGroup.createGroupLinks\r\n\r\n\t# build response for server output\r\n passed_ct = passed if !passed.nil?\t\r\n\tform.responseMessage = \"passed #{passed_ct}\"\r\n\t# Navigate to the confirmation page\r\n form.viewName = \"pipes/sync_confirm\" \r\n return form\r\n end",
"def submitted\n submitted?\n end",
"def submit_button(*args, &block)\n if block_given?\n options = args.extract_options!.dup\n options[:type] = :submit\n options[:name] ||= 'commit'\n args << options\n button_button(options, &block)\n else\n submit(*args)\n end\n end",
"def preplanned_submit\n @publication = Publication.find(params[:id])\n @publication.lock!\n @publication.preplanned_submit!\n flash[:notice] = \"Preplanned submitted for acceptance.\"\n # flash[:notice] = \"Preplanned submitted for acceptance. Email sent to the author.\"\n # @email = Email.find_by_trigger('preplanned_submit')\n # Notifier.workflow_notification(@publication.user,@email,@publication).deliver\n redirect_to publication_url\n end",
"def form_submit\r\n form.submit\r\n @form = nil\r\nend",
"def submit_form\n county = params[:county]\n item = params[:item]\n callerName = params[:callerName]\n #Caller Name on form was set to be optional, in which case name is recorded as Anonymous\n if callerName == \"\" then callerName = \"Anonymous\" end\n method = params[:method]\n #Retrieving the content if \"Other\" button was chosen in form\n if method == \"other2\" then method = params[:altOther2] end\n disposition = params[:disposition]\n if disposition == \"other3\" then disposition = params[:altOther3] end\n if disposition == \"directly\" then disposition = params[:directly] end\n callType = params[:callType]\n if callType == \"Other\" then callType = params[:altOther] end\n callFor = params[:callFor]\n #Storing form data as session variable\n session[:value] = [county, item, callerName, method, disposition, callType, callFor]\n @vals = session[:value]\n #Submit button was clicked, else save button was clicked\n if params[:submit_clicked]\n client = DropboxApi::Client.new\n ifInTmpFolder = false\n currentYear = Time.now.year\n currentMonth = Time.now.month\n prcFileName = \"\"\n if callFor == \"PRC\"\n prcFileName = \"PRCHotlineStatsMonth#{currentMonth}.csv\"\n else\n prcFileName = \"DEPHotlineStatsMonth#{currentMonth}.csv\"\n end\n path = \"/#{currentYear}/#{prcFileName}\"\n tmpPath = Rails.root.join(\"tmp/#{prcFileName}\")\n #Checks if file with correct month and PRC/DEP already exists\n unless File.exist?(tmpPath) || File.symlink?(tmpPath)\n results = client.search(prcFileName,\"/#{currentYear}\")\n if results.matches.count > 0\n path = results.matches.first.resource.path_lower\n monthCSV = \"\"\n file = client.download(path) do |chunk|\n monthCSV << chunk\n end\n CSV.open(tmpPath, \"at\") do |csv|\n csv << monthCSV\n end\n end\n end\n #Adding to CSV file and uploading back to DropBox with override\n CSV.open(tmpPath, \"at\") do |csv|\n csv << [County.find(county).name.titleize, Item.find(item).name.titleize, callerName, method, disposition, callType, callFor]\n end\n file_content = IO.read tmpPath\n client.upload path, file_content, :mode => :overwrite\n session.delete(:value)\n redirect_to \"/\", notice: \"#{callerName} was added to #{callFor}'s call stats.\"\n #Save button clicked\n else\n redirect_to :back\n end\n\n end",
"def submit_button?(button_name); end",
"def submit?\n self.type == :submit\n end",
"def submit_for_grading\n frm.button(:value=>\"Submit for Grading\").click\n ConfirmSubmission.new(@browser)\n end",
"def process_post\n true\n end",
"def submit_spam(args)\n call_akismet('submit-spam', args)\n end",
"def post_message(form)\n begin\n config.sleep_before_post\n form.submit\n rescue StandardError => err\n raise Impostor::PostError.new(err)\n end\n end",
"def new_site_save\n active_submit.click\n end",
"def submit(value = nil, options = {})\n value = (@object.new_record?? \"Create\" : \"Update\") if value.nil?\n build_shell(value, options, 'submit_button') { super }\n end",
"def submit_for_grading\n frm.button(:value=>\"Submit for Grading\").click\n SubmissionSummary.new(@browser)\n end",
"def do_submit\n @job = Job.find(params[:id])\n @queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id]) || JobsQueue.default_queue\n respond_to do |format|\n if @job.submit(@queue)\n flash[:notice] = 'Job was successfully submitted.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def p4_submit description\n p4sh \"p4 submit -d #{description.inspect} ...\"\n end",
"def post; end",
"def submit(locator)\n find_element(locator).submit\n end",
"def submit!(&block)\n self.callback = block if block_given?\n\n# puts \"submit transfer #{@transfer.inspect} buffer: #{@transfer[:buffer].inspect} length: #{@transfer[:length].inspect} status: #{@transfer[:status].inspect} callback: #{@transfer[:callback].inspect} dev_handle: #{@transfer[:dev_handle].inspect}\"\n\n res = Call.libusb_submit_transfer( @transfer )\n LIBUSB.raise_error res, \"in libusb_submit_transfer\" if res!=0\n end",
"def mark_as_submitted!\n # bail and error out if we've already submitted\n if self.submitted?\n self.errors.add :base, \"This form has already been submitted\"\n return\n end\n # Initial changes to model\n opts = {\n :form_locked=>true,\n :mail_sent=>true,\n :status=>status_enum['submitted']\n }\n # determine next approval order value\n next_order = (approval_order > 0) ? approval_order : 1\n # Final state of model (after changes)\n next_opts = {\n :approval_order=>next_order,\n :status=>status_enum['unopened']\n }\n # conduct status transaction\n status_transaction opts, next_opts\n end",
"def click_submit\n @chrome_driver.find_element(:name, SUBMIT_BUTTON).click\n sleep 2\n end",
"def xf_submit (label = \"Submit\", target_options = {}, id = \"submit\", attrs = {})\n attrs = attrs.symbolize_keys()\n attrs[:submission] = id\n labelAttrs = attrs.delete(:labelAttrs)\n label = label(label, labelAttrs)\n method = attrs.delete(:method)\n model = model(attrs[:model])\n model.submission = submission(method, url_for(target_options), {:id => id})\n typeWithAttrs(\"submit\", label, attrs)\n end",
"def click_submit\n @chrome_driver.find_element(:name,SUBMIT_BUTTON).click\n end",
"def submit(*args)\n raise \"Submitting from a merged runner is currently not supported\"\n end",
"def fb_request_form_submit(options={})\n\t\t\t tag(\"fb:request-form-submit\",stringify_vals(options))\n\t\t\tend",
"def submit(buttonName = nil)\r\n if (buttonName.nil?) then\r\n buttons.each { |button|\r\n next if button.type != 'submit'\r\n button.click\r\n return\r\n }\r\n else\r\n click_button_with_name(buttonName)\r\n end\r\n end",
"def submit_in_loading_page!\n @submit_in_loading_page = true\n end",
"def submit\n configure_concern\n submit_job\n end",
"def commit(message)\n p4 'submit', '-d', message\n end",
"def ready_for_submission?\n true\n end",
"def process_submit_result\n if @params[\"result\"]\n case @params[\"result\"]\n when \"SUCCESS\"\n @message = Localization::Message[:send_request_success]\n @icon = \"/public/images/macotec/success.png\"\n @title = \"SUCCESS\"\n @button = [\"OK\"]\n when \"FAILED\"\n @message = Localization::Message[:send_request_no_success]\n @title = \"FAILED\"\n @button = [\"Contact MacoTec\",\"Cancel\"]\n when \"NOT_SUPPORTED_VERSION\"\n @message = @params[\"message\"]\n @title = \"NOT SUPPORTED\"\n @button = [\"Contact MacoTec\",\"Cancel\"]\n when \"ERROR\"\n if (@params[\"message\"]) && (@params[\"message\"].include? \"Email\")\n @message = @params[\"message\"]\n @title = \"ERROR\"\n @button = [\"Contact MacoTec\",\"Cancel\"]\n else\n @message = Localization::Message[:problem]\n @button = [\"Contact MacoTec\",\"Cancel\"]\n end\n when \"MESSAGE_TO_USER\" \n @message = @params[\"message\"]\n @title = \"MESSAGE\"\n @button = [\"Contact MacoTec\",\"Cancel\"]\n else\n @message = '{\"message\"=>\"Der Server ist nicht erreichbar. Bitte prüfen Sie Ihre Internetverbindung oder versuchen Sie es später noch einmal.\"}'\n @title = \"MESSAGE\" \n @button = [\"Contact MacoTec\",\"Cancel\"]\n end\n \n Alert.show_popup( :message => @message, \n :title => @title,\n :icon => @icon,\n :buttons => @button,\n :callback => url_for(:action => :request_popup_callback))\n end\n WebView.navigate Rho::RhoConfig.start_path\n end",
"def save\n #10.times {frm.button(:id=>\"questionpool:submit\").flash}\n frm.button(:id=>\"questionpool:submit\").click\n #sleep 180\n #frm.button(:value=>\"Create\").wait_until_present(120)\n QuestionPoolsList.new(@browser)\n end",
"def import_posts_to_vk settings, posts, agent\n puts '********* Post to Vkontakte **************'\n\n posts.each do |post|\n agent.get (settings[:group_url])\n form = agent.page.forms.first\n form.message = \"#{post[:link]} #{10.chr} #{post[:title]}\"\n form.submit\n ap '[VK]===> ' + post[:title]\n sleep 10\n end\n\nend",
"def submit!\n raise('already submitted') if was_submitted?\n raise('expected a purchased order') unless submit_order&.purchased?\n\n wizard_steps[:checkout] ||= Time.zone.now\n wizard_steps[:submitted] = Time.zone.now\n submitted!\n end",
"def submit_job\n input_deck = generate_input_deck\n # results_script = generate_results_script\n\n if !input_deck.nil? #&& !results_script.nil?\n submit_script = generate_submit_script(input_deck: input_deck)\n # submit_script = generate_submit_script(input_deck: input_deck,\n # results_script: results_script)\n\n if !submit_script.nil?\n Dir.chdir(jobdir) {\n cmd = \"qsub #{prefix}.sh\"\n self.pid = `#{cmd}`\n }\n end\n end\n\n # If successful, set the status to \"Submitted\" and save to database.\n unless pid.nil? || pid.empty?\n self.pid = pid.strip\n # self.submitted_at = Time.new.ctime\n set_status! :b\n else\n self.pid = nil\n # self.submitted_at = '---'\n set_status! :f\n end\n end",
"def submitted?\n ! @pbsid.nil?\n end",
"def post\r\n end",
"def submit_fees\n raise('to be implemented by caller')\n end",
"def submit\n @bulk_update = BulkUpdate.new(params[:bu])\n @bulk_update.property = current_property\n if @bulk_update.valid?\n @bulk_update.do_update\n flash[:notice] = t('bulk_update.tool.message.success')\n redirect_to bulk_update_path\n else\n put_model_errors_to_flash(@bulk_update.errors)\n render 'tool'\n end\n end",
"def submit_to_remote(name, value, options = {}) \t\t\n\t\toptions[:html] ||= Hash.new\n\t\toptions[:html] = check_options(options[:html])\n\t\toptions[:html][:class] << 'button'\n\t\tsuper(name, value, options) \n\tend",
"def link_to_submit text, args\n link_to_function text, \"$(this).closest('form').submit()\", args\n end",
"def click_submit_button\n @driver.find_element(xpath: @submit_button).click\n end",
"def onSubmit(request, response, form, errors)\r\n\treturn form\r\n end",
"def wait_for_submit(b)\n # 2. Wait for the submit button to be click-able\n wait = Selenium::WebDriver::Wait.new(:timeout => @metz.timeout)\n # wait.until {\n # driver.find_element(b.node)\n # }\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def onSubmit(request, response, form, errors) \r\n return form\r\n end",
"def activate\n submit.click\n end",
"def submit_request\n #TBD add a request to the database\n redirect_to show_package_path(:id => params[:id]) \n end",
"def thelper_submit_with_named_button( n = 'commit' )\n thelper_find_input_by_name( n ).click\n end",
"def record_submit(content)\n @greeting = content\n\n mail to: \"superacidjax@me.com\", :subject => 'New Submit Arrived'\n end",
"def official_submit\n \n @course = Course.where(:id => params[:course]).first\n @assessment = Assessment.where(:id => params[:assessment]).first\n @user = User.where(:id => params[:user]).first\n \n if !@course then\n puts \"ERROR: invalid course\"\n exit\n end\n\n if ! @user then\n puts \"ERROR: invalid username (#{user}) for class #{@course.id}\"\n exit\n end\n\n if !@assessment then\n puts \"ERROR: Invalid Assessment (#{assessment}) for course #{@course.id}\"\n exit\n end\n\n\n handinDir = \"/afs/andrew.cmu.edu/scs/cs/autolabEmail/handin/\"\n handinDir += @user.email + \"_\" + @assessment.name + \"/\"\n\n if (params[:submit]) then\n #They've copied their handin over, lets go grab it. \n # Load up the lab.rb file\n begin\n modName = @assessment.name + (@course.name).gsub(/[^A-Za-z0-9]/,\"\")\n require(Rails.root + \"/assessmentConfig/#{@course.name}-#{@assessment.name}.rb\")\n eval(\"extend #{modName.camelcase}\")\n\n # Eventually, we'll make *this* a module so that we can do verifications\n # properly. Until then...\n\n handinFile = cgi.params[\"submit\"][0]\n\n # we're going to fake an upload object so we can save it. God I hate this\n # system.\n ###\n # class FakeUpload\n # def initialize(filename)\n # @filename = filename\n # end\n # def content_type\n # \"text/plain\"\n # end\n # def read\n # IO.read(@filename)\n # end\n\n # def rewind\n # # do nothing, we open the file from scratch on every read\n # end\n #end\n ###\n upload = {'file'=>FakeUpload.new(handinDir + handinFile)}\n @submission = Submission.create(:assessment_id=>@assessment.id,\n :user_id=>@user.id);\n @submission.saveFile(upload)\n afterHandin(@submission)\n rescue Exception => e\n # So, Autolab is a web-service, and we are accessing it via not a web\n # request, so things go wrong.... a lot. Therefore, if an exception\n # occurs, I really don't care. Love, Hunter.\n end\n File.delete(handinDir + handinFile)\n\n if(@submission) then\n puts \"Submission received, ID##{@submission.id}\"\n else\n puts \"There was an error saving your submission. Please contact your\n course staff\"\n end\n\n numSubmissions = Submission.where(:user_id=>@user.id, :assessment_id=>@assessment.id).count\n\n if @assessment.max_submissions != -1 then\n if numSubmissions >= @assessment.max_submissions then\n puts \" - You have 0 submissions left.\"\n else\n numSubmissions = @assessment.max_submissions - numSubmissions\n puts \" - You have #{numSubmissions} submissions left\"\n end\n end\n \n else\n \n #Create a handin directory for them. \n\n # The handin Directory really should not exist, as this script deletes it\n # when it's done. However, if it's there, we'll try to remove an empty\n # folder, else fail w/ error message. \n if (Dir.exist?(handinDir)) then\n begin\n FileUtils.rm_rf(handinDir)\n rescue SystemCallError \n puts \"WARNING: could not clear previous handin directory, please\" +\n \"verify results on autolab.cs.cmu.edu \"\n end\n end\n\n begin\n Dir.mkdir(handinDir)\n rescue SystemCallError\n puts \"ERROR: Could not create handin directory. Please contact\n autolab-dev@andrew.cmu.edu with this error\" \n end\n\n system(\"fs sa #{handinDir} #{@user.email} rlidw\")\n puts handinDir\n end\n\n render :nothing => true\n\n end",
"def submit_search\n click SEARCH_SUBMIT_BUTTON\n end",
"def submit(button_name=nil, opts={})\n # 1. Loop through the non hidden fields and if they're active and displayed enter the value\n fill_in_field_data\n\n # 2. Submit Form\n submit_button = select_submit_button(button_name, opts)\n\n wait_for_submit(submit_button)\n submit_button.node.click\n\n # 3. Wait for Page page\n wait_for_page(driver, metz)\n\n # 4. Return new Page\n Metallize::Page.new(driver, metz)\n\n end",
"def submit(title: '', url: '', shortening: '')\n fill_in 'bookmark_title', with: title\n fill_in 'bookmark_url', with: url\n fill_in 'bookmark_shortening', with: shortening\n\n click_button 'Update Bookmark'\n end",
"def post_data; end",
"def submit_form_0966\n ClaimsApi::Logger.log('itf', detail: '0966 - Request Started')\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n ClaimsApi::Logger.log('itf', detail: '0966 - Controller Actions Completed')\n\n bgs_response = local_bgs_service.insert_intent_to_file(intent_to_file_options)\n if bgs_response.empty?\n ClaimsApi::IntentToFile.create!(status: ClaimsApi::IntentToFile::ERRORED, cid: token.payload['cid'])\n raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Veteran ID not found')\n else\n ClaimsApi::IntentToFile.create!(status: ClaimsApi::IntentToFile::SUBMITTED, cid: token.payload['cid'])\n ClaimsApi::Logger.log('itf', detail: 'Submitted to BGS')\n render json: bgs_response,\n serializer: ClaimsApi::IntentToFileSerializer\n end\n end",
"def onSubmit(request, response, form, errors) \r\n\r\n if (errors.getErrorCount() > 0) || (form.roverVerify != BotListForumRoverValidator::ROVER_VERIFY)\r\n # Revert back to the entry screen\r\n form.viewName = \"botverse/rover/forum_rover\"\r\n return form\r\n end\r\n comment = transformFormData(form)\r\n\r\n # Get the bean from the DB as opposed to off the session table\r\n begin\r\n sessionFactory = @daohelperlink.getSessionFactory()\r\n hbm_session = sessionFactory.openSession()\r\n tx = hbm_session.beginTransaction()\r\n hbm_session.save(comment)\r\n tx.commit()\r\n rescue Exception => e\r\n @log.error(e)\r\n raise e.message\r\n ensure\r\n hbm_session.close()\r\n end\r\n\r\n form.viewName = \"botverse/rover/rover_confirm\"\r\n return form\r\n end",
"def after_add_callback(unused_submission)\n end",
"def link_to_submit(*args, &block)\n\t\tlink_to_function (block_given? ? capture(&block) : args[0]), \"$(this).closest('form').submit()\", args.extract_options!\n\tend",
"def post(*args, &block); end",
"def submitted\n self.update_attributes(:state => 'submitted', :submitted_on => Time.now())\n end",
"def ci_negative_demo_form_submit\r\n sleep 4\r\n $browser.send_keys :enter \r\n # $browser.element.button(:xpath,\"//*[contains(@class, 'form-submit form-buttonSubmit cta-btn blue')]\").click\r\n sleep 6\r\n\trescue\r\n\t $results.puts \"Form Submit Failed! for CI Negative Demo Form!\"\r\n\t $summary_results.puts \"Form Submit Failed! for CI Negative Demo Form!\"\r\n\t get_unique_number\r\n\t $browser.screenshot.save \"#{$x}CI_Negative_Submit_Page_Error\"+$unique_number+\".png\"\r\n\t else\r\n\t\t $results.puts \"Successfully clicked submit button!\"\r\n\t\t $summary_results.puts \"Pass - Negative Test\"\r\nend",
"def submit_form(form)\n @agent.submit(form)\n end",
"def submit_button\n adding_field do |f|\n f.submit I18n.t(\"questions.index.ask_question\", :default => :\"layouts.application.ask_question\"), :class => \"ask_question\"\n end\n end",
"def submit\n solution = @entry.text\n return self.retry() if solution.empty?\n self.solved(solution)\n end",
"def submit_job\n unless inputfile_identifier.nil?\n set_version if version.nil?\n submit_script = generate_submit_script(input_deck: inputfile_identifier)\n\n if !submit_script.nil?\n Dir.chdir(jobdir) {\n cmd = \"qsub #{prefix}.sh\"\n self.pid = `#{cmd}`\n }\n end\n end\n\n # If successful, set the status to \"Submitted\" and save to database.\n unless pid.nil? || pid.empty?\n self.pid = pid.strip\n self.submitted_at = Time.new.ctime\n set_status! :b\n else\n self.pid = nil\n self.submitted_at = '---'\n set_status! :f\n end\n end",
"def submit_job\n unless inputfile_identifier.nil?\n set_version if version.nil?\n submit_script = generate_submit_script(input_deck: inputfile_identifier)\n\n if !submit_script.nil?\n Dir.chdir(jobdir) {\n cmd = \"qsub #{prefix}.sh\"\n self.pid = `#{cmd}`\n }\n end\n end\n\n # If successful, set the status to \"Submitted\" and save to database.\n unless pid.nil? || pid.empty?\n self.pid = pid.strip\n self.submitted_at = Time.new.ctime\n set_status! :b\n else\n self.pid = nil\n self.submitted_at = '---'\n set_status! :f\n end\n end",
"def post_process\n end",
"def submit\n @name = params[:name]\n @bigframe_home = params[:bigframe_home]\n @hadoop_home = params[:hadoop_home]\n @tpchds_local = params[:tpchds_local]\n @data_volume = params[:data_volume]\n @data_variety_rel = params[:relational]\n @data_variety_text = params[:text]\n @data_variety_graph = params[:graph]\n @datavariety_graph = \"\"\n @data_velocity = params[:data_velocity]\n @data_output = params[:hdfs_path]\n process_config\n process_xml\n Delayed::Job.enqueue(Datagen.new(@bigframe_home))\n redirect_to :action=>\"index\"\n end",
"def on_submitting_entry(state, event, *event_args)\n super\n\n # Verify validity of the submission. # TODO: simulation - remove\n if simulating\n # From UploadController#create:\n # @item, failed = upload_create(data)\n __debug_sim('CODE') do\n args = \"data=#{submission.data.inspect}\"\n opt = 'index: false'\n \"@item, failed = upload_create(#{args}, #{opt})\"\n end\n bad = nil\n if (db_fail = submission.db_failure)\n self.failures << 'DB create failed'\n elsif (bad = !(submission.metadata_valid = !submission.invalid_entry))\n self.failures << 'bad metadata'\n else\n self.succeeded << submission.id\n end\n if db_fail\n __debug_sim('[db_failure: true]')\n __debug_sim('The database entry could not be created.')\n elsif bad\n __debug_sim('[invalid_entry: true]')\n __debug_sim('The entry is invalid/incomplete.')\n __debug_sim('(NOTE: PROBABLE FAILURE OF CLIENT-SIDE FORM VALIDATION)')\n else\n __debug_sim('[invalid_entry: false]')\n __debug_sim('[db_failure: false]')\n end\n end\n\n # Verify validity of the submission.\n unless simulating\n wf_validate_submission(*event_args)\n end\n\n valid = ready?\n\n # TODO: simulation - remove\n if valid\n __debug_sim('The database entry was created.')\n else\n __debug_sim('System generates a form error message to be displayed.')\n end\n\n # Automatically transition to the next state based on submission status.\n if valid\n advance! # NOTE: => :submitted\n else\n reject! # NOTE: => :creating\n end\n self\n end",
"def submit()\n @_jobs.each{|job| self.jobids << job.submit()}\n end",
"def input_submit(value = nil, args = {})\n args = args.merge(:type => :submit)\n args[:value] = value unless value.nil?\n\n @g.p do\n @g.input(args)\n end\n end",
"def onSubmit(request, response, form, errors)\r\n return form\r\n end"
] |
[
"0.80355066",
"0.7817041",
"0.77582574",
"0.7633236",
"0.70371556",
"0.7000825",
"0.69059414",
"0.677857",
"0.6539885",
"0.6520481",
"0.6520481",
"0.650785",
"0.64872897",
"0.6464555",
"0.6443382",
"0.6443382",
"0.6436988",
"0.6436988",
"0.6335963",
"0.63290006",
"0.6257416",
"0.6214842",
"0.619172",
"0.6181761",
"0.61327267",
"0.6131816",
"0.611514",
"0.61106044",
"0.6104581",
"0.6095392",
"0.60798347",
"0.6077634",
"0.6062609",
"0.60487884",
"0.6036648",
"0.6026403",
"0.6014479",
"0.60011095",
"0.5995986",
"0.598389",
"0.59606177",
"0.59598875",
"0.5958527",
"0.5955912",
"0.5953984",
"0.5948338",
"0.59422106",
"0.593835",
"0.59298414",
"0.592511",
"0.59098136",
"0.58916867",
"0.58896565",
"0.5852903",
"0.58480865",
"0.58442086",
"0.5837067",
"0.5834997",
"0.5826876",
"0.58231586",
"0.58196956",
"0.58096486",
"0.57703465",
"0.5770206",
"0.5768716",
"0.57635504",
"0.5754312",
"0.575342",
"0.57502496",
"0.5747997",
"0.5747997",
"0.5747997",
"0.5747997",
"0.5740309",
"0.57366365",
"0.5727444",
"0.5723007",
"0.5715102",
"0.5714281",
"0.5701663",
"0.5700777",
"0.5690307",
"0.56795955",
"0.5679417",
"0.5679217",
"0.56785303",
"0.56718886",
"0.56639326",
"0.565824",
"0.565479",
"0.5652109",
"0.56519604",
"0.5649761",
"0.5649761",
"0.5648725",
"0.5646516",
"0.5642765",
"0.56426996",
"0.56370264",
"0.56362444"
] |
0.65491086
|
8
|
::: bp_group :: (ANTES group_inputs_form) ................................................................................................... Agrupar elementos Admite: Label, ID y Class
|
def bp_group options, &block
label = options[:label].blank? ? "" : options[:label]
id = options[:id].blank? ? "" : options[:id]
style = options[:style].blank? ? "" : options[:style]
out = content_tag :li, :class => bp_class("group #{options[:class]}"), :id => "#{id}", :style => style do
content_tag :fieldset do
fieldset = label.blank? ? "" : content_tag(:legend, label, :class => "label")
fieldset += content_tag(:ol, capture(&block))
fieldset.html_safe
end
end
bp_html_print out
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def input_text_group(name, values = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:legend] = prop(field, 'label')\n group[:description] = prop(field, 'description')\n group[:description_id] = \"label-description-#{name}\"\n group[:label] = label(field, name)\n group[:name] = field_name\n group[:values] = values\n end\n group\n end",
"def input_group\n tag.div(yield, class: \"input-group\")\n end",
"def form_group(setting, control)\n id = setting[:key].to_s\n # label = setting[:title] || id.titleize\n label = setting.meta.label || id.titleize\n help_id = id + 'HelpBlock'\n # help_text = setting[:description]\n # aria_label = setting[:aria_label] || \"Radio button for following text input\"\n help_text = setting.meta.description\n aria_label = \"Radio button for following text input\" #setting[:aria_label] || \"Radio button for following text input\"\n\n tag.div(class: \"form-group\") do\n tag.label(for: id, value: label, aria: { label: aria_label }) do\n label\n end +\n input_group { control } + tag.small(help_text, id: help_id, class: ['form-text', 'text-muted'])\n end\n end",
"def input_group(&block)\n @inside_input_group = true\n inner_html = @template.capture &block\n group_html = @template.content_tag(:div, inner_html, class: 'input-group') +\n @errors_html\n output_html = @label_html ? columnize(@label_html, group_html) : group_html\n @inside_input_group = false\n\n row { output_html }\n end",
"def enter_groups(test_data)\n test_groups = test_data[Org::GROUPS.name]\n test_groups = [{ Org::GROUP.name => ''}] unless test_groups\n prep_fieldsets_for_test_data([fieldset(Org::GROUPS.name)], test_groups)\n\n test_groups.each_with_index do |test_grp, index|\n wait_for_element_and_type(group_input(index), test_grp[Org::GROUP.name])\n end\n end",
"def control_group\n @fields[2]\n end",
"def group_builder; end",
"def add_group(name)\n name_li(name).div(:class=>/searchgroups_result_left_filler/).fire_event(\"onclick\")\n end",
"def labeled_group(field, options={})\n options = { :id => field_id(field), :selected => field_value(field) }.update(options)\n options.update(error_class(field)){ |_,*values| values.compact.join(' ') }\n selected_values = resolve_checked_values(field, options)\n variants_for_group(options).inject(SafeBuffer.new) do |html, (caption,value)|\n variant_id = \"#{options[:id]}_#{value}\"\n attributes = { :value => value, :id => variant_id, :checked => selected_values.include?(value) }\n caption = yield(attributes) << ' ' << caption\n html << @template.label_tag(\"#{field_name(field)}[]\", :for => variant_id, :caption => caption)\n end\n end",
"def form_group(method, label: nil, in_parens: nil, placeholder: nil,\n helper_text: nil, **kwargs, &block)\n without_field_error_wrapper do\n classes = ['pt-form-group'] + error_classes(method)\n @template.content_tag :div, class: classes, **kwargs do\n contents = ''.html_safe\n contents << label_with_text_in_parens(method, label, in_parens)\n contents << form_content(method, placeholder, helper_text, &block)\n end\n end\n end",
"def draw_form_group(bootstrap, method, options)\n label = draw_label(bootstrap, method, for_attr: options[:id])\n errors = draw_errors(bootstrap, method)\n\n control = draw_control(bootstrap, errors, method, options) do\n yield\n end\n\n form_group_class = \"form-group\"\n form_group_class += \" row\" if bootstrap.horizontal?\n form_group_class += \" mr-sm-2\" if bootstrap.inline?\n\n content_tag(:div, class: form_group_class) do\n concat label\n concat control\n end\n end",
"def draw_form_group_fieldset(bootstrap, method)\n options = {}\n\n unless bootstrap.label[:hide]\n label_text = bootstrap.label[:text]\n label_text ||= ActionView::Helpers::Tags::Label::LabelBuilder\n .new(@template, @object_name.to_s, method, @object, nil).translation\n\n add_css_class!(options, \"col-form-label pt-0\")\n add_css_class!(options, bootstrap.label[:class])\n\n if bootstrap.horizontal?\n add_css_class!(options, bootstrap.label_col_class)\n add_css_class!(options, bootstrap.label_align_class)\n end\n\n label = content_tag(:legend, options) do\n label_text\n end\n end\n\n content_tag(:fieldset, class: \"form-group\") do\n content = \"\".html_safe\n content << label if label.present?\n content << draw_control_column(bootstrap, offset: bootstrap.label[:hide]) do\n yield\n end\n\n if bootstrap.horizontal?\n content_tag(:div, content, class: \"row\")\n else\n content\n end\n end\n end",
"def input_group(options={}, &block)\n @template.input_group(options, &block)\n end",
"def form_input_group(&block)\n content_tag(:div, capture(&block), class: \"col-lg-10\")\n end",
"def input_group(options={}, &block)\n content = capture(&block)\n update_options_with_class!(options, 'col-lg-10')\n content_tag(:div, content, options)\n end",
"def set_GroupID(value)\n set_input(\"GroupID\", value)\n end",
"def set_GroupID(value)\n set_input(\"GroupID\", value)\n end",
"def control_group(id = nil, css: '.control-group', **opt, &blk)\n opt[:'aria-labelledby'] = id if id\n opt[:role] ||= 'group'\n prepend_css!(opt, css)\n html_div(opt, &blk)\n end",
"def multi_input_form_group(methods, options = {})\n gopt, lopt, fopt = split_form_group_options(options)\n lopt[:text] ||= gopt[:label]\n if lopt[:text].blank?\n lopt[:text] = methods.map {|k,_| k.to_s.humanize }.join(', ')\n end\n lbl = label_w_small(methods.map{|k,_| k}.first, lopt)\n fld = gopt[:wrap].call(multi_input(methods, fopt))\n form_group lbl, fld, gopt\n end",
"def field_group(index)\n field_group_indexes(index).map do |e|\n @input[e]\n end\n end",
"def set_group\n @group = @form.group.descendants.find(params[:id])\n end",
"def form_group(options ={}, &block)\n content = capture(&block)\n update_options_with_class!(options, 'form-group')\n content_tag(:div, content, options)\n end",
"def field_groups\n @field_groups ||= begin\n field_group_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end",
"def input_checkbox_group(name, options = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:question] = prop(field, 'question')\n group[:name] = field_name\n group[:checkboxes] = options.presence || options_group(prop(field, 'options'), field_name)\n end\n group\n end",
"def group(options ={}, &block)\n @template.form_group(options, &block)\n end",
"def set_GroupBy(value)\n set_input(\"GroupBy\", value)\n end",
"def select_groups\n frm.radio(:id=>\"groups\").set\n end",
"def govuk_grouped_fields(form, caption, *attributes)\n attributes_with_errors = attributes.flatten.select { |a| form.object.errors[a].any? }\n attributes_which_are_arrays = attributes.select { |a| form.object[a].is_a? Array }\n\n options = { class: 'govuk-fieldset' }\n options['aria-describedby'] = attributes_with_errors.map { |a| error_id(a) } if attributes_with_errors.any?\n\n tag.fieldset(options) do\n capture do\n concat(list_errors_for_attributes(attributes_which_are_arrays)) if attributes_which_are_arrays.any?\n concat(tag.legend(caption, class: 'govuk-fieldset__legend govuk-fieldset__legend--m'))\n\n attributes.flatten.each do |a|\n yield(form, a)\n end\n end\n end\n end",
"def group\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :group => [] },\n :reduce => Javascript.group\n ).collect do |docs|\n docs[\"group\"] = docs[\"group\"].collect do |attrs|\n Mongoid::Factory.from_db(klass, attrs)\n end\n docs\n end\n end",
"def input_params\n params.require(:grouping).permit(:group_id, :contact_id)\n end",
"def i_groups; end",
"def custom_item_form options\n group_html = \"<li id='#{options[:id]}' class='p'>\"\n group_html += options[:label] ? \"<label for='#{options[:id]}'>#{options[:label]}</label>\" : \"\"\n group_html += \"<div class='wrap-custom-html'>#{options[:html]}</div>\"\n group_html += options[:hint] ? \"<p class='inline-hints'>#{options[:hint]}</p>\" : \"\"\n group_html += \"</li>\"\n group_html.html_safe\n end",
"def __mk_group(gdoc)\n @disp_dic.ext_grp unless @disp_dic.is_a? Disp::Grouping\n gatt = gdoc.to_h\n return if gatt[:enable] == 'false'\n sub = @disp_dic.add_grp(gatt.delete(:id), gatt.delete(:label))\n gdoc.each { |e| __mk_sub_db(e, sub, gatt.dup) }\n end",
"def form_group_for(form, field, opts={}, &block)\n label = opts.fetch(:label) { true }\n #checks if the form field has errors\n has_errors = form.object.errors[field].present?\n\n #then it's going to create a div with the styles that bootstrap 3 expects\n content_tag :div, class: \"form-group #{'has-error' if has_errors}\" do\n #then it's going to create a lable for our field\n concat form.label(field, class: 'control-label') if label\n #output whatever is in the block, in this case it's going to be an input\n concat capture(&block)\n #then it's going to output any errors associated with that field\n concat errors_for(form, field)\n end\n end",
"def static_form_group(method, options = {})\n gopt, lopt, fopt = split_form_group_options(options)\n lbl = label_w_small(method, lopt)\n fld = gopt[:wrap].call(\"<input type=\\\"text\\\" class=\\\"form-control disabled\\\" readonly=\\\"readonly\\\" value=\\\"#{CGI::escape_html(fopt[:value] || object.send(method))}\\\">\")\n form_group lbl, fld, gopt\n end",
"def set_groups_field\n @groups_field = GroupsField.find(params[:id])\n end",
"def form_field_control_label_and_input(object, field, input, options = {})\n label_name = options[:label_name].nil? ? field.to_s.camelize : options[:label_name]\n content_tag(:div,:class => 'control-group') do\n label(object, field, label_name,:class => 'control-label') +\n content_tag(:div, input, :class => 'controls')\n end \n end",
"def add_group(*args)\n end",
"def group\n @group\n end",
"def input_filter_groups=(value)\n @input_filter_groups = value\n end",
"def groupRadio _obj, _args\n \"_obj groupRadio _args;\" \n end",
"def ii_groups; end",
"def group(value)\n attributes[:group] = value\n end",
"def add_to_focus_group(obj)\n @focus_group << obj\n LVGUI.focus_group.add_obj(obj)\n end",
"def add_group(name)\n join_button_for(name).fire_event(\"onclick\")\n self.linger_for_ajax(1)\n end",
"def instructor_create_grp(course, group)\n load_course_grps course\n\n # Create new group set\n logger.info \"Creating new group set called '#{group.group_set}'\"\n (button = button_element(xpath: '//button[@id=\"add-group-set\"]')).when_present Utils.short_wait\n js_click button\n wait_for_element_and_type(text_area_element(id: 'new_category_name'), group.group_set)\n checkbox_element(id: 'enable_self_signup').check\n button_element(id: 'newGroupSubmitButton').click\n link_element(xpath: \"//a[@title='#{group.group_set}']\").when_present Utils.short_wait\n\n # Create new group within the group set\n logger.info \"Creating new group called '#{group.title}'\"\n js_click button_element(class: 'add-group')\n wait_for_element_and_type(edit_group_name_input_element, group.title)\n button_element(id: 'groupEditSaveButton').click\n link_element(xpath: \"//a[contains(.,'#{group.title}')]\").when_present Utils.short_wait\n (link = link_element(xpath: \"//a[contains(.,'#{group.title}')]/../following-sibling::div[contains(@class,'group-actions')]//a\")).when_present Utils.short_wait\n logger.info \"Group ID is '#{group.site_id = link.attribute('id').split('-')[1]}'\"\n end",
"def group\n @group\n end",
"def settings_group_number(name, prop_name, conf_name, options = {}, html_options = {})\n opts = {:sufix => \"\"}.merge(options)\n html_opts ={\n :class => \"input\",\n :size => \"35\",\n :maxlength => \"50\"}.merge(html_options)\n settings_group_line(name, html_options[:tip]) {\n \"#{text_field_tag(prop_name, Confline.get_value(conf_name, session[:user_id]).to_i, html_opts)}#{opts[:sufix]}\"\n }\n end",
"def check_group(name)\n self.checkbox(:title=>\"Select #{name}\").set\n end",
"def field_group(name, locals={}, options={}, &block)\n locals = locals.merge name: name\n\n args = options.merge layout: 'field_group', locals: locals\n\n render args, &block\n end",
"def form_group(f, column, wrapper_class: form_wrapper_class, &block)\n render layout: \"form_group_layout\",\n locals: {f: f, column: column, options: {wrapper_class: wrapper_class}}, &block\n end",
"def set_group\n data[:group]\n end",
"def accepts_grouped_inputs?\n false\n end",
"def groups=(ary)\n # Delete old group elements\n delete_elements('group')\n\n # Add new group elements\n ary.uniq.each { |group|\n add_element('group').text = group\n }\n end",
"def groups=(ary)\n # Delete old group elements\n delete_elements('group')\n\n # Add new group elements\n ary.uniq.each { |group|\n add_element('group').text = group\n }\n end",
"def label_id\n input_dom_id\n end",
"def add_ce_group\n self.refresh_access_token!\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'group.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new)\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/groups/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n group_id = GROUP_REGEX.match(@response.body)[1]\n\n @response.status == 201 ? group_id : nil\n end",
"def show\n @groups = @form.groups\n end",
"def groups; end",
"def groups; end",
"def groups; end",
"def dynamic_field_group_params\n params.require(:dynamic_field_group).permit(:string_key, :display_label, :parent_dynamic_field_group_id, :sort_order, :is_repeatable, :xml_translation, :dynamic_field_group_category_id, :created_by_id, :updated_by_id)\n end",
"def groups()\n\t\t\tend",
"def iii_groups; end",
"def create\n counter = 0\n # for each class created, loop through it and enter it into the database, increment counter as well\n if !params[:group].nil?\n params[:group].each do |group|\n next if group[:group_name] == \"\" || group[:end_time] == \"\"\n # creating the user group\n @group = current_user.groups.build(group_name: group[:group_name].downcase, end_time: group[:end_time], group_day: group[:group_day], conversation_id: group[:conversation_id], time_zone: current_user.time_zone)\n @group.save\n counter += 1\n end\n if @group.nil?\n redirect_to root_path, notice: \"Sorry! You need to fill out the form\"\n elsif @group.save\n redirect_to root_path, notice: \"You made some classes, YAY!\"\n else\n render :new\n end\n end\n end",
"def group name, &block\n Tagz.tag :div, { :class => \"group-#{name}\" }, &block\n end",
"def group(entry)\n push(\"$group\" => evolve(entry.__expand_complex__))\n end",
"def key\n 'groupid'\n end",
"def _format_set_optgroup(group, options)\n tag(:fieldset, {}, [tag(:legend, {}, [group])] + options)\n end",
"def Agroup_params\n params.require(:agroup).permit(:name, :agroup_id, :id_sort, :parent_id, :keycode)\n end",
"def create\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n @group = Group.new\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[languages name legend description default_tags subdomain logo forum enable_mathjax enable_latex custom_favicon language theme signup_type custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n respond_to do |format|\n if @group.save\n @group.create_default_widgets\n\n Jobs::Images.async.generate_group_thumbnails(@group.id)\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def selection_group(fieldname, options={})\n labels = options.delete(:labels)\n title = options.delete(:title) || build_title(fieldname)\n choices = options.delete(:choices)\n selected = options.delete(:selected)\n\n # TODO: Uses option_groups_from_collection_for_select here!\n select_options = ''\n choices.each_with_index do |v,k| #build optiongroup for each given object group\n unless v.empty?\n select_options << \"<optgroup label='#{labels[k]}'>\"\n select_options << @template.options_from_collection_for_select(v, :id, :to_s, selected) #still hardcoded\n select_options << \"</optgroup>\"\n end\n end\n tag_wrapper title, select_tag(fieldname, select_options.html_safe, options)\n end",
"def group_name\n @attributes[:group_name]\n end",
"def group_name\n @attributes[:group_name]\n end",
"def group_tag\n return @group_tag\n end",
"def inputs(legend = nil, options = {}, &block)\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n block.call\n end\n end",
"def group_params\n params.require(:group).permit(:name, :description, :logo, :group_category_id)\n end",
"def groups_field_params\n params.fetch(:groups_field, {})\n end",
"def new_group(group_data)\n [:id, :name].each { |attr| raise(ArgumentError, \"Missing or Invalid Parameter(s)\") unless group_data.key?(attr) }\n set_values group_data\n end",
"def new\n @group_label = GroupLabel.new\n 1.times {@group_label.labels.build}\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_label }\n end\n end",
"def group=(value)\n @group = value\n end",
"def group=(value)\n @group = value\n end",
"def group_id\n super\n end",
"def group_params\n params.require(:group).permit(:name, :desc, :icon)\n end",
"def static_group(name, value, options = {})\n div_class = \"half clearfix\" if options.delete(:float)\n content = content_tag(:label, name) + content_tag(:p, value, options)\n content_tag :div, content, class: div_class\n end",
"def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend",
"def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end",
"def group_params\n params.require(:group).permit(:name, :programing_language_id)\n end",
"def group_id\n @attributes[:group_id]\n end",
"def group_id\n @attributes[:group_id]\n end",
"def group_id\n @attributes[:group_id]\n end",
"def group_params\n params[:group]\n end",
"def group_params\n params[:group]\n end",
"def group_params\n params[:group]\n end",
"def group; end",
"def grouping\n @ole.Grouping\n end",
"def group\n attribute_prop(7)\n end",
"def group_label\n if self.group == 0\n \"Intervention\"\n elsif self.group == 1\n \"Control\"\n else\n \"::INVALID::\"\n end\n end",
"def group_params\n params.require(:group).permit(:group_category_id, :name, :description, :logo, :banner, :owner_id, :tag_list)\n end",
"def accord_all_groups\n gr3+gr4+gr5+gr6+gr7+gr8+gr9\n end"
] |
[
"0.69598037",
"0.681094",
"0.6604592",
"0.6582853",
"0.6241212",
"0.6157816",
"0.6093225",
"0.6055335",
"0.6012496",
"0.5998035",
"0.5973409",
"0.59482056",
"0.5943536",
"0.59414554",
"0.59224075",
"0.59200114",
"0.59200114",
"0.5899451",
"0.5890195",
"0.5889951",
"0.58669263",
"0.58555394",
"0.58439285",
"0.5830933",
"0.5822657",
"0.58108383",
"0.5795923",
"0.5750965",
"0.5687802",
"0.56875646",
"0.5655373",
"0.5642159",
"0.5641911",
"0.56341964",
"0.5612046",
"0.5599733",
"0.5573769",
"0.55492884",
"0.55274737",
"0.5514672",
"0.5514072",
"0.5506418",
"0.54874957",
"0.54842323",
"0.5481936",
"0.5479468",
"0.54782337",
"0.5468563",
"0.5467101",
"0.546426",
"0.54503036",
"0.5441809",
"0.53992575",
"0.53976065",
"0.53976065",
"0.5391515",
"0.5389971",
"0.53653216",
"0.53608227",
"0.53608227",
"0.53608227",
"0.53418815",
"0.5340878",
"0.5337779",
"0.53288096",
"0.53269315",
"0.531141",
"0.52954996",
"0.52793986",
"0.52682525",
"0.52620447",
"0.52598083",
"0.52576053",
"0.52576053",
"0.52391005",
"0.52315897",
"0.5226699",
"0.5225998",
"0.52251166",
"0.52245575",
"0.52170986",
"0.52170986",
"0.521665",
"0.52042645",
"0.5202481",
"0.5201727",
"0.5200021",
"0.5185842",
"0.5183226",
"0.5183226",
"0.5183226",
"0.51820874",
"0.51820874",
"0.51820874",
"0.5181159",
"0.5177053",
"0.5173945",
"0.5170802",
"0.5163813",
"0.51537657"
] |
0.682712
|
1
|
::: bp_inline :: (ANTES inline_inputs_form) ................................................................................................... Campos en linea Admite: Label, ID y Class
|
def bp_inline options, &block
label = options[:label].blank? ? "" : options[:label]
not_label = label.blank? ? "not-label" : ""
id = options[:id].blank? ? "" : "id='#{options[:id]}'"
cols = options[:cols].blank? ? "" : "cols-#{options[:cols]}"
msgerr = cols.blank? ? "No se ha definido el numero de columnas <b>:cols</b>" : ""
unless msgerr.blank?
out = msgerr
else
out = content_tag :li, :class => bp_class("inline #{cols} #{not_label} #{options[:class]}"), :id => "#{id}" do
content_tag :fieldset do
fieldset = label.blank? ? "" : content_tag(:legend, label, :class => "label")
fieldset += content_tag :ol, capture(&block)
fieldset = fieldset.html_safe
end
end
end
bp_html_print out
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inline(label = nil, &block)\n template.content_tag(:div) do\n template.concat template.content_tag(:label, label) if label.present?\n template.concat template.content_tag(:div, :class => 'input') {\n template.content_tag(:div, :class => 'inline-inputs') do\n template.fields_for(\n self.object_name,\n self.object,\n self.options.merge(:builder => ActionView::Helpers::FormBuilder),\n &block\n )\n end\n }\n end\n end",
"def input(wrapper_options)\n @builder.text_field(attribute_name, input_html_options) + \\\n @builder.hidden_field(attribute_name, value: input_html_options[:value], class: attribute_name.to_s + \"-alt\")\n end",
"def inline_label(text)\n @template.content_tag :span, text, class: 'input-group-label'\n end",
"def input_field_set(label: '', &block)\n label_html = label_html_for nil, label, class: 'text-right middle'\n @inside_row = true\n fields_html = @template.capture &block\n @inside_row = false\n\n row { columnize label_html, fields_html }\n end",
"def inline!\n @inline = true\n end",
"def inline_label(wrapper_options = nil)\n inline_option = options[:inline_label]\n\n if inline_option\n label = inline_option == true ? label_text : html_escape(inline_option)\n \" #{label}\".html_safe\n end\n end",
"def inline_input_for(method, options)\n send(:\"#{options.delete(:as)}_input\", method, options)\n end",
"def inline_mtm_edit_forms(obj)\n assocs = model.inline_mtm_assocs(request)\n return if assocs.empty?\n\n t = String.new\n t << \"<div class='inline_mtm_add_associations'>\"\n assocs.each do |assoc|\n form_attr = form_attributes(:action=>url_for(\"mtm_update/#{model.primary_key_value(obj)}?association=#{assoc}&redir=edit\"), :class => 'mtm_add_associations', 'data-remove' => \"##{assoc}_remove_list\")\n t << Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n opts = model.column_options_for(:mtm_edit, request, assoc)\n add_opts = opts[:add] ? opts.merge(opts.delete(:add)) : opts.dup\n add_opts = {:name=>'add[]', :id=>\"add_#{assoc}\"}.merge!(add_opts)\n if model.association_autocomplete?(assoc, request)\n f.input(assoc, {:type=>'text', :class=>'autoforme_autocomplete', :attr=>{'data-type'=>'association', 'data-column'=>assoc, 'data-exclude'=>model.primary_key_value(obj)}, :value=>''}.merge!(add_opts))\n else\n f.input(assoc, {:dataset=>model.unassociated_mtm_objects(request, assoc, obj), :multiple=>false, :add_blank=>true}.merge!(add_opts))\n end\n f.button(:value=>'Add', :class=>'btn btn-xs btn-primary')\n end\n end\n t << \"</div>\"\n t << \"<div class='inline_mtm_remove_associations'><ul>\"\n assocs.each do |assoc|\n mc = model.associated_model_class(assoc)\n t << \"<li>\"\n t << association_class_link(mc, assoc)\n t << \"<ul id='#{assoc}_remove_list'>\"\n obj.send(assoc).each do |assoc_obj|\n t << mtm_edit_remove(assoc, mc, obj, assoc_obj)\n end\n t << \"</ul></li>\"\n end\n t << \"</ul></div>\"\n end",
"def inline_tags; end",
"def label_id\n input_dom_id\n end",
"def tag_for_label_with_inline_help( label_text, field_id, help_text )\n _html = \"\"\n _html << %{<label for=\"#{field_id}\">#{label_text}}\n _html << %{<img src=\"/images/icons/help_icon.png\" onclick=\"$('#{field_id}_help').toggle();\" class='inline_icon' />}\n _html << %{</label><br />}\n _html << %{<div class=\"inline_help\" id=\"#{field_id}_help\" style=\"display: none;\">}\n _html << %{<p>#{help_text}</p>}\n _html << %{</div>}\n _html\n end",
"def select(method, choices, options = { }, html_options = { }) \n label_text = options.delete(:label)\n label_text += \"*\" if attr_required?(method)\n @template.content_tag(:div, :class => \"inline-input-field\") do\n label(method, label_text) +\n super +\n error_html(method)\n end\n end",
"def input(attribute_name, options = {}, &block)\n if input_class = options.delete(:class)\n append_class!(options, :input_html, input_class)\n end\n\n if col = options.delete(:col)\n append_class!(options, :wrapper_html, \"count-#{col}\")\n end\n\n if wrapper_class = options.delete(:wrapper_class)\n append_class!(options, :wrapper_html, wrapper_class)\n end\n\n if options.delete(:first_inline)\n append_class!(options, :wrapper_html, 'first-inline')\n end\n\n if options.delete(:inline)\n append_class!(options, :wrapper_html, 'inline')\n end\n super(attribute_name, options, &block)\n end",
"def inline!\n self.enabled = true \n self.inline = true\n end",
"def address_line_1_form_column(record,input_name)\n text_field :record, :address_line_1, :maxlength => '10', :class=>\"address_line_1-input text-input\"\n end",
"def label_nested_input\n @builder.label(label_target,\n input + template.content_tag('span', label_text),\n label_html_options)\n end",
"def inline_validation model, field\n return \"\" if model.errors[field].blank?\n\n errors = model.errors[field].join(', ')\n html = <<-HTML\n <div class=\"field_with_errors\">\n <span class=\"help-inline\">#{errors}</span>\n </div>\n HTML\n html.html_safe\n end",
"def ing_form; end",
"def all_inline?; end",
"def labeled_input(label_value, attributes={}, &block)\n Haml::Engine.new(<<EOL\n%li\n -required = attributes.delete(:required)\n %label.desc{attributes}\n =label_value\n -if required\n %span.req *\n =block.call if block\nEOL\n ).render(self, :label_value => label_value, :attributes => attributes, :block => block)\n end",
"def form_field_control_label_and_input(object, field, input, options = {})\n label_name = options[:label_name].nil? ? field.to_s.camelize : options[:label_name]\n content_tag(:div,:class => 'control-group') do\n label(object, field, label_name,:class => 'control-label') +\n content_tag(:div, input, :class => 'controls')\n end \n end",
"def custom_item_form options\n group_html = \"<li id='#{options[:id]}' class='p'>\"\n group_html += options[:label] ? \"<label for='#{options[:id]}'>#{options[:label]}</label>\" : \"\"\n group_html += \"<div class='wrap-custom-html'>#{options[:html]}</div>\"\n group_html += options[:hint] ? \"<p class='inline-hints'>#{options[:hint]}</p>\" : \"\"\n group_html += \"</li>\"\n group_html.html_safe\n end",
"def edit_form\n\t\titem_text = question_items.first.text #in_place_editor_field :question_cell, :items, {}, :rows => 3\n\t\tdiv_item(item_text, \"iteminformation\")\n\tend",
"def inline_value_provider\n attributes.fetch(:inlineValueProvider)\n end",
"def backend_fields(cols)\n o = ''\n cols.each do |c|\n identifier = \"#{id}-#{self.class}-#{c}\"\n o << \"<label for='#{identifier}'>#{c.to_s.capitalize}</label><br />\\n\"\n o << \"<textarea id='#{identifier}' name='model[#{c}]'>#{self[c]}</textarea><br />\\n\"\n end\n o\n end",
"def input_field_wrapper(attr, options = {}, html_options = nil, &block)\n label_text = options.delete :label\n @label_html = label_html_for attr, label_text, class: 'text-right middle'\n @input_html = input_html_for attr, options, html_options, &block\n @help_html = help_html_for attr, options\n @errors_html = errors_html_for attr\n\n if @inside_input_group\n @input_html\n elsif @label_html\n labeled_input = columnize @label_html, input_with_errors\n @inside_row ? labeled_input : row { labeled_input }\n else\n input_with_errors\n end\n end",
"def all_input_tags_wrapper(record, rows)\n \"\\n<table class='#{record.class.scaffold_table_class :form}'><tbody>\\n#{rows.join}</tbody></table>\\n\"\n end",
"def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend",
"def primitive_input_name\n \"#{form_builder.object_name}[#{attribute_name}_attributes][]\"\n end",
"def inline_code; end",
"def inputs(*args, &block)\n title = field_set_title_from_args(*args)\n html_options = args.extract_options!\n html_options[:class] ||= \"inputs\"\n html_options[:name] = title\n \n if html_options[:for] # Nested form\n inputs_for_nested_attributes(*(args << html_options), &block)\n elsif block_given?\n field_set_and_list_wrapping(*(args << html_options), &block)\n else\n if @object && args.empty?\n args = self.association_columns(:belongs_to)\n args += self.content_columns\n args -= RESERVED_COLUMNS\n args.compact!\n end\n legend = args.shift if args.first.is_a?(::String)\n contents = args.collect { |method| input(method.to_sym) }\n args.unshift(legend) if legend.present?\n \n field_set_and_list_wrapping(*((args << html_options) << contents))\n end\n end",
"def bbox_display_inputs\n %(\n <div class=\"row bbox-inputs\">\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>North</div></span>\n <input readonly id=\"bbox-north\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>East</div></span>\n <input readonly id=\"bbox-east\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>South</div></span>\n <input readonly id=\"bbox-south\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>West</div></span>\n <input readonly id=\"bbox-west\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n </div>\n )\n end",
"def build_line_form(line,action,caption,is_edit = nil)\n\n field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'line_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'line_phc'}\n\n field_configs[field_configs.length()] = {:field_type=>'CheckBox', :field_name=>'is_dedicated'}\n\n\n build_form(line,field_configs,action,'line',caption,is_edit)\n\n\n end",
"def inline_compound_form_origins\n @inline_compound_form_origins || []\n end",
"def backend_fields(cols)\n o = ''\n cols.each do |c|\n identifier = \"#{id.to_i}-#{self.class}-#{c}\"\n o << \"<label for='#{identifier}'>#{c.to_s.capitalize}</label><br />\\n\"\n o << \"<textarea id='#{identifier}' name='model[#{c}]'>#{self.send(c)}</textarea><br />\\n\"\n end\n o\n end",
"def bbox_display_inputs\n %(\n <div class=\"row bbox-inputs\">\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>North</div></span>\n <input readonly id=\"bbox-north\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>East</div></span>\n <input readonly id=\"bbox-east\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>South</div></span>\n <input readonly id=\"bbox-south\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>West</div></span>\n <input readonly id=\"bbox-west\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n </div>\n )\n end",
"def bbox_display_inputs\n %(\n <div class=\"row bbox-inputs\">\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>North</div></span>\n <input readonly id=\"bbox-north\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>East</div></span>\n <input readonly id=\"bbox-east\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>South</div></span>\n <input readonly id=\"bbox-south\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><div>West</div></span>\n <input readonly id=\"bbox-west\" type=\"text\" class=\"form-control bbox-input\">\n </div>\n </div>\n </div>\n )\n end",
"def review_input(input_type, question, value, is_checked, is_disabled)\n content_tag(:label, class: \"#{input_type}-inline\") do\n properties = {\n type: input_type, value: value, name: \"answer[#{question.id}][done]\",\n class: 'review-answer',\n 'data-question-id' => question.id,\n 'data-review-id' => @review.id\n }\n properties['checked'] = 'checked' if is_checked\n properties['disabled'] = 'disabled' if is_disabled\n content_tag(:input, value, properties)\n end\n end",
"def get_field_edit_rptl\n '<input type=\"hidden\" id=\"' + @id + '-hidden\" name=\"' + @name + '\" value=\"false\" />\n <input type=\"checkbox\" id=\"' + @id + '\" name=\"' + @name + '\" class=\"' + @class_txt + '\" value=\"true\" {%=' + @model_name + '[:' + @name + '_checked]%}\" />\n '\n end",
"def my_input_id\n \"#{self.form.object_name}_#{self.field}\"\n end",
"def render_inline(format = :html, params = {}, parent_context = nil)\n entry.render_inline(format, params, parent_context)\n end",
"def labeled_field(attr, options, &content_gen)\n err = error_on attr, options\n after = options.delete(:after) || ''\n\n @template.content_tag 'div',\n (err ? err : '') + label_tag(attr, options) + content_gen.call + after,\n :class => (err ? 'form_line with_errors' : 'form_line')\n end",
"def get_feature_edit_html()\n super() << \"<div class=\\\"field\\\">\n min=<input name=\\\"min_rating\\\" type='text' value=\\\"#{min_rating}\\\" size=\\\"2\\\" />\n max=<input name=\\\"max_rating\\\" type='text' value=\\\"#{max_rating}\\\" size=\\\"2\\\" />\n </div>\"\n end",
"def set_agricultural_inputs1_part1\n @agricultural_inputs1_part1 = AgriculturalInputs1Part1.find(params[:id])\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def form_element(*args, &block)\n content, options = filter_tag_args(*args)\n options[:class] = if dom_class = options.delete(:class)\n \"fieldRow #{dom_class}\"\n else \n \"fieldRow\"\n end\n if block_given? && !content\n concat content_tag(:dl, capture(&block), options)\n else\n content_tag(:dl, content, options)\n end\n end",
"def to_html\n\n bootstrap_wrapping do\n content_tag(:div, class: 'input-group bs_label_with_content') do\n content_tag(:div, class: 'row') do\n tmp = ActiveSupport::SafeBuffer.new\n\n tmp << content_tag(:div, class: \"col-md-6 col-lg-6\") do\n builder.input method, :label => false\n end\n\n if object.send(method).exists?\n tmp << content_tag(:div, class: \"col-md-6 col-lg-6\") do\n image_tag object.send(method).url,class:'img-responsive img-thumbnail',style:'max-height:200px;'\n end\n end\n\n tmp\n end\n end\n end\n end",
"def generate_attribute_input(attr_label)\r\n input_html = ''.html_safe\r\n\r\n # Get the attribute hash corresponding to the given attribute\r\n attr = @metadata.select{ |attr_hash| attr_hash[\"attribute\"].to_s.eql?(attr_label) }.first\r\n\r\n if attr[\"enforce\"].include?(\"integer\")\r\n number_field :submission, attr[\"attribute\"].to_s.to_sym, value: @submission.send(attr[\"attribute\"])\r\n\r\n elsif attr[\"enforce\"].include?(\"date_time\")\r\n if @submission.send(attr[\"attribute\"]).nil?\r\n date_value = nil\r\n else\r\n date_value = DateTime.parse(@submission.send(attr[\"attribute\"])).to_date.to_s\r\n end\r\n text_field(:submission, attr[\"attribute\"].to_s.to_sym, :class => \"datepicker\", value: \"#{date_value}\")\r\n\r\n elsif attr[\"enforce\"].include?(\"textarea\")\r\n text_area(:submission, attr[\"attribute\"].to_s.to_sym, rows: 3, value: @submission.send(attr[\"attribute\"]))\r\n\r\n # Create select dropdown when there are enforcedValues for the attr. But also let the user enter its own value if Other selected\r\n elsif !attr[\"enforcedValues\"].nil?\r\n metadata_values = @submission.send(attr[\"attribute\"])\r\n select_values = attr[\"enforcedValues\"].collect{ |k, v| [v,k]}\r\n # Add in the select ontologies that are not in the portal but are in the values\r\n if metadata_values.kind_of?(Array)\r\n metadata_values.map do |metadata|\r\n if !select_values.flatten.include?(metadata)\r\n select_values << metadata\r\n end\r\n end\r\n else\r\n if (!select_values.flatten.include?(metadata_values) && !metadata_values.to_s.empty?)\r\n select_values << metadata_values\r\n end\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << select_tag(\"submission[#{attr_label}][]\", options_for_select(select_values, metadata_values), :multiple => 'true',\r\n \"data-placeholder\".to_sym => \"Select ontologies\", :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\")\r\n\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"].to_s}\", nil, :style => \"margin-left: 1em; margin-right: 1em;width: 16em;\", :placeholder => \"Or provide the value\",\r\n :onkeydown => \"if (event.keyCode == 13) { addOntoToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new value\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;vertical-align: baseline;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addOntoToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n else\r\n\r\n select_values << [\"None\", \"\"]\r\n select_values << [\"Other\", \"other\"]\r\n\r\n if metadata_values.nil?\r\n metadata_values = \"\"\r\n end\r\n\r\n input_html << select(\"submission\", attr[\"attribute\"], select_values, { :selected => metadata_values}, {:class => \"form-control\", :id => \"select_#{attr[\"attribute\"]}\", :style=> \"margin-bottom: 1em;\"})\r\n\r\n # Button and field to add new value (that are not in the select). Show when other is selected\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"].to_s}\", nil, :style => \"margin-left: 1em; margin-right: 1em;width: 16em;display: none;\", :placeholder => \"Or provide the value\",\r\n :onkeydown => \"if (event.keyCode == 13) { addValueToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new value\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;display: none;vertical-align: baseline;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addValueToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n # To show/hide textbox when other option is selected or not\r\n input_html << javascript_tag(\"$(function() {\r\n $('#select_#{attr[\"attribute\"]}').change(function() {\r\n if ($('#select_#{attr[\"attribute\"]}').val() == 'other') {\r\n $('#add_#{attr[\"attribute\"].to_s}').val(\"\");\r\n $('#btnAdd#{attr[\"attribute\"]}').show();\r\n $('#add_#{attr[\"attribute\"].to_s}').show();\r\n } else {\r\n $('#btnAdd#{attr[\"attribute\"]}').hide();\r\n $('#add_#{attr[\"attribute\"].to_s}').hide();\r\n }\r\n });\r\n })\")\r\n\r\n end\r\n\r\n\r\n return input_html\r\n\r\n\r\n elsif attr[\"enforce\"].include?(\"isOntology\")\r\n metadata_values = @submission.send(attr[\"attribute\"])\r\n select_values = @ontologies_for_select.dup\r\n # Add in the select ontologies that are not in the portal but are in the values\r\n if metadata_values.kind_of?(Array)\r\n metadata_values.map do |metadata|\r\n if !select_values.flatten.include?(metadata)\r\n select_values << metadata\r\n end\r\n end\r\n else\r\n\r\n if !select_values.flatten.include?(metadata_values)\r\n select_values << metadata_values\r\n end\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << select_tag(\"submission[#{attr_label}][]\", options_for_select(select_values, metadata_values), :multiple => 'true',\r\n \"data-placeholder\".to_sym => \"Select ontologies\", :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\")\r\n\r\n else\r\n input_html << select_tag(\"submission[#{attr_label}]\", options_for_select(select_values, metadata_values), \"data-placeholder\".to_sym => \"Select ontology\",\r\n :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\", :include_blank => true)\r\n end\r\n # Button and field to add new value (not in the select)\r\n input_html << tag(:br)\r\n\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"]}\", nil, :style => \"margin-left: 1em; margin-right: 1em;vertical-align: super;width: 16em;\",\r\n :placeholder => \"Ontology outside of the Portal\", :onkeydown => \"if (event.keyCode == 13) { addOntoToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new ontology\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;margin-top: 1em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addOntoToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n return input_html\r\n\r\n elsif attr[\"enforce\"].include?(\"uri\")\r\n if @submission.send(attr[\"attribute\"]).nil?\r\n uri_value = \"\"\r\n else\r\n uri_value = @submission.send(attr[\"attribute\"])\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << button_tag(\"Add new value\", :id => \"add#{attr[\"attribute\"]}\", :style => \"margin-bottom: 0.5em;margin-top: 0.5em;margin-left: 0.5em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addInput('#{attr[\"attribute\"]}', 'url')\")\r\n input_html << url_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", uri_value[0], :id => attr[\"attribute\"].to_s, class: \"metadataInput\")\r\n # Add field if list of URI\r\n if !@submission.send(attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n @submission.send(attr[\"attribute\"]).each_with_index do |metadata_val, index|\r\n if index != 0\r\n input_html << url_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", metadata_val, :id => \"submission_#{attr[\"attribute\"].to_s}\", class: \"metadataInput\")\r\n end\r\n end\r\n end\r\n input_html << content_tag(:div, \"\", id: \"#{attr[\"attribute\"]}Div\")\r\n\r\n else\r\n # if single value\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: uri_value, class: \"metadataInput\")\r\n end\r\n return input_html\r\n\r\n elsif attr[\"enforce\"].include?(\"boolean\")\r\n select(\"submission\", attr[\"attribute\"].to_s, [\"none\", \"true\", \"false\"], { :selected => @submission.send(attr[\"attribute\"])},\r\n {:class => \"form-control\", :style => \"margin-top: 0.5em; margin-bottom: 0.5em;\"})\r\n\r\n else\r\n # If input a simple text\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << button_tag(\"Add new value\", :id => \"add#{attr[\"attribute\"]}\", :style => \"margin-bottom: 0.5em;margin-top: 0.5em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addInput('#{attr[\"attribute\"]}', 'text')\")\r\n firstVal = \"\"\r\n if !@submission.send(attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n firstVal = @submission.send(attr[\"attribute\"])[0]\r\n end\r\n input_html << text_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", firstVal, :id => attr[\"attribute\"].to_s, class: \"metadataInput\")\r\n\r\n # Add field if list of metadata\r\n if !@submission.send(attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n @submission.send(attr[\"attribute\"]).each_with_index do |metadata_val, index|\r\n if index != 0\r\n input_html << text_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", metadata_val, :id => \"submission_#{attr[\"attribute\"].to_s}\", class: \"metadataInput\")\r\n end\r\n end\r\n end\r\n\r\n input_html << content_tag(:div, \"\", id: \"#{attr[\"attribute\"]}Div\")\r\n\r\n else\r\n # if single value text\r\n # TODO: For some reason @submission.send(\"URI\") FAILS... I don't know why... so I need to call it manually\r\n if attr[\"attribute\"].to_s.eql?(\"URI\")\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: @submission.URI,class: \"metadataInput\")\r\n else\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: @submission.send(attr[\"attribute\"]), class: \"metadataInput\")\r\n end\r\n end\r\n return input_html\r\n end\r\n end",
"def input_label(name)\n field = field_content(name)\n label(field, name)\n end",
"def make_muck_parent_fields(parent)\n return if parent.blank?\n %Q{<input id=\"parent_id\" type=\"hidden\" value=\"#{parent.id}\">\n <input id=\"parent_type\" type=\"hidden\" value=\"#{parent.class.to_s}\">}\n end",
"def nested_form_field label_text, form, method, field, *args\n if form.is_a? Array\n if form.length > 1\n form.shift.fields_for form.first do |builder|\n form[0] = builder\n nested_form_field label_text, form, method, field, *args\n end\n else\n nested_form_field label_text, form.first, method, field, *args\n end\n else\n if label_text.nil?\n form.send method, field, *args\n else\n %Q(<div class=row>\n <div class=span4>#{label_text}</div>\n #{ form.send method, field, *args }\n </div>).html_safe\n end\n end\n end",
"def placeholder_hidden_input\n if primitive?\n template.hidden_field_tag \"#{form_builder.object_name}[#{attribute_name}_attributes][]\", \"\"\n else\n template.hidden_field_tag \"#{form_builder.object_name}[#{attribute_name}_attributes][_kithe_placeholder][_destroy]\", 1\n end\n end",
"def input_text_montant\n \"\".in_input_text(class:'medium', name:'facture[montant_amount]', id:'facture_montant_amount')\nend",
"def build_hidden_field_for_checkbox; end",
"def get_field_edit_js\n # TODO: add JS rendering when generating JS fields class for client side rendering\n '<JS NOT IMPLEMENT YET>'\n end",
"def get_field_edit_js\n # TODO: add JS rendering when generating JS fields class for client side rendering\n '<JS NOT IMPLEMENT YET>'\n end",
"def get_field_edit_js\n # TODO: add JS rendering when generating JS fields class for client side rendering\n '<JS NOT IMPLEMENT YET>'\n end",
"def render_grid_input(name, value, **opt)\n render_form_input(name, value, **opt, type: :textarea)\n end",
"def input_tag_label_and_widget(record_name, column)\n column_name = column.send(column.is_a?(String) || column.is_a?(Symbol) ? :to_s : :name)\n label_id, tag = if column.class.name =~ /Reflection/\n next unless column.macro == :belongs_to\n [\"#{record_name}_#{column.options[:foreign_key] || column.klass.table_name.classify.foreign_key}\", association_select_tag(record_name, column_name)]\n else\n [\"#{record_name}_#{column_name}\", input(record_name, column_name) || text_field(record_name, column_name)]\n end\n [\"<label for='#{label_id}'>#{@scaffold_class ? @scaffold_class.scaffold_column_name(column_name) : column_name.to_s.humanize}</label>\", tag]\n end",
"def form_input_group(&block)\n content_tag(:div, capture(&block), class: \"col-lg-10\")\n end",
"def scaffold_default_field_wrapper\n Proc.new{|label, tag| \"<tr><td>#{label}</td><td>#{tag}</td></tr>\\n\"}\n end",
"def inputs_for(model, form_builder)\n cols = []\n cols += content_columns(model)\n cols -= SKIPPED_COLUMNS\n cols.compact\n\n res = ''\n cols.each do |col|\n res << form_builder.input(col, placeholder: placeholder_for(model, col, form_builder))\n end\n\n cols = association_columns(model, :belongs_to)\n cols -= SKIPPED_COLUMNS\n cols.each do |col|\n res << form_builder.association(col, placeholder: placeholder_for(model, col, form_builder))\n end\n\n res.html_safe\n end",
"def required_label_text; end",
"def set_agricultural_inputs4\n @agricultural_inputs4 = AgriculturalInputs4.find(params[:id])\n end",
"def custom_field(label, contents)\r\n render_field(label, {}, contents)\r\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENT YET>'\n end",
"def inline_ingredients\n ingredients.to_a.map(&:name).join(' ')\n end",
"def existing_value_inputs\n if primitive?\n # We can't use fields_for, and in fact we don't (currently) yield at all,\n # we do clever things with arrays.\n (base_model.send(attribute_name) || []).collect do |str|\n wrap_with_repeatable_ui do\n if caller_content_block.nil?\n default_primitive_input(str)\n else\n caller_content_block.call(primitive_input_name, str)\n end\n end\n end\n else\n # we use fields_for, which will repeatedly yield on repeating existing content\n form_builder.fields_for(attribute_name) do |sub_form|\n wrap_with_repeatable_ui do\n caller_content_block.call(sub_form)\n end\n end\n end\n end",
"def field *args, &block\n type, name, options = _extract_field_args(args)\n out = ''.html_safe\n\n input_options = {}\n input_args = []\n\n unless options[:autocomplete].nil?\n options.delete(:autocomplete)\n input_options[:autocomplete] = 'off'\n end\n\n unless options[:placeholder].nil?\n input_options[:placeholder] = if (placeholder = options.delete(:placeholder)) == true then name.to_s.humanize else placeholder end\n end\n\n unless options[:hidden].nil?\n input_options[:class] = 'hidden' if options[:hidden] == true\n end\n\n unless options[:required].nil?\n input_options[:required] = 'required' if options[:required] == true\n end\n\n unless options[:choices].nil?\n input_args << options[:choices]\n end\n\n out.concat options[:prepend] if options[:prepend]\n\n\n label_html = label(name, options[:label], class: 'control-label')\n\n out.concat label_html if options[:label] && options[:label_first]\n\n if options[:help_text]\n help_text = send(\"#{name}_help_text\")\n help_html = %Q(<a class=\"tipsy\" title=\"#{help_text}\" href=\"#\">learn more</a>).html_safe\n out.concat help_html\n end\n\n out.concat(@template.content_tag(:div, class: \"controls #{type}\") do\n merged_input_args = input_args << input_options\n controls = send(_field_types(type), name, *merged_input_args)\n controls.concat @template.content_tag(:div, options[:help_block], class: 'help-block') if options[:help_block].present?\n controls\n end)\n\n out.concat label_html if options[:label] && !options[:label_first]\n\n out.concat options[:append] if options[:append]\n out.concat yield if block_given?\n\n if options[:wrap_field]\n field_wrapper(type, name) { out }\n else\n out\n end\n end",
"def build_field(raw_value, index = nil)\n value, language = parse_value(raw_value)\n\n <<-HTML\n <div class=\"row\">\n <div class=\"col-sm-10\">\n #{build_input(value, index)}\n </div>\n <div class=\"col-sm-2\">\n #{build_language_autocomplete(language)}\n </div>\n </div>\n HTML\n end",
"def long_text_field_enter(value)\n control = @field.all(:css, 'textarea[class=\"form-control\"]').first\n control.set \"#{value}\"\n end",
"def check_box_field(attr, options = {}, &block)\n label_text = options.delete :label\n input_html = input_html_for attr, options, &block\n errors_html = errors_html_for attr\n label_html_for attr, class: 'check-box-label' do\n @template.content_tag(:span, input_html, class: 'check-box-wrapper') +\n @template.content_tag(:span, label_text, class: 'label-text') +\n errors_html\n end\n end",
"def text_area(method, options = {})\n label_text = options.delete(:label)\n label_text += \"*\" if attr_required?(method)\n @template.content_tag(:div, :class => \"input-field\") do\n @template.content_tag(:div, :class => \"input-field-header\") do\n label(method, label_text) +\n error_html(method)\n end +\n super\n end.html_safe\n end",
"def input_html_options; end",
"def form_fields\n [:description, :status, :magic]\n end",
"def contact_field(contact, field_name, label=field_name)\n html=[]\n style=\"edit\"\n html << \"<label>#{label}</label>\"\n val = html_escape(contact.send(field_name))\n if val.blank?\n val = 'Click to edit' \n style << \" subtle-text\"\n end\n html << \"<span id=\\\"#{field_name}\\-#{contact.id}\\\" class=\\\"#{style}\\\">#{val}</span><br>\"\n html.join(\"\").html_safe\n end",
"def set_agricultural_inputs2\n @agricultural_inputs2 = AgriculturalInputs2.find(params[:id])\n end",
"def create_input object_id, model_name, text_area_cols=66\n\n coder = HTMLEntities.new # create a coder to code value fields for each question\n\n obj_id = object_id\n obj_string = get_camel_caps(model_name)\n obj = obj_string.constantize.find(obj_id)\n obj_type = obj.field_type\n subq_field_name = model_name + \"_sub[\" + obj_id.to_s + \"]\"\n editing = @study.nil?\n retVal = \"\"\n if obj_type.match(\"matrix_\")\n retVal = create_matrix_input(obj, obj_type, model_name, {:editing=>editing})\n else\n\n # if this is a text field there are no options. otherwise, get the options\n unless obj_type == \"text\"\n # gather options for this field\n question_choices = (obj_string + \"Field\").constantize.where(model_name + \"_id\" => obj_id).order(\"row_number ASC\")\n options = question_choices.collect{|opt| opt.option_text}\n\n end\n chosen_values = []\n #unless session[:study_id].nil?\n unless @study.nil?\n chosen = get_selected(obj_id, model_name, obj_string)\n chosen_values = chosen.collect{|x| x[0]}\n chosen_subqs = chosen.collect{|x| x[1]}\n end\n case obj_type\n # RADIO BUTTON INPUTS\n when \"radio\", \"yesno\"\n i=0\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"CHECKED\"\n end\n\n retVal += '<input aria-label=\"Question Answer Option\" class=\"cbox question_radio_input editable_field\" title=\"option\" type=\"radio\" section_name=\"'+model_name+'\" option_id=\"'+question_choices[i].id.to_s+'\" obj_id=\"'+obj.id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+']\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + 'id = \"' + model_name + '_' + obj_id.to_s + '_' + question_choices[i].id.to_s + '\" ' + checked.to_s + '> <label>' + option.to_s + '</label>'\n\n if question_choices[i].has_subquestion\n #retVal += '... <span class=\"radio_group_'+obj_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_sq_span\">'\n retVal += \"...<span class='radio_group_#{obj_id.to_s}' id='option_#{question_choices[i].id.to_s}_sq_span'>\"\n disabled = \"\"\n\n if checked == \"CHECKED\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, subq_field_name, 'radio',\"false\")\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, subq_field_name, 'radio',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n end\n unless editing || obj_string.match(\"^Eft\")\n retVal += \"<br/><a href='#' class='clear_selection_link' question_name='#{model_name}[#{obj_id.to_s}]'>Clear Selections</a><br/>\"\n end\n # SELECT (DROPDOWN BOX) INPUTS\n when \"select\"\n retVal += '<select class=\"question_select_input editable_field\" title=\"Make Your Selection\" section_name=\"'+model_name+'\" obj_id=\"'+obj_id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+']\" id=\"'+model_name+'_'+obj_id.to_s+'\">'\n # NO LONGER USING THE AUTO-OTHER FIELD\n #retVal += attach_listener_for_other(model_name+\"_\"+obj_id.to_s)\n\n #some variables for showing the other fields\n\n # WE ARE NO LONGER USING THE 'OTHER' FIELD SINCE USERS CAN ADD THEIR OWN\n #options << 'Other'\n text_input = \"\"\n found_it = false\n found_at_index = -1\n i=0\n retVal += \"<option value='' >-- Make Your Selection --</option>\"\n options.each do |option|\n selected = \"\"\n if chosen_values.include?(option.to_s)\n selected = \"SELECTED\"\n found_it = true\n found_at_index = i\n # NO LONGER USING THE AUTOMATIC 'OTHER' FIELD\n #elsif chosen_values.length > 0 && !found_it && option.to_s == \"Other\"\n #\tselected = \"SELECTED\"\n #\ttext_input = get_other_input_element(chosen_values[0], obj_id.to_s, model_name)\n end\n continued=\"\"\n if !question_choices[i].nil?\n if question_choices[i].has_subquestion\n continued = \"...\"\n end\n end\n\n retVal += '<option value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + selected + \">\" + option.to_s + continued+\"</option>\"\n i+=1\n end\n retVal +=\"</select> <span id='select_\" + obj_id.to_s + \"_sq_span'>\"\n if found_it && found_at_index > -1\n if question_choices[found_at_index].has_subquestion\n subq_val = chosen_subqs[chosen_values.index(options[found_at_index])]\n retVal += fill_in_subquestion(question_choices[found_at_index].subquestion, subq_val, subq_field_name, 'select',\"false\")\n end\n ## TOOK OUT THE FOLLOWING LINES WHEN ADDING IN 'MAKE YOUR SELECTION' OPTION\n #elsif\tquestion_choices[0].has_subquestion\n #\tretVal += fill_in_subquestion(question_choices[0].subquestion,nil,subq_field_name,\"select\",false)\n end\n\n retVal += \"</span>\"\n retVal += text_input.to_s\n # CHECKBOX INPUTS\n when \"checkbox\"\n i=0\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"checked\"\n end\n retVal += '<input aria-label=\"Question Answer Field\" type=\"checkbox\" title=\"option\" section_name=\"'+model_name+'\" class=\"cbox question_checkbox_input editable_field\" ' + checked + ' option_id=\"'+question_choices[i].id.to_s+'\" obj_id=\"'+obj_id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+'][]\" id=\"'+model_name+'_'+obj_id.to_s+'_'+question_choices[i].id.to_s+'\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\"> <label>' + option.to_s + '</label>'\n\n if question_choices[i].has_subquestion\n retVal += '... <span class=\"checkbox_group_'+obj_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_sq_span\">'\n\n field_name = model_name + \"_sub[\" + obj_id.to_s + \"][\" + question_choices[i].id.to_s + \"]\"\n\n if checked == \"checked\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, field_name, 'checkbox',\"\")\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, field_name, 'checkbox',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n end\n else\n value=\"\"\n unless chosen_values.empty?\n value = \"value='#{chosen_values[0]}'\"\n end\n #retVal += '<input type=\"text\"\" class=\"editable_field\" id=\"'+model_name+'_'+obj_id.to_s+'\" name=\"'+model_name+'[' + obj_id.to_s+ ']\"' + value +'>'\n retVal += \"<textarea aria-label='Question Answer Field' cols=#{text_area_cols} rows=1 class='editable_field' id='#{model_name + '_' + obj_id.to_s}' name='#{model_name+'['+obj_id.to_s+']'}'>#{chosen_values.first}</textarea>\"\n end\n end\n return retVal\n end",
"def tag_inline tagname, value, **attr_map\n attr_str = mk_attr_str(attr_map)\n \"<#{tagname}#{attr_str}>#{value}</div>\"\n end",
"def input_dinheiro_precisao(form, field, label = nil, id = nil, place_holder = nil, required = false, separador_centena = nil,\n separador_centavos = nil, complemento = nil, label_col = 'col-md-2', control_col = 'col-md-10',\n precisao = 2, classe = '')\n html = \"\n #{form.text_field field,\n value: (Util.formata_moeda_sem_ponto(form.object.attributes[field.to_s]) if form.object.attributes[field.to_s]),\n label: label, name: \"#{id}_mask_money\", \"id\" => \"#{id}_mask_money\", placeholder: place_holder,\n data_required: required,\n hide_label: label.nil?,\n class: \"form-control input-money #{classe}\", \"data-decimal\" => separador_centavos,\n \"data-thousands\" => separador_centena,\n onkeyup: \"$(\\\"[name='#{form.object_name}[#{field}]']\\\").val(this.value.replace(/\\\\./g, '').replace(/\\\\,/g,'.'));\"}\n #{form.hidden_field field}\n <script>\n jQuery(document).ready(function () {\n $('.input-money').maskMoney({\n precision: #{precisao}\n });\n });\n </script>\n \"\n html.html_safe\n end",
"def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end",
"def label\n <<-HTML\n\n <label id=\"#{label_id}\" class=\"string #{label_classes}\">#{attribute_name.to_s.titleize}</label>\n HTML\n end",
"def div_inline value, role\n tag_inline('div', value, class: role)\n end",
"def default_fields_for_forms\n [\n { name: :get_verbose_conflicting_row, width: 50,\n label: I18n.t('admin_import.conflicting_row')\n },\n { name: :import_text, flex: 1, label: I18n.t('admin_import.import_text') },\n\n { name: :name, width: 160, label: I18n.t('activerecord.attributes.city.name') },\n { name: :zip, width: 80, label: I18n.t('activerecord.attributes.city.zip') },\n { name: :area, width: 100, label: I18n.t('activerecord.attributes.city.area') },\n { name: :country, width: 100, label: I18n.t('activerecord.attributes.city.country') },\n { name: :country_code, width: 40, label: I18n.t('activerecord.attributes.city.country_code') }\n ]\n end",
"def default_fields_for_forms\n [\n { name: :get_verbose_conflicting_row, width: 50,\n label: I18n.t('admin_import.conflicting_row')\n },\n { name: :import_text, flex: 1, label: I18n.t('admin_import.import_text') },\n\n { name: :name, width: 180, label: I18n.t('activerecord.attributes.team.name') },\n { name: :badge_number, width: 100, label: I18n.t('activerecord.attributes.team.zip') },\n\n { name: :data_import_city__name, width: 200,\n label: I18n.t('activerecord.models.data_import_city')\n },\n { name: :city__get_full_name, width: 200, label: I18n.t('activerecord.models.city')\n }\n ]\n end",
"def input_html_classes; end",
"def inline entity, params = {}\n entity.set_disposition('inline', params)\n add(entity)\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENTED YET>'\n end",
"def input(method, options = {})\n options[:required] = method_required?(method) unless options.key?(:required)\n options[:as] ||= default_input_type(method, options)\n\n html_class = [ options[:as], (options[:required] ? :required : :optional) ]\n html_class << 'error' if @object && @object.respond_to?(:errors) && !@object.errors[method.to_sym].blank?\n\n wrapper_html = options.delete(:wrapper_html) || {}\n wrapper_html[:id] ||= generate_html_id(method)\n wrapper_html[:class] = (html_class << wrapper_html[:class]).flatten.compact.join(' ')\n\n if options[:input_html] && options[:input_html][:id]\n options[:label_html] ||= {}\n options[:label_html][:for] ||= options[:input_html][:id]\n end\n\n input_parts = @@inline_order.dup\n input_parts.delete(:errors) if options[:as] == :hidden\n\n list_item_content = input_parts.map do |type|\n send(:\"inline_#{type}_for\", method, options)\n end.compact.join(\"\\n\")\n\n return template.content_tag(:li, list_item_content, wrapper_html)\n end",
"def inline_code(input, table = false, alternate = false)\n parts = tokenize_line(input, /`(.+?)`/)\n\n result = ''\n size = table ? ',basicstyle=\\scriptsize' : ',style=inline'\n\n options = 'literate={-}{{\\textminus}}1 {-\\ }{{\\textminus}\\ }2,'\n\n parts.each { |p|\n if p.matched\n if p.content.include?('|')\n result << \"\\\\lstinline[#{options}language=#{@language}#{size}]+#{p.content}+\"\n else\n result << \"\\\\lstinline[#{options}language=#{@language}#{size}]|#{p.content}|\"\n end\n else\n result << inline(p.content, alternate)\n end\n }\n\n result\n end",
"def input\n if object.respond_to? :reflections\n hid_name = object.reflections[attribute_name].foreign_key || :\"#{attribute_name}_id\"\n relation = attribute_name\n else\n hid_name = attribute_name\n relation = attribute_name.to_s.gsub(/\\A(.+)(_id)\\z/,'\\1')\n end\n\n case\n when options['data-source'].present?\n input_html_options['data-source'] = options.delete('data-source')\n when input_html_options[:data].present? && input_html_options[:data][:source].present?\n input_html_options['data-source'] = input_html_options[:data].delete(:source)\n end\n\n raise 'input_html_options data-source required' unless input_html_options['data-source'].present?\n input_html_options[:placeholder] = input_html_options[:placeholder] || I18n.t('bonsai.autocomplete_placeholder')\n input_html_options[:size] ||= SimpleForm.default_input_size\n input_html_options['data-value'] = object.send(relation).to_s\n input_html_options[:class] = 'select2-autocomplete'\n\n @builder.text_field hid_name, input_html_options\n end",
"def show_other_filled field_id, value, field_name\n coder = HTMLEntities.new # create a coder to code value fields for each question\n retVal = '<span id=\"other_'+field_id+'\" class=\"other_field\" style=\"padding:0px;\"><br/><br/>Please specify:'\n retVal += '<input id=\"' + field_id + '_input\" type=\"text\" title=\"other\" style=\"width:75%;\" name=\"' + field_name + '\" value = \"' + coder.encode(value) + '\"></span>'\n return retVal\n end",
"def address_1_field\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.className(create_ats_regex_string(\"ats-line1field\")), format_method(__method__))\n end",
"def input_tag_wrapper(label, tag)\n \"<tr><td>#{label}</td><td>#{tag}</td></tr>\\n\"\n end",
"def add_fields(fields, inline, embed = Discordrb::Webhooks::Embed.new)\n if fields.respond_to?(:each)\n fields.each do |field|\n embed.add_field(:name => field[:name].to_s, :value => field[:value].to_s, :inline => !inline.nil?)\n end\n embed\n else false end\n end",
"def comment_in_first_box=(comment)\n frm.text_field(:name=>\"editTotalResults:totalScoreTable:0:_id345\").value=comment\n end",
"def cama_form_element_bootstrap_object(form, object, values)\n html = \"\"\n object.each do |ob|\n ob[:label] = ob[:label].to_s.translate\n ob[:description] = ob[:description].to_s.translate\n r = {field: ob, form: form, template: (ob[:field_options][:template].present? ? ob[:field_options][:template] : Plugins::CamaContactForm::CamaContactForm::field_template), custom_class: (ob[:field_options][:field_class] rescue nil), custom_attrs: {id: ob[:cid] }.merge((JSON.parse(ob[:field_options][:field_attributes]) rescue {})) }\n hooks_run(\"contact_form_item_render\", r)\n ob = r[:field]\n ob[:custom_class] = r[:custom_class]\n ob[:custom_attrs] = r[:custom_attrs]\n ob[:custom_attrs][:required] = 'true' if ob[:required].present? && ob[:required].to_bool\n field_options = ob[:field_options]\n for_name = ob[:label].to_s\n f_name = \"fields[#{ob[:cid]}]\"\n cid = ob[:cid].to_sym\n\n temp2 = \"\"\n\n case ob[:field_type].to_s\n when 'paragraph','textarea'\n temp2 = \"<textarea #{ob[:custom_attrs].to_attr_format} name=\\\"#{f_name}\\\" maxlength=\\\"#{field_options[:maxlength] || 500 }\\\" class=\\\"#{ob[:custom_class].presence || 'form-control'} \\\">#{values[cid] || ob[:default_value].to_s.translate}</textarea>\"\n when 'radio'\n temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], ob[:field_type],values)\n when 'checkboxes'\n temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], \"checkbox\",values)\n when 'submit'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type=\\\"#{ob[:field_type]}\\\" name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'button'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type='button' name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'reset_button'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type='reset' name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'text', 'website', 'email'\n class_type = \"\"\n class_type = \"railscf-field-#{ob[:field_type]}\" if ob[:field_type]==\"website\"\n class_type = \"railscf-field-#{ob[:field_type]}\" if ob[:field_type]==\"email\"\n temp2 = \"<input #{ob[:custom_attrs].to_attr_format} type=\\\"#{ob[:field_type]}\\\" value=\\\"#{values[cid] || ob[:default_value].to_s.translate}\\\" name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'form-control'} #{class_type}\\\">\"\n when 'captcha'\n if form.recaptcha_enabled?\n temp2 = recaptcha_tags\n else\n temp2 = cama_captcha_tag(5, {}, {class: \"#{ob[:custom_class].presence || 'form-control'} field-captcha required\"}.merge(ob[:custom_attrs]))\n end\n when 'file'\n temp2 = \"<input multiple=\\\"multiple\\\" type=\\\"file\\\" value=\\\"\\\" name=\\\"#{f_name}[]\\\" #{ob[:custom_attrs].to_attr_format} class=\\\"#{ob[:custom_class].presence || 'form-control'}\\\">\"\n when 'dropdown'\n temp2 = cama_form_select_multiple_bootstrap(ob, ob[:label], \"select\",values)\n else\n end\n r[:template] = r[:template].sub('[ci]', temp2)\n r[:template] = r[:template].sub('[descr ci]', field_options[:description].to_s.translate).sub('<p></p>', '')\n html += r[:template].gsub('[label ci]', for_name)\n end\n html\n end",
"def grid_row_control_contents(*added, row: nil, **opt)\n opt.transform_keys! { |k| k.to_s.sub(/^data_/, 'data-').to_sym }\n l_id = opt.delete(:'aria-labelledby')\n label = opt.delete(:label)\n ctrls = control_icon_buttons(**opt)\n ctrls = [ctrls, *added, *(yield if block_given?)]\n ctrls = control_group(l_id) { ctrls }\n safe_join([label, ctrls].compact)\n end"
] |
[
"0.7214832",
"0.606171",
"0.6002291",
"0.59069973",
"0.5879961",
"0.58013624",
"0.5620312",
"0.55915844",
"0.55696326",
"0.55614364",
"0.55156434",
"0.55125856",
"0.55068195",
"0.54988736",
"0.5491041",
"0.5444681",
"0.54299146",
"0.5392373",
"0.53789926",
"0.53639644",
"0.5354444",
"0.5351184",
"0.52899766",
"0.5286714",
"0.52786463",
"0.52637523",
"0.52516186",
"0.52440935",
"0.5238399",
"0.5235086",
"0.52333295",
"0.5233065",
"0.5223255",
"0.52124983",
"0.5204395",
"0.52031714",
"0.52031714",
"0.5188751",
"0.51718014",
"0.5171225",
"0.51640373",
"0.51293933",
"0.51190954",
"0.5099907",
"0.5076833",
"0.5076833",
"0.5076833",
"0.50629073",
"0.5056815",
"0.50537276",
"0.5051603",
"0.50399023",
"0.5022665",
"0.5020139",
"0.5010152",
"0.50039625",
"0.4995249",
"0.4995249",
"0.4995249",
"0.4990836",
"0.49766758",
"0.49750662",
"0.497117",
"0.4967139",
"0.49624398",
"0.49354705",
"0.49205917",
"0.49187773",
"0.49113768",
"0.4910323",
"0.49034142",
"0.48999745",
"0.48874018",
"0.48814887",
"0.48700547",
"0.48696622",
"0.48632935",
"0.48605412",
"0.48594502",
"0.4854627",
"0.48545232",
"0.48531985",
"0.48411807",
"0.48201427",
"0.48196453",
"0.48159525",
"0.4812055",
"0.48114148",
"0.48076314",
"0.4806426",
"0.4804622",
"0.48045874",
"0.48000577",
"0.47960782",
"0.47946674",
"0.47941348",
"0.4789939",
"0.4789597",
"0.47883797",
"0.4785778"
] |
0.6378602
|
1
|
::: action_button ::: ................................................................................................... Boton de estilo Accion (accion positiva) Muestra un enlace A con estilo Accion Admite: Label, URL y clases adicionales
|
def action_button_form options
label = options[:label] ? options[:label] : "Boton"
url = options[:url] ? options[:url] : "#"
myclass = options[:class] ? "btn-action #{options[:class]}" : "btn-action"
"<li><div class='#{myclass}'>#{link_to(label, url)}</div></li>".html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_click\n\t\tend",
"def edit(action = 'Objective Action')\n click_on(SELECTOR_MAPPING[action]['Edit']['button'][$janus::ELEMENT])\n end",
"def add_actions; end",
"def aide2()\n indice = IndiceMoyen.create(@map)\n res = indice.envoyerIndice.indice.split(\"-\")\n\n x=res[0].to_i\n y=res[1].to_i\n if res[2]==\"0\"\n @map.putAt!(x,y,Case.create(2))\n changeImage(@buttonTab[x][y],\"../images/cases/croix.png\")\n else\n @map.putAt!(x,y,Case.create(1))\n @map.accessAt(x,y).color=1;\n changeImage(@buttonTab[x][y],\"../images/cases/noir.png\")\n end\n @timePress[x][y]+=1\n @timer.add(60)\n if @map.compare\n victoire()\n end\n end",
"def actionNom\n\t\treturn \"Acheter potion (100or)\"\n\tend",
"def matt_custom_action_begin(label); end",
"def buttons; end",
"def acessar_instituicao_page\n cadastro_btn.click\n instituicao_btn.click\n incluir_btn.click\n end",
"def accum_en; catdet.button(:name, 'energyControl'); end",
"def action_target()\n \n end",
"def linkwizard_startover_button\n $tracer.trace(__method__)\n return ToolTag.new(form.id(\"StartOver\").button.className(\"/btn/\") ,__method__)\n end",
"def on_click_aller_retour\n @pile_action.vers_dernier_point_de_retour\n end",
"def clicar_entrar\n botao_entrar.click\n end",
"def action_button(label, action, options = {})\n\t path = options.delete(:path) || 'javascript:void(0)'\n\t no_text = label.blank? ? 'no-text' : ''\n\t klass = \"action-button-link \"\n\t\tklass += options.delete(:class) if options[:class]\n\t link_to path, {:class => klass}.merge(options) do\n\t content_tag(:button, {:class => \"button button-gray #{no_text}\"}) do\n \t content_tag(:span, '', :class => action) + label\n \t end\n\t end\n\tend",
"def activate_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(input.id(\"/redirectImageButton$/\"), format_method(__method__))\n end",
"def click_button(button)\n sleep 5\n contents = for_contents(Utils.country)\n @value = HelperUser.button_selector(button)\n case button.to_sym\n when :activity, :information, :security, :'additional config'\n @value.each do |key,val|\n Capybara.send(@value[key][:metodo],@value[key][:tag],@value[key][:etiqueta],@value[key][:text], wait:@value[key][:wait]).click if @value[key][:text] != nil\n Capybara.send(@value[key][:metodo],@value[key][:tag],@value[key][:etiqueta],wait:@value[key][:wait])[@value[key][:index]].click if @value[key][:index] != nil\n Capybara.send(@value[key][:metodo],@value[key][:tag],@value[key][:etiqueta],wait:@value[key][:wait]).click if @value[key][:index] == nil and @value[key][:text] == nil\n Capybara.send(@value[key][:metodo],@value[key][:tag],@value[key][:etiqueta],wait:@value[key][:wait]).hover if @value[key][:hover] == 'si'\n end\n\n when :'close sesion'\n ElementExist.close_sesion(contents[:contents][:'close sesion'])\n puts \"Se valido Dispositivos y sesiones\".yellow\n\n else\n raise \"#{button}, no es us un boton valido.\"\n end\n end",
"def update_cc_button\n\t\t$tracer.trace(__method__)\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-updtccbtn\")), __method__)\n\tend",
"def action\n trigger :click\n end",
"def form_submit_button(text=\"Continue\".t, *args)\n fat_turquoise_button_link_to(text, \"#{member_path([@tier, @topic, Kase], :new)}\")\n end",
"def new_button_prefab x, y, message\n w, h = 300, 50\n button = state.new_entity(:button_with_fade)\n button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders\n button.border = [x, y, w, h] # sets border definition\n button\n end",
"def updateOnClick(cellule,eventBox)\n #Recuperation de la nouvelle couleur\n couleur = calculCouleur(cellule,@clique)\n #Application de la nouvelle couleur\n updateEventBox(eventBox,couleur)\n end",
"def action\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def on_button_osoba_dodaj_clicked()\n @osoby_window.show\n end",
"def custom_action(context, element, aspect_model)\n \n content_translation_guiblock.custom_action(context, element, aspect_model) \n \n end",
"def element_action(context={}, aspect_model)\n \n content_translation_guiblock.element_action(context, aspect_model)\n \n end",
"def creden\n \n criacao.click\n taske.click\n\n end",
"def actions; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def bouton_calculer\n onclick = \"$.proxy(Facture,'calculer')();return false;\"\n Facture::button_name_calculer.in_a(href:\"\", id:\"btn_calcul_montant_amount\", onclick:onclick, class:'btn small', style:'vertical-align:top')\nend",
"def call_for_action\n msg = I18n.t 'presenters.contestant.call_for_action_html',\n contestant: target.name, ext: contact_extension\n\n v.content_tag :p, msg.html_safe, class: 'call-for-action'\n end",
"def otto_button_click\n MenuControllerContracts.invariant(self)\n @game_state_model::game_type = :otto\n @game_state_model::game_mode_logic = GameLogic::OttoRules.new(@game_state_model)\n @current_view = @views[1]\n MenuControllerContracts.invariant(self)\n end",
"def show\n @operacao = 'Visualização'\n end",
"def tick_button_prefab button\n outputs.labels << button.label # outputs button's label and border\n outputs.borders << button.border\n\n if button_clicked? button # if button is clicked\n button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked\n end\n\n if button.clicked_at # if clicked_at has a frame value and is not nil\n # button is output; color changes and transparency changes for 0.25 seconds after click occurs\n outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,\n 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds\n end\n end",
"def actionNom\n\t\treturn \"Je sais rien faire :C\"\n\tend",
"def action\n end",
"def clicar_mais\n botao_mais.click\n end",
"def scaffold_button_to(text, url, options={})\n \"#{scaffold_form(url, options)}\\n<input type='submit' value='#{text}' />\\n</form>\"\n end",
"def selecionar_opcao\n btn_metro.click\n btn_bicicletario_vaga_verde.click\n foco(btn_vacinacao)\n end",
"def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end",
"def button_image\n raise 'Invalid option, only one of :confirm or :onclick allowed' if @options[:confirm] && @options[:onclick]\n\n if @options[:confirm]\n @options[:onclick] = \"return confirm('#{@options[:confirm]}');\" \n @options.delete(:confirm)\n end\n\n\n\n content_tag(\"button\",\n content_tag('span',@options[:content]),\n :type => 'submit',\n :onclick => @options[:onclick],\n :class => @options[:classes],\n :disabled => @options[:disabled],\n :style => @options[:styles],\n :value => @options[:value],\n :name => @options[:name] )\n end",
"def action(a)\n @actions << a\n puts a.msg\n end",
"def pantallaEstrategias nombre\n\t\t\n\t\t# Esr¿trategia a escoger por el usuario\n\t\testrategia = \"\"\n\t\t\n\t\t# Limpiamos pantalla\n\t\t@app.clear\n\t\t@app.background \"fondo.jpg\"\n\n\t\t# stack de botones\n\t\t@estrategias = @app.stack :top => \"130\", :left => \"400\"\n\t\t\n\t\t@estrategias.caption \"Jugador #{nombre}\"\n\t\t@estrategias.caption \"Escoge una estrategia de juego\"\n\t\t\n\t\t# Estrategia manual\n\t\t@manual = @estrategias.button \"Manual\"\n\t\t@manual.click do\n\t\t\testrategia = \"manual\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# EStrategia uniforme\n\t\t@uni = @estrategias.button \"Uniforme\"\n\t\t@uni.click do\n\t\t\testrategia = \"uniforme\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# Estrategia sesgada\n\t\t@ses = @estrategias.button \"Sesgada\"\n\t\t@ses.click do\n\t\t\testrategia = \"sesgada\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# Estrategia copiar\n\t\t@copiar = @estrategias.button \"Copiar\"\n\t\t@copiar.click do\n\t\t\testrategia = \"copiar\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# Estrategia pensar\n\t\t@pensar = @estrategias.button \"Pensar\"\n\t\t@pensar.click do\n\n\t\t\testrategia = \"pensar\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t\n\t\t\n\tend",
"def home()\n@ss.close\n @titleLabel.setVisible(true)\n @actionNew.setVisible(true)\nsetWindowTitle('Internet Cafe Customer Management System (I.C.C.M.S.) by SAFEW')\nend",
"def create\n redirect_to accesots_url and return# arbitratio, ted no permitir crear desde la web panel ok. ok.\n # @accesot = Accesot.new(accesot_params)\n\n # respond_to do |format|\n # if @accesot.save\n # format.html { redirect_to @accesot, notice: 'Accesot was successfully created.' }\n # format.json { render :show, status: :created, location: @accesot }\n # else\n # format.html { render :new }\n # format.json { render json: @accesot.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def exibir_lojas()\n lojas.click\n end",
"def link_account_click\n link_account_button.click\n end",
"def editar_destinatario\n editar_destinario_btn.click\n end",
"def question_classic_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def create_button_config( action_title_i19n_sym, action_title_i19n_scope_sym, image_name = \"cog.png\" )\n action_text = I18n.t( action_title_i19n_sym.to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )\n tooltip_text = I18n.t( \"#{action_title_i19n_sym}_tooltip\".to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )\n {\n :xtype => 'button',\n :id => action_title_i19n_sym.to_s,\n :name => action_title_i19n_sym.to_s,\n :icon => \"/images/icons/#{ image_name }\",\n :text => \"#{ action_text }\",\n :tooltip => \"#{ tooltip_text }\",\n :margin => '0 3 3 3'\n }\n end",
"def linkwizard_confirm_button\n $tracer.trace(__method__)\n return ToolTag.new(button.id(\"/btnSubmit/\") ,__method__)\n end",
"def share\n self.button(:id=>\"contentpermissions_members_autosuggest_sharebutton\").flash\n self.button(:id=>\"contentpermissions_members_autosuggest_sharebutton\").click\n wait_for_ajax\n end",
"def custom\n begin\n $results.log_action(\"button(#{@params[0]})\")\n if @driver.find_element(:id, \"btn-\" + @params[0]).displayed?\n @driver.find_element(:id, \"btn-\" + @params[0]).click\n $results.success\n else\n $results.fail(\"button(#{@params[0]})\")\n end\n rescue NoMethodError => ex\n puts \"\\nAn error of type #{ex.class} happened in #{@params[0]}.\\n\"\n rescue Exception => ex\n puts \"\\nAn error of type #{ex.class} happened in #{@params[0]}.\\n\"\n $results.fail(\"button(#{@params[0]})\", ex)\n end\n end",
"def acessar_login\n self.span_minha_conta.click\n self.button_entrar.click\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def linkwizard_next_button\n $tracer.trace(__method__)\n return ToolTag.new(button.className(\"/ats-search_button/\") ,__method__)\n end",
"def scaffold_button_to_remote(text, action, options) \n \"#{scaffold_form_remote_tag(action, options)}\\n<input type='submit' value=#{text} />\\n</form>\"\n end",
"def replace_with_button(interactive)\n old_url = interactive.url\n interactive.url = \"https://concord-consortium.github.io/button-interactive/\"\n interactive.authored_state = {\n version: \"1.0\",\n description: \"This component no longer works embedded in the page. Use the button below to open it in a new window.\",\n url: old_url,\n label: \"Open ➚\"\n }.to_json\n interactive.save!\nend",
"def updateAccessory\n @accessory.stringValue = @input.to_s unless @input.nil?\n @accessory.placeholderString = @placeholder.to_s unless @placeholder.nil?\n @accessory.toolTip = @labels.to_s unless @labels.nil?\n @accessory.textColor = MEalert.getColor(@coloration[:text], 'textColor')\n @accessory.backgroundColor = MEalert.getColor(@coloration[:background], 'backgroundColor')\n end",
"def act\n @page_title = _('Bulk_management')\n @page_icon = 'groups.png'\n end",
"def click_action(action)\n dom_reader.find_element(self.values).find(\"[data-action='#{action}']\").click\n end",
"def operations\n send(params[:ac])\n end",
"def setUserActionText _obj, _args\n \"_obj setUserActionText _args;\" \n end",
"def button_comprar_go_to_cart\n\n click_button 'Comprar Ahora'\nend",
"def toggle_advanced(action)\n toggle_advanced_icon.click if toggle_advanced_icon.text.include?(\"Show Advanced\") == action\n end",
"def linkbutton\n config[\"linkbutton\"]\n end",
"def show\n redirect_to :back#:actina => \"after_log_in_prosess\" :action => \"chouse\"\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n\n process_cloud_object_storage_buttons(params[:pressed])\n\n if !@flash_array.nil? && params[:pressed].ends_with?(\"delete\")\n javascript_redirect :action => 'show_list',\n :flash_msg => @flash_array[0][:message],\n :flash_error => @flash_array[0][:level] == :error\n elsif !@flash_array.nil?\n render_flash unless performed?\n end\n end",
"def click; end",
"def click; end",
"def click; end",
"def clicar_botao\n #mas antes vamos setar para esperar e garantir que o botao irá aparecer na tela. Está padrão no default env\n wait_for_botao\n botao.click\n end",
"def apphelp_protected_button_to( action, options_for_link, options_for_url = nil )\n apphelp_protected_buttons_to(\n [ action, options_for_link, options_for_url ]\n )\n end",
"def activar\n # flash[:notice] = \"klkkkk\"\n \n session[:cliente_id] = \"desktop\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n session[:tipo_cliente] = \"123\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n\n @tipo_cliente = \"desktop\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n @cliente_id = \"123\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n session[:chekeado] = \"chekeado\"\n\n if (session[:terminal_autorizada] == false)\n sign_out(current_user) \n end\n session[:terminal_autorizada] = true\n #creado para complemento (convention over configuration) del controlador del view de acticion de equipos. ok ted.\n end",
"def element_action(context={}, aspect_model)\n \n app = context[:app]\n \n app.render_element_action_menuitem({:text => app.t.cms_translations.translate, \n :id => 'content_translate' })\n \n end",
"def setAction(action)\n @action = action\n end",
"def lancementAccueil\n\t\t@@fenetre.changerWidget(HudAccueil.new(@@fenetre))\n\t\tself\n\tend",
"def activate\n submit.click\n end",
"def action_hook; end",
"def set_aes_action\r\n @aes_action = Action.find(params[:id])\r\n end",
"def custom_button(entity, action, path, label)\n\t\temployee_icons = {\"show\" => 'icons/icons_01.gif',\n\t\t\t\t\t\t\"new\" => 'icons/icons_02.gif',\n\t\t\t\t\t \"del\" => 'icons/icons_03.gif',\n\t\t\t\t\t\t\"edit\" => 'icons/icons_04.gif'\n\t\t}\n\t\tassign_icons = { \"show\" => 'icons/icons_05.gif',\n\t\t\t\t\"new\" => 'icons/icons_06.gif',\n\t\t\t \"del\" => 'icons/icons_07.gif',\n\t\t\t\t\"edit\" => 'icons/icons_08.gif'\n\t\t}\n\t\tstore_icons = { \"show\" => 'icons/icons_09.gif',\n\t\t\t\t\"new\" => 'icons/icons_10.gif',\n\t\t\t \"del\" => 'icons/icons_11.gif',\n\t\t\t\t\"edit\" => 'icons/icons_12.gif'\n\t\t}\n\t\tjob_icons = { \"show\" => 'icons/icons_13.gif',\n\t\t\t\t\"new\" => 'icons/icons_14.gif',\n\t\t\t\t\"del\" => 'icons/icons_15.gif',\n\t\t\t \"edit\" => 'icons/icons_16.gif'\n\t\t}\t\n\t\tshift_icons = { \"show\" => 'icons/icons_17.gif',\n\t\t\t\t\"new\" => 'icons/icons_18.gif',\n\t\t\t\t\"del\" => 'icons/icons_19.gif',\n\t\t\t\t\"edit\" => 'icons/icons_20.gif'\n\t\t}\t\t\t\t\t\t\t \n\t\ticons = { \"employee\" => employee_icons, \n\t\t\t \"assignment\" => assign_icons, \n\t\t\t \"store\" => store_icons, \n\t\t\t \"job\" => job_icons, \n\t\t\t \"shift\" => shift_icons\n\t\t}\n\t\timg_tag = image_tag(icons[entity][action], :alt => label)\n\t\treturn '<a href=\"' + path + '\" class=\"btn btn-large ' + action + '\">' + label + \" \" + img_tag + '</a>'\n\tend",
"def update!(**args)\n @action_label = args[:action_label] if args.key?(:action_label)\n @on_click = args[:on_click] if args.key?(:on_click)\n end",
"def update!(**args)\n @action_label = args[:action_label] if args.key?(:action_label)\n @on_click = args[:on_click] if args.key?(:on_click)\n end",
"def update!(**args)\n @action_label = args[:action_label] if args.key?(:action_label)\n @on_click = args[:on_click] if args.key?(:on_click)\n end",
"def update!(**args)\n @action_label = args[:action_label] if args.key?(:action_label)\n @on_click = args[:on_click] if args.key?(:on_click)\n end",
"def update!(**args)\n @action_label = args[:action_label] if args.key?(:action_label)\n @on_click = args[:on_click] if args.key?(:on_click)\n end",
"def update!(**args)\n @action_label = args[:action_label] if args.key?(:action_label)\n @on_click = args[:on_click] if args.key?(:on_click)\n end",
"def update!(**args)\n @action_label = args[:action_label] if args.key?(:action_label)\n @on_click = args[:on_click] if args.key?(:on_click)\n end",
"def atu_button()\n if $kx_model==2 and ($kx_atu or $kx_extatu)\n button_tap(20)\n elsif $kx_model==3 and ($kx_atu or $kx_extatu)\n button_tap(44)\n else\n return(nil)\n end\n return(true)\nend",
"def rcpstsave; det.button(:id, 'Save'); end",
"def nav_login_button\r\n \r\n end",
"def display_action_menu(player1, player2)\n puts \"\\nQuelle action veux-tu effectuer ?\"\n puts \"a - chercher une meilleure arme\"\n puts \"s - chercher à se soigner\"\n puts \"\\nattaquer un joueur en vue :\"\n print \"0 \"\n player1.show_state if player1.life_points > 0\n print \"1 \"\n player2.show_state if player2.life_points > 0\n end",
"def button\n @edit = session[:edit] # Restore @edit for adv search box\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n\n unless @refresh_partial # if no button handler ran, show not implemented msg\n add_flash(_(\"Button not yet implemented\"), :error)\n @refresh_partial = \"layouts/flash_msg\"\n @refresh_div = \"flash_msg_div\"\n end\n end",
"def integrated_slat_action_button_component_options\n { theme: (theme || :secondary),\n traits: traits,\n as: :a,\n confirm: confirm,\n disable_with: disable_with,\n href: href,\n method: send(:method),\n remote: remote,\n outlined: outlined,\n left_icon: icon }\n end",
"def action args = {}\n\t\tend"
] |
[
"0.5849234",
"0.5811676",
"0.572514",
"0.56416357",
"0.5608865",
"0.55964136",
"0.55945385",
"0.5587969",
"0.5579181",
"0.55044335",
"0.546723",
"0.5453149",
"0.54288894",
"0.5420646",
"0.5381472",
"0.53785914",
"0.53780025",
"0.53739834",
"0.53295493",
"0.5313517",
"0.5312684",
"0.53035235",
"0.5289988",
"0.5289988",
"0.52899355",
"0.5259673",
"0.5239382",
"0.5237069",
"0.52339333",
"0.52237064",
"0.52237064",
"0.52237064",
"0.52237064",
"0.52237064",
"0.5215244",
"0.52069294",
"0.51981086",
"0.51939917",
"0.5188295",
"0.51867473",
"0.5175325",
"0.51611453",
"0.51498437",
"0.51413465",
"0.5132754",
"0.51281744",
"0.5124364",
"0.5122045",
"0.5119043",
"0.51136905",
"0.5111713",
"0.5104198",
"0.5098634",
"0.50966406",
"0.5096522",
"0.5091925",
"0.5079004",
"0.50753456",
"0.5074272",
"0.5069956",
"0.5057426",
"0.5050803",
"0.5043229",
"0.5041737",
"0.503805",
"0.50365317",
"0.50342",
"0.5032757",
"0.50320745",
"0.5028551",
"0.5026899",
"0.50229853",
"0.5021027",
"0.5017812",
"0.5017812",
"0.5017812",
"0.5011738",
"0.50073665",
"0.49999756",
"0.49965096",
"0.4985666",
"0.49849033",
"0.4982429",
"0.49788982",
"0.49775594",
"0.49761537",
"0.49714324",
"0.49714324",
"0.49714324",
"0.49714324",
"0.49714324",
"0.49714324",
"0.49714324",
"0.49671513",
"0.49651688",
"0.4962946",
"0.49588546",
"0.4955209",
"0.49546096",
"0.49519247"
] |
0.58680916
|
0
|
::: cancel_button ::: ................................................................................................... Boton de estilo Cancelar (accion negativa) Muestra un enlace A con estilo Cancelar y el texto Cancelar Admite: Label, URL y clases adicionales
|
def cancel_button_form options
label = options[:label] ? options[:label] : "Cancelar"
url = options[:url] ? options[:url] : "#"
myclass = options[:class] ? "btn-action btn-cancel #{options[:class]}" : "btn-action btn-cancel"
link = options[:fancybox] ? link_to_function(label, "$.fancybox.close()") : link_to(label, url)
"<li><div class='#{myclass}'>#{link}</div></li>".html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cancel_button(destination_path)\n @template.link_to I18n.t('form.cancel'), destination_path,\n class: \"btn btn-default\"\n end",
"def cancel\n begin\n $results.log_action(\"button(#{@params[0]})\")\n # Cancel button can be either a link or an actual button object\n begin\n if @driver.find_element(:id, \"lnk-cancel\").displayed?\n @driver.find_element(:id, \"lnk-cancel\").click\n $results.success\n end\n rescue\n if @driver.find_element(:id, \"btn-cancel\").displayed?\n @driver.find_element(:id, \"btn-cancel\").click\n $results.success\n end\n end\n rescue => ex\n $results.fail(\"button(#{@params[0..-1].join(' ')})\", ex)\n end\n end",
"def cancel\n case\n when @browser.div(:id=>\"accountpreferences_preferContainer\").visible?\n @browser.div(:id=>\"accountpreferences_preferContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePassContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePassContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n else\n puts \"\\nCouldn't find the cancel button!\\n\"\n end\n end",
"def cancel_button(feedback)\n return \"\" unless feedback\n caption = \"<i class=\\\"icon-arrow-left\\\"></i> #{t('.cancel')}\"\n button = link_to article_path(feedback.article_id), class: \"btn\" do\n raw caption\n end\n button\n end",
"def link_to_cancel(url)\n link_to_remote(\"Cancel\", :url => url, :method => :get, :with => \"{ cancel: true }\")\n end",
"def cancel\n set_params\n show_translation\n end",
"def cancel_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(a.id(\"/btnClose$/\"), format_method(__method__))\n end",
"def new_site_cancel\n inactive_submit.click\n end",
"def subject_cancel\n self.cancel_button.click\n end",
"def cancel_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-cancelbtn\")), format_method(__method__))\n end",
"def cancel_tag(url, options = {})\n link_to((tag :input, { \"type\" => \"button\", \"value\" => \"Cancel\"}.update(options.stringify_keys)), url, :style => \"text-decoration: none;\")\n end",
"def cancel_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(a.id(\"/CancelLinkButton$/\"), format_method(__method__), @spec)\n end",
"def buttonCancel__clicked(*a)\n @builder[:window1].destroy\n end",
"def delete_cancel_button(**opt)\n opt[:action] ||= :delete\n cancel_button(**opt)\n end",
"def cancel_button_clicked\n\t\t\t@path = nil\n\t\t\tclose_and_cleanup\n\t\tend",
"def set_CancelURL(value)\n set_input(\"CancelURL\", value)\n end",
"def cancel(*args)\n options = args.extract_options!\n text = options.delete(:text) || (args.first if args.first.is_a?(String)) || 'Cancel'\n path = options.delete(:path) || @template.request.env['HTTP_REFERER'] || @template.send(\"#{@object_name.to_s.pluralize}_path\")\n attrs = { :class => 'cancel' }.merge!(options.delete(:attrs) || {})\n \n wrapper(:span, attrs, @template.link_to(text, path, options))\n end",
"def remove_cancel_button\n\t\t$tracer.trace(format_method(__method__))\n\t\treturn ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-cancelbtn\")), format_method(__method__))\n\tend",
"def cancel\n frm.button(:value=>\"Cancel\", :index=>-1).click\n AssignmentsList.new(@browser)\n end",
"def cancel\n @confirmation_header = \"confirm cancellation\"\n @confirmation_body = \"Are you Sure to cancel this subscription?\"\n @cancel = \"No, Thank you\"\n @submit = \"Confirm cancellation\"\n end",
"def submit_or_cancel(form, name='Cancel')\n form.submit + ' or ' + link_to(name, 'javascript:history.go(-1);', :class => 'cancel')\n end",
"def cancel\n flash[:notice] = \"Canceling accounts is not enabled.\"\n redirect_to root_path\n end",
"def edit_cancel_button\n # unit_test_no_generate: edit_cancel_button, a.className(create_ats_regex_string(\"ats-editcancelbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-editcancelbtn\")), __method__)\n end",
"def inline_cancel_button(class_extras = 'pull-right')\n \"<a class=\\\"show-entity show-#{hyphenated_name} #{class_extras} glyphicon glyphicon-remove-sign dropup\\\"\n title=\\\"cancel\\\"\n data-target=\\\"[data-subscription='#{hyphenated_name}-edit-form--#{@container.id}']\\\"\n data-toggle=\\\"clear-content\\\"></a>\".html_safe\n end",
"def cancel_link\n return_uri = controller.params[:_return_to]\n return_uri ||= controller.request.env['HTTP_REFERER']\n return_uri ||= controller.request.request_uri.gsub(%r{/[^/]+/?$}, \"\")\n return_uri = '/' if return_uri.empty?\n\n \"<input type='hidden' name='_return_to' value='#{return_uri}'></input><a href='#{return_uri}'>Cancel</a>\"\n end",
"def check_for_cancel\n if params[:commit] == t('dri.views.objects.buttons.cancel')\n if params[:id]\n redirect_to controller: 'my_collections', action: 'show', id: params[:id]\n else\n redirect_to controller: 'workspace', action: 'index'\n end\n end\n end",
"def check_for_cancel\n if params[:commit] == t('dri.views.objects.buttons.cancel')\n if params[:id]\n redirect_to controller: 'my_collections', action: 'show', id: params[:id]\n else\n redirect_to controller: 'workspace', action: 'index'\n end\n end\n end",
"def cancel(path, edit_path = nil, options ={})\n options[:class] ||= ''\n options[:class] << \"btn btn-default\"\n options[:data] = { confirm: \"Cancel without saving?\"}\n\n if edit_path && object.persisted?\n path = edit_path\n end\n @template.link_to('Cancel', path, options)\n end",
"def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end",
"def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end",
"def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end",
"def cancel_form handle_form_text \n click_to_handle_form handle_form_text\n cancel_form_alert_ok \n end",
"def cancel\n end",
"def cancel\n end",
"def submit_or_cancel(form, name='Cancel')\n form.submit + \" or \" +\n link_to(name, root_path, :class => \"for_black_font_link\")\n #link_to(name, 'javascript:history.go(-1);', :class => 'cancel')\n end",
"def ListView_CancelEditLabel(hwnd) send_listview_message(hwnd, :CANCELEDITLABEL) end",
"def cancel_button(project:, deploy:, **options)\n raise if !project || !deploy\n link_to(\n 'Cancel',\n [project, deploy, {redirect_to: request.fullpath}],\n options.merge(method: :delete, class: options.fetch(:class, 'btn btn-danger btn-xl'))\n )\n end",
"def check_for_cancel\n return unless params[:commit] == t( :cancel )\n back( notice: 'Alterações descartadas.' )\n end",
"def cancel_btn(path = root_path, options = {})\n btn_class = ['btn btn-warning waves-effect waves-light']\n btn_class << options[:class] if options[:class].present?\n\n link_to t('btn.cancel'), path, class: btn_class.join(' ')\n end",
"def cancel\n @service.context.post(@control_path, :action => 'cancel')\n self\n end",
"def cancel\n redirect_to( default_path ) if params[:commit] == 'cancel'\n end",
"def cancel_btn(path=root_path, options={})\n btn_class = 'btn btn-warning'\n btn_class << ' ' << options[:class] if options[:class].present?\n\n link_to t('btn.cancel'), path, class: btn_class\n end",
"def cancel_link(path_or_label, path = nil)\n label = path ? path_or_label : 'Cancel'\n path ||= path_or_label\n\n template.content_tag(:li, template.link_to(label, path), :class => 'link')\n end",
"def cancel\n redirect_to checkid_request.cancel_url\n end",
"def command_cancel\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(5)\r\n end",
"def cancel\n flash[:notice] = \"We're sorry you didn't buy :(. Please tell Sven at <a href='mailto:sven@paperboat.lu'>sven@paperboat</a> why you chose to cancel.\"\n redirect_to root_path\n end",
"def cancel\n # renders static page\n end",
"def on_uio_cancel\n @unit_list_swap_items.hide\n @basic_text_win.hide\n deactivate_all_but(@place_coms)\n @place_coms.activate\n @place_coms.show\n end",
"def cancel\n @error = :cancelled\n end",
"def check_for_cancel\n if params[:commit] == \"Cancel\"\n redirect_to forms_path\n end\n end",
"def click_cancel_js_popup(title)\n click_button_popup(title, \"Cancel\")\nend",
"def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end",
"def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end",
"def cancelar_hipoteca\n @hipotecada = false\n end",
"def clicked\n @cancel.clicked\n end",
"def cancel_and_redirect\r\n redirect_back\r\n end",
"def submit_or_cancel(cancel_url = session[:return_to] ? session[:return_to] : url_for(:action => 'index'), label = 'Save Changes')\n content_tag(:div, submit_tag(label) + ' or ' +\n link_to('Cancel', cancel_url), :id => 'submit_or_cancel', :class => 'submit')\n end",
"def cancel\n redirect_to root_url, flash[:alert] = \"Something went wrong.\"\n end",
"def cancel\n @result = :cancel\n $game_system.se_play($data_system.cancel_se)\n end",
"def check_for_cancel\n redirect_to @article if params[:commit] == 'Cancel'\n end",
"def cancel(params)\n request(Resources::RESOURCE_CANCEL, HTTP_METHOD_POST, params)\n end",
"def clicked\n # @cancel.clicked\n end",
"def cancelar_hipoteca(titulo)\n titulo.cancelar_hipoteca\n return true\n end",
"def store_finder_cancel_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-cancelbtn\")), format_method(__method__))\n end",
"def cancel_command()\n @command_window.active = true\n @optimize_modes_window_headers.visible = false\n @optimize_modes_window.active = false\n @optimize_modes_window.visible = false\n @status_window.window_update(nil, nil)\n @status_window.active = false\n @status_window.visible = false\n @remove = false\n @equip_window.active = false\n @equip_details_window.window_update(nil)\n @equip_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = true\n end",
"def cancel\n if params[:id]\n category = Category.find(params[:id])\n attribute(category, 'name')\n else\n render(:text => '<tr><td colspan=5></td></tr>')\n end\n end",
"def cancel; end",
"def cancel; end",
"def link_to_cancel( object )\n path = object.class.name.tableize\n path = if object.new_record?\n send( path.pluralize + '_path' )\n else\n send( path.singularize + '_path', object )\n end\n link_to \"Cancel\", path\n end",
"def on_title_cancel\n title_to_status\n end",
"def cancel\n # Define this later\n end",
"def is_cancel?(action_name)\n action_name == 'submit_cancel'\n end",
"def remove_button(and_confirm_cancel = nil)\n $tracer.trace(format_method(__method__))\n and_confirm_cancel == :and_confirm_cancel ? @spec.record.confirm.cancel : @spec.record.confirm.ok\n return ToolTag.new(@tag.find.input.id(\"/RemoveButton$/\"), format_method(__method__))\n end",
"def remove_button(and_confirm_cancel = nil)\n $tracer.trace(format_method(__method__))\n and_confirm_cancel == :and_confirm_cancel ? @spec.record.confirm.cancel : @spec.record.confirm.ok\n return ToolTag.new(@tag.find.input.id(\"/RemoveButton$/\"), format_method(__method__))\n end",
"def click_cancel_file_dialog_popup(title)\n click_button_popup(title, \"Cancel\")\nend",
"def submit_or_cancel_for_users(form, cancel_name = t('application.cancel')) # \"Cancel\"\n if logged_in?\n form.submit + \" \" + t('application.or') + \" \" + link_to(cancel_name, \"javascript:history.go(-1);\", :class => \"cancel\") # \"or\"\n else\n form.submit + \" \" + t('application.or') + \" \" + link_to(cancel_name, login_path, :class => \"cancel\") # \"or\"\n end\n end",
"def cancel\n self.update_status :cancelled\n end",
"def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end",
"def cancel!\n Bumbleworks.dashboard.cancel_expression(@fei)\n end",
"def link_to_cancel( object, options={})\n path = object.class.name.tableize\n path = if object.new_record?\n send( path.pluralize + '_path' )\n else\n send( path.singularize + '_path', object )\n end\n link_to \"Cancel\", path, options\n end",
"def check_cancel_submit\n redirect_to matters_path if params[:cancel]\n end",
"def link_to_cancel_new_deal (comment)\n link_to t('.cancel_new_deal'),\n util_cancel_new_deal_path(:comment_id => comment.id, :giftid => comment.gift.id),\n link_to_comment_options(comment, 'cancel')\n end",
"def cancel!; end",
"def cancel()\n\t\tagent = spike_login()['agent'] # Mechanize agent at successful login page\n\t\tgsr = spike_login()['gsr'] # Mechanize page = successful login page\n\t\t\n\t\tcancel = gsr.link_with(:text => 'Cancel')\n\t\tif (cancel.nil?)\n\t\t\traise \"Error: You have no GSR reservation to cancel.\"\n\t\telse\n\t\t\tgsr = cancel.click\n\t\tend\n\tend",
"def cancel_trip\n label = request_label(:cancel, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/cancel_trip\", \n :delete,\n head: headers,\n query: { trip_id: trip_id, customer_id: customer_id, customer_token: customer_token }\n ).response!(label)\n end",
"def cancel\n self.status = 'Cancelled'\n self.save!\n end",
"def cancel\n\t\tself.status = 'Canceled'\n\t\tself.save(validate: false)\n\tend",
"def cancel_cli\n generic_step(\"cancel\")\n end",
"def admin_discard(text = \"Discard\", url: :back, **kwargs)\n link_to(text, url, class: \"button button--text\", **kwargs)\n end",
"def onCancel flag, view\n ## puts \"onCancel called\"\n\t\tself.reset(view)\n\tend",
"def cancel(id); end",
"def cancel\n super\n end",
"def click_cancel_note_edit\n logger.debug 'Clicking the edit note Cancel button'\n wait_for_update_and_click edit_note_cancel_button_element\n end",
"def back_to_article_index_button\n caption = <<-HTML\n <i class='icon-arrow-left'></i> #{t('cancel')}\n HTML\n button = link_to articles_path, class: \"btn\" do\n raw caption\n end\n button\n end",
"def on_buy_cancel\n @command_window.activate\n #@dummy_window.show\n @buy_window.hide\n @status_window.hide\n @status_window.item = nil\n @help_window.clear\n end",
"def click_cancel_saveas_popup(title, save_file_path)\n click_button_saveas_or_openas_popup(title, save_file_path, \"Cancel\")\nend",
"def cancel\n super\n end",
"def cancel_command()\n @command_window.active = true\n @party_order_window.clean_indexes()\n @party_order_window.active = false\n @party_order_window.index = -1\n @battle_formations_window.active = false\n @battle_formation_details_window.window_update(nil)\n @battle_formation_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = true\n end",
"def on_pou_cancel\n @unit_list_swap_items.show\n @unit_list_swap_items.select(0)\n deactivate_all_but(@unit_list_swap_items)\n @unit_list_swap_items.activate\n @unit_list_swap_items.refresh\n @basic_text_win.show\n @party_or_unit_win.hide\n end",
"def cancel_command()\n # Switch Window\n @list_window.active = true\n @list_window.visible = true\n @content_window.active = false\n end"
] |
[
"0.7338342",
"0.7240847",
"0.71911776",
"0.7064689",
"0.7005302",
"0.6996349",
"0.6884849",
"0.68608487",
"0.68578446",
"0.685243",
"0.68412924",
"0.68083453",
"0.6783445",
"0.66754204",
"0.66505146",
"0.6648982",
"0.6630894",
"0.6558211",
"0.65406394",
"0.65252507",
"0.65203685",
"0.65157884",
"0.6507902",
"0.64961094",
"0.64799595",
"0.6468075",
"0.6468075",
"0.64667994",
"0.64661777",
"0.64661777",
"0.64661777",
"0.64641917",
"0.6459246",
"0.6459246",
"0.6433911",
"0.64003533",
"0.63951063",
"0.63867396",
"0.6372478",
"0.6369979",
"0.63563347",
"0.63529176",
"0.6352472",
"0.63007724",
"0.628886",
"0.62615925",
"0.62555784",
"0.6214566",
"0.61749625",
"0.616628",
"0.61651176",
"0.6163339",
"0.6163339",
"0.6149468",
"0.61490285",
"0.6143784",
"0.6138078",
"0.61379135",
"0.6125794",
"0.61167616",
"0.61082494",
"0.610657",
"0.60742223",
"0.60740167",
"0.60562885",
"0.60347307",
"0.60296756",
"0.60296756",
"0.6022177",
"0.6006585",
"0.6004636",
"0.59966975",
"0.5992131",
"0.5992131",
"0.5989548",
"0.59791297",
"0.5977421",
"0.5971349",
"0.59675884",
"0.5949126",
"0.5943151",
"0.5933052",
"0.59195775",
"0.5915105",
"0.59146243",
"0.5912531",
"0.59079283",
"0.59001493",
"0.58987266",
"0.58956164",
"0.5893043",
"0.58897567",
"0.58824307",
"0.5874765",
"0.586864",
"0.58574027",
"0.5844282",
"0.58273435",
"0.5819909",
"0.5806042"
] |
0.70672107
|
3
|
::: custom_item ::: ................................................................................................... Elemento personalizado: texto, link,... Admite: ID, label, hint, HTML Ejemplo: custom_item_form :label => 'Visita mi web', :html => link_to('miweb.es','
|
def custom_item_form options
group_html = "<li id='#{options[:id]}' class='p'>"
group_html += options[:label] ? "<label for='#{options[:id]}'>#{options[:label]}</label>" : ""
group_html += "<div class='wrap-custom-html'>#{options[:html]}</div>"
group_html += options[:hint] ? "<p class='inline-hints'>#{options[:hint]}</p>" : ""
group_html += "</li>"
group_html.html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mostrar_item(menu)\n\n\t\t# Si el item tiene url, controlador o accion, arma link, sino solo label\n\t\tif (menu.controller != '') or (menu.action != '') or (menu.url != '')\n\t\t\tif menu.url != ''\n\t\t\t\tlink_to menu.nombre, menu.url\n\t\t\telse\n\t\t\t\tlink_to menu.nombre, :controller => menu.controller, :action => menu.action\n\t\t\tend\n\t\telse\n\t\t\tmenu.nombre\n\t\tend\n\n\tend",
"def texto_longo_ecm_new_cadastro_item(form_item, params)\n view = \"\"\n unless params\n view.concat(text_area :cadastro, \"item_#{form_item.id}\", options={:cols=>form_item.opcoes[:largura], :rows=>form_item.opcoes[:altura]})\n else\n view.concat(text_area :cadastro, \"item_#{form_item.id}\", options={:value=>params[\"item_#{form_item.id}\"], :cols=>form_item.opcoes[:largura], :rows=>form_item.opcoes[:altura]})\n end\n return view\n end",
"def add_iform_link(name, id, obj, locals={})\n link_to_function name do |page|\n page.insert_html :bottom, id, :partial => 'iform', :object => obj, :locals => locals\n end\n end",
"def edit_form\n\t\titem_text = question_items.first.text #in_place_editor_field :question_cell, :items, {}, :rows => 3\n\t\tdiv_item(item_text, \"iteminformation\")\n\tend",
"def imagem_ecm_new_cadastro_item(form_item, params)\n view = \"\"\n view.concat(file_field :cadastro, \"item_#{form_item.id}\")\n return view\n end",
"def render_create_content_link(element, options = {})\n\t\t\t\tdefaults = {\n\t\t\t\t\t:label => t('add new content')\n\t\t\t\t}\n\t\t\t\toptions = defaults.merge(options)\n\t\t\t\tlink_to(\n\t\t\t\t\toptions[:label],\n\t\t\t\t\talchemy.admin_contents_path(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t\t:name => options[:content_name],\n\t\t\t\t\t\t\t:element_id => element.id\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t:method => 'post',\n\t\t\t\t\t:remote => true,\n\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t:class => 'button new_content_link'\n\t\t\t\t)\n\t\t\tend",
"def custom_field(label, contents)\r\n render_field(label, {}, contents)\r\n end",
"def html_link(item)\n tag :a, yield, :href => item.url\n end",
"def item_link(item)\n if !item.new_record?\n if item.respond_to?(:name)\n content_tag(:li, link_to(item.name, [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:headline)\n content_tag(:li, link_to(item.headline.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:title)\n content_tag(:li, link_to(item.title.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n end\n end\n end",
"def link_to_form(purpose, options = {}, html_options = nil)\n icon = case purpose\n when :new then 'add'\n when :edit then 'pencil'\n when :delete then 'cross' # TODO: delete should be a button, not a link\n when :cancel then 'arrow_undo'\n end\n if options.kind_of? String\n url = options\n else\n url = options.delete :url\n label = options.delete :label\n end\n label ||= purpose.to_s.capitalize\n legend = ( icon.nil? ?\n '' :\n \"<img src='/images/icons/#{icon}.png' alt=''></img> \" ) + label\n \n '<div class=\"buttons\">' +\n link_to(legend, (url || options), html_options) +\n '</div>'\n end",
"def new_association_link(name, f, model, additional_javascript = \"\")\n fields = new_child_fields(f, model.to_sym)\n link_to_function(name, raw(\"replace_content(this, \\\"#{model}\\\", \\\"#{escape_javascript(fields)}\\\");$(\\\"#add-#{model}-select-link\\\").show();$(\\\"#add-#{model}-entry-link\\\").hide();#{additional_javascript}\"), :id=> \"add-#{model}-entry-link\", :class=>\"add-child-form-link admin-link\")\n end",
"def generic_link(options = {})\n field_data = options[:value]\n contents = field_data.map do |item|\n json = JSON.parse item\n link_to json['text'], json['url']\n end\n content_tag 'span', contents.join('<br>'), nil, false\n end",
"def generic_link(options = {})\n field_data = options[:value]\n contents = field_data.map do |item|\n json = JSON.parse item\n link_to json['text'], json['url']\n end\n content_tag 'span', contents.join('<br>'), nil, false\n end",
"def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end",
"def to_html item\n super convert_flow @am.flow item\n end",
"def add_fields_link(name, f, association)\n if (name == nil or name == \"\" or f == nil or association == nil or association == \"\")\n return false\n end\n \n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n metarows = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields btn btn-primary\", data: {id: id, metarows: metarows.gsub(\"\\n\", \"\")})\n \n #return true #gets displayed in view\n end",
"def insert_new_instant_messenger_link(form)\n # New instant messenger link\n content_tag :p do\n form.fields_for :instant_messengers, form.object.instant_messengers.new do |nested_attributes|\n link_to_function t('instant_messengers.helper.new',\n :default => 'Add new Instant Messenger') do |page|\n page.insert_html :bottom, :instant_messengers,\n :partial => 'instant_messengers/form', :object => nested_attributes\n end\n end\n end\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENT YET>'\n end",
"def add_link(name, form, obj_name)\n field = ''\n form.fields_for obj_name, obj_name.to_s.classify.constantize.new do |f|\n field = render :partial => 'people/' + obj_name.to_s.singularize, :object => f\n end\n link_to_function name, :class => 'add' do |page|\n page << %{\n var new_id = \"new_\" + new Date().getTime();\n $('fieldset_#{obj_name}').insert({ bottom: \"#{ escape_javascript field }\"\\.replace(/new_\\\\d+/g, new_id) });\n }\n end\n end",
"def link_to_add_fields(name, f, type)\n new_object = f.object.send \"build_#{type}\"\n id = \"new_#{type}\"\n fields = f.send(\"#{type}_fields\", new_object, child_index: id) do |builder|\n render(type.to_s + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def titulo(texto) \n content_for(:titulo) { texto } \n end",
"def link_for_web_interface(item)\n url = url_for_web_interface(item)\n if url.blank?\n return display_name(item)\n else\n return link_to(display_name(item), url)\n end\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENTED YET>'\n end",
"def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t\t:class => 'small button with_icon new_content_link'\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\tend",
"def transform_item_to_html(item)\n label = item.label(@inject[item.name])\n\n html_list_item(item) do\n if item.url\n html_link(item) { label }\n else\n # Don't add an anchor element if no URL is set.\n tag :span, label, :class => 'disabled'\n end\n end\n end",
"def set_item(item)\n set_text(item ? item.description : \"\")\n end",
"def create_link(item_nr)\n \"<a href=\\'/item/#{item_nr}\\'>#{self}</a>\"\n end",
"def create_url_field(form,\n value,\n name,\n label,\n field_id,\n required: false,\n validation: nil,\n html_class: nil,\n is_multiple: false,\n readonly: false,\n index: 0,\n ttip: nil,\n example: nil,\n default_value: nil)\n render partial: 'dynamic_form/fields/text_field',\n locals: {\n f: form,\n multiple: is_multiple,\n index:,\n field_value: value,\n field_name: name,\n field_label: label,\n field_class: html_class,\n field_id:,\n input_type: 'url',\n readonly:,\n required:,\n validation:,\n ttip:,\n example:,\n default_value:\n }\n end",
"def cpf_cnpj_ecm_new_cadastro_item(form_item, params)\n view = \"\"\n unless params\n if form_item.opcoes[:tipo] == \"1\"\n view.concat(masked_text_field :cadastro, \"item_#{form_item.id}\", options={:mask=>\"999.999.999-99\"})\n elsif form_item.opcoes[:tipo] == \"2\"\n view.concat(masked_text_field :cadastro, \"item_#{form_item.id}\", options={:mask=>\"99.999.999/0009-99\"})\n else\n view.concat(masked_text_field :cadastro, \"item_#{form_item.id}\")\n end\n else\n if form_item.opcoes[:tipo] == \"1\"\n view.concat(masked_text_field :cadastro, \"item_#{form_item.id}\", options={:mask=>\"999.999.999-99\", :value=>params[\"item_#{form_item.id}\"]})\n elsif form_item.opcoes[:tipo] == \"2\"\n view.concat(masked_text_field :cadastro, \"item_#{form_item.id}\", options={:mask=>\"99.999.999/0009-99\", :value=>params[\"item_#{form_item.id}\"]})\n else\n view.concat(masked_text_field :cadastro, \"item_#{form_item.id}\", :value=>params[\"item_#{form_item.id}\"])\n end\n end\n return view\n end",
"def link_to_add_fields(name, icon, f, association, link_classes = '', create_children=nil)\n # Creates the new object\n new_object = f.object.class.reflect_on_association(association).klass.new\n\n # Create the object's children, if create_children is non-nil\n if create_children\n 4.times{new_object.send(create_children).build}\n end\n\n # Render the partial that will be insterted via javascript when this link is\n # clicked\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(:partial => association.to_s.singularize + \"_fields\", :locals => {:f => builder})\n end\n\n # The link text is an icon and the value of the <name> argument\n content = (\"<i class='#{icon}'></i> \" + name).html_safe\n\n # Link to the javascript that will insert the partial we rendered\n link_to_function(content, \"TemplateBuilder.add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\", :class => link_classes)\n end",
"def edit_form\n\t\tnewform = \"\"\n\t\titem_text = question_items.first.text #\n\t\tanswer_item = (self.answer_item.nil? or (self.answer_item =~ /\\d+([a-z]+)/).nil?) ? \"\" : \"\\t\" + $1 + \". \"\n\t\tself.question_items.each do |item|\n\t\t\tnewform = if item.position==1\n\t\t\t\tdiv_item( answer_item + item.text, \"itemquestiontext span-9\")\n\t\t\telse\n\t\t\t\tdiv_item( item_text, \"itemquestiontext span-9\")\n\t\t\tend\n\t\tend\n\t\tnewform\n\tend",
"def designed_button_link(&block)\n content_tag :div, :class => \"op-control\" do \n content_tag :ul, :class => \"cf\" do\n content_tag :li do\n content_tag :button do\n yield\n end\n end\n end\n end \n end",
"def add_link\n @bib.link.each do |l|\n case l.type&.downcase\n when \"doi\" then @item.doi = l.content\n when \"file\" then @item.file2 = l.content\n when \"src\" then @item.url = l.content\n end\n end\n end",
"def cama_form_element_bootstrap_object(form, object, values)\n html = \"\"\n object.each do |ob|\n ob[:label] = ob[:label].to_s.translate\n ob[:description] = ob[:description].to_s.translate\n r = {field: ob, form: form, template: (ob[:field_options][:template].present? ? ob[:field_options][:template] : Plugins::CamaContactForm::CamaContactForm::field_template), custom_class: (ob[:field_options][:field_class] rescue nil), custom_attrs: {id: ob[:cid] }.merge((JSON.parse(ob[:field_options][:field_attributes]) rescue {})) }\n hooks_run(\"contact_form_item_render\", r)\n ob = r[:field]\n ob[:custom_class] = r[:custom_class]\n ob[:custom_attrs] = r[:custom_attrs]\n ob[:custom_attrs][:required] = 'true' if ob[:required].present? && ob[:required].to_bool\n field_options = ob[:field_options]\n for_name = ob[:label].to_s\n f_name = \"fields[#{ob[:cid]}]\"\n cid = ob[:cid].to_sym\n\n temp2 = \"\"\n\n case ob[:field_type].to_s\n when 'paragraph','textarea'\n temp2 = \"<textarea #{ob[:custom_attrs].to_attr_format} name=\\\"#{f_name}\\\" maxlength=\\\"#{field_options[:maxlength] || 500 }\\\" class=\\\"#{ob[:custom_class].presence || 'form-control'} \\\">#{values[cid] || ob[:default_value].to_s.translate}</textarea>\"\n when 'radio'\n temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], ob[:field_type],values)\n when 'checkboxes'\n temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], \"checkbox\",values)\n when 'submit'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type=\\\"#{ob[:field_type]}\\\" name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'button'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type='button' name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'reset_button'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type='reset' name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'text', 'website', 'email'\n class_type = \"\"\n class_type = \"railscf-field-#{ob[:field_type]}\" if ob[:field_type]==\"website\"\n class_type = \"railscf-field-#{ob[:field_type]}\" if ob[:field_type]==\"email\"\n temp2 = \"<input #{ob[:custom_attrs].to_attr_format} type=\\\"#{ob[:field_type]}\\\" value=\\\"#{values[cid] || ob[:default_value].to_s.translate}\\\" name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'form-control'} #{class_type}\\\">\"\n when 'captcha'\n if form.recaptcha_enabled?\n temp2 = recaptcha_tags\n else\n temp2 = cama_captcha_tag(5, {}, {class: \"#{ob[:custom_class].presence || 'form-control'} field-captcha required\"}.merge(ob[:custom_attrs]))\n end\n when 'file'\n temp2 = \"<input multiple=\\\"multiple\\\" type=\\\"file\\\" value=\\\"\\\" name=\\\"#{f_name}[]\\\" #{ob[:custom_attrs].to_attr_format} class=\\\"#{ob[:custom_class].presence || 'form-control'}\\\">\"\n when 'dropdown'\n temp2 = cama_form_select_multiple_bootstrap(ob, ob[:label], \"select\",values)\n else\n end\n r[:template] = r[:template].sub('[ci]', temp2)\n r[:template] = r[:template].sub('[descr ci]', field_options[:description].to_s.translate).sub('<p></p>', '')\n html += r[:template].gsub('[label ci]', for_name)\n end\n html\n end",
"def links\n construct_html(self.items)\n end",
"def email_support_link\n select_list.a(:name => \"email-support\")\n # text: Email Support\n end",
"def link_to_add_fields(name, association, *args)\n options = args.extract_options!\n\n new_object = object.class.reflect_on_association(association).klass.new\n fields = fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n @template.render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n\n options.merge!(:class => \"add_fields btn\", :data => { :association => association, :content => CGI::escapeHTML(fields.gsub(/\\t|\\n|\\r/, \"\")) })\n @template.link_to(name, \"#\", options)\n end",
"def link_to_add_fields(name,f,association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association,new_object, :child_index=>\"new_#{association}\") do |builder|\n render(association.to_s.pluralize+\"/\"+association.to_s.singularize + \"_fields\", :f => builder)\n end\n ui_link_to_function('add',name,\"add_fields(this,\\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def link_to_add_fields(name,f,association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association,new_object, :child_index=>\"new_#{association}\") do |builder|\n render(association.to_s.pluralize+\"/\"+association.to_s.singularize + \"_fields\", :f => builder)\n end\n ui_link_to_function('add',name,\"add_fields(this,\\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def tag_for(item)\n if suppress_link?(item)\n content_tag('span', item.name, link_options_for(item).except(:method))\n else\n # Icon tag\n icon = ''\n if item.html_options[:icon]\n icon_options = item.html_options.delete :icon\n icon = content_tag('i', '', :class => icon_options)\n end\n\n # Text tag\n text = content_tag('span', item.name)\n\n # Badge tag\n badge = ''\n if item.html_options[:badge]\n badge_options = {class: item.html_options[:badge][:class], text: item.html_options[:badge][:text]}.reject { |_, v| v.nil? }\n badge = content_tag('small', badge_options[:text], :class => badge_options[:class])\n end\n\n # Generate link\n link_to(icon.html_safe + text.html_safe + badge.html_safe, item.url, options_for(item))\n end\n end",
"def item_edit\n end",
"def content_edit_action_item(text=nil, &block)\n icon = content_tag(:div, '', :class => 'iconEditSmall')\n content_action_item(text, icon, &block)\n end",
"def obfuscated_link_to(path, image, label, args={})\n _html = %{<form action=\"#{path}\" method=\"get\" class=\"obfuscated_link\">}\n _html << %{ <fieldset><input alt=\"#{label}\" src=\"#{image}\" type=\"image\" /></fieldset>}\n args.each{ |k,v| _html << %{ <div><input id=\"#{k.to_s}\" name=\"#{k}\" type=\"hidden\" value=\"#{v}\" /></div>} }\n _html << %{</form>}\n _html\n end",
"def ui_button_link(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Buttons::ButtonLink.new(content, options, html_options, &block).render\n end",
"def help(use_visibility_link)\n help_item = [get_field_config['label'], get_field_config['description']]\n if use_visibility_link\n visibility_link = html_form_id\n help_item << visibility_link\n end\n help_item\n end",
"def details_panel_item(label, value = nil, options = nil, &block)\n options, value = value, capture(&block) if block_given?\n options = options || {}\n\n label = label.to_s.titleize unless label.nil? || label.respond_to?(:titleize)\n\n item_html = options.delete(:item_html) || {}\n item_html[:class] = merge_html_classes('details-panel-item pure-u-1', item_html[:class])\n\n label_html = options.delete(:label_html) || {}\n\n value = value.try(:to_s)\n value = content_tag :span, '(blank)', class: 'text-muted' unless value.present?\n\n content_tag(:div, item_html) do\n content_tag(:label, label, label_html) + value\n end\n end",
"def link_to_item(item)\n return t(\"common.deleted_object\") if item.blank?\n text = item.respond_to?(:name) ? item.name : item.to_s\n link_to(text, item)\n rescue\n text\n end",
"def model_link(item, **opt)\n html_opt = remainder_hash!(opt, *MODEL_LINK_OPTIONS)\n type = (model_type unless item)\n item ||= object\n label = opt[:label] || :label\n label = item.send(label) if label.is_a?(Symbol)\n if opt[:no_link]\n html_span(label, html_opt)\n else\n # noinspection RubyMismatchedArgumentType\n path = (yield(label) if block_given?) || opt[:path] || opt[:path_method]\n path = path.call(item, label) if path.is_a?(Proc)\n html_opt[:title] ||= opt[:tooltip]\n html_opt[:title] ||=\n if (type ||= opt[:scope] || opt[:controller] || Model.for(item))\n I18n.t(\"emma.#{type}.show.tooltip\", default: '')\n end\n # noinspection RubyMismatchedArgumentType\n make_link(label, path, **html_opt)\n end\n end",
"def link\n Html::Link.new(:href => url) << display_name\n end",
"def content_element_form(context={})\n \n app = context[:app]\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end",
"def update_menu_item(value)\n update(name: value[:label], url: value[:link], target: value[:target])\n end",
"def link_text\n name\n end",
"def change_form_content \n\tend",
"def add_widget_child_link(name, f, method)\n fields = new_widget_child_fields(f, method)\n # name = add_no_alt_icon + \" \" + name\n link_to_function(name, h(\"insert_fields(this, \\\"#{method}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n end",
"def create\n @item = Item.new(item_params)\n\n if params.has_key?(:usa_wiki)\n @item.descricao = Utils::descricao_wiki(@item.get_name)\n if @item.descricao.nil?\n flash.now[:danger] = \"Não foi possível buscar a descrição do Wikipédia\"\n render :new\n return\n end\n end\n\n respond_to do |format|\n if @item.save\n flash[:success] = \"Item foi criado com sucesso!\"\n format.html { redirect_to @item }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def link_to_add_fields(name=nil, ff=nil, association=nil, options=nil,\n html_options=nil, attributes={}, &block)\n # If a block is provided there is no name attribute and the arguments are\n # shifted with one position to the left. This re-assigns those values.\n f, association, options, html_options = name, ff, association, options if block_given?\n\n options ||= {}\n html_options ||= {}\n\n locals = options[:locals] || {}\n partial = options[:partial] || association.to_s.singularize + '_fields'\n\n # Render the form fields from a file with the association name provided\n new_object = ff.object.class.reflect_on_association(association).klass.new(attributes)\n fields = ff.fields_for(association, new_object, child_index: 'new_record') do |builder|\n render(partial, locals.merge!( ff: builder))\n end\n\n # The rendered fields are sent with the link within the data-form-prepend attr\n html_options['data-form-prepend'] = raw CGI::escapeHTML( fields )\n html_options['href'] = '#'\n\n content_tag(:a, name, html_options, &block)\n end",
"def button_link content = nil, options = nil, html_options = nil, &block\n UiBibz::Ui::ButtonLink.new(content, options, html_options, &block).render\n end",
"def action_button_form options\n label = options[:label] ? options[:label] : \"Boton\"\n url = options[:url] ? options[:url] : \"#\"\n myclass = options[:class] ? \"btn-action #{options[:class]}\" : \"btn-action\"\n\n \"<li><div class='#{myclass}'>#{link_to(label, url)}</div></li>\".html_safe\n end",
"def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end",
"def html_link\n @params['links']['html']\n end",
"def fb_list_item(options={}, &block)\n content = capture(&block)\n options.merge!(:class=>'list_item clearfix')\n concat(content_tag(:div,content,stringify_vals(options)),block.binding)\n end",
"def fields_html(item=nil)\n fields.map { |f| f.to_html(item.try(f.name.to_sym), item) }.join(\"\\n\")\n end",
"def link_to_edit(path, *options)\n link_to path,\n class: \"btn btn-warning btn-sm\",\n title: \"Alterar\",\n style: \"color: #FFF; \" do\n content_tag :span, class: \"fa fa-pencil\" do\n options.first[:label] if options.present? && options.first[:label]\n end\n\n end\n end",
"def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n\t\trender(association.to_s.singularize + \"_fields\", :f => builder)\n\tend\n\t#Rails 3 doesn't need the h method\n #link_to_function(name, h(\"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n\tlink_to_function(name, (\"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n end",
"def description_input\n adding_field do |f|\n view_context.render \"questions/editor\", :f => f\n end\n end",
"def create\n @item = Item.new(params[:item])\n \n if logged_in?\n @item.user = current_user\n else\n @item.content = @item.content.gsub(/((<a\\s+.*?href.+?\\\".*?\\\")([^\\>]*?)>)/, '\\2 rel=\"nofollow\" \\3>')\n end\n \n # FIXME remove this, because title required\n if @item.title.empty?\n @item.title = @item.content.gsub(/\\<[^\\>]+\\>/, '')[0...40] + \"...\"\n end\n \n if ! logged_in? && ! passes_captcha?\n @item.errors.add(\"Word\")\n render :action => 'new'\n return\n end\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully posted.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def button(purpose = :edit, options = {}, html_options = {})\n # TODO: DRY the :a and :button.\n element, icon, nature = link_mapping( purpose )\n return unless element\n html_options.merge!(:class => nature)\n html_options.merge!(:href => (options[:url] || ''))\n @template.content_tag(element.to_s,\n legend( options, icon, purpose ),\n html_options)\n end",
"def render_dropdown\n '<li class=\"'+self.phone_class+'\">'+self.page_builder.context.link_to(iconed_label, '#', onclick: self.javascript) + '</li>'\n end",
"def add_medium_link(opts)\n unless opts.keys.include?(:object) || \n opts.keys.include?(:context)\n raise \"Must give object and context\" \n end\n klass = opts[:object].class.to_s.underscore\n opts[:text]||= I18n.t('add_link', \n :medium_label => I18n.t(opts[:context], :scope => [:activerecord, :attributes, klass]),\n :scope => [:has_media, :form])\n link_to_function opts[:text] do |page| \n page.insert_html :bottom, generate_uid(\n :object => opts[:object], \n :context => opts[:context]\n ), \n :partial => 'has_media/medium_field', \n :locals => {\n :object => opts[:object], \n :context => opts[:context]\n }\n end \n end",
"def link_to_add_entry page\n url = new_admin_page_path parent_id: @page.id, type: page_set_type(page)\n raw link_to 'Add Entry', url, class: 'button add', id: 'add-entry'\n end",
"def link_to_add_fields(name, form, association, this = nil)\n new_object = form.object.send(association).klass.new\n id = new_object.object_id\n\n fields = form.fields_for(association, new_object, child_index: id) do |builder|\n render(\"admin/partials/\" + association.to_s.singularize + \"_fields\", f: builder, resource: this)\n end\n\n link_to(name, \"#\", class: \"add-fields\", data: { id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def add_choice_link(attribute)\n display = attribute.preset? ? \"\" : \"none\"\n link_to_function(t(\"custom_attributes.add_choice\"), \"addAttributeChoices(this)\", :class => \"add_choice_link right_link\", :style => \"display: #{ display }\")\n end",
"def contact_field(contact, field_name, label=field_name)\n html=[]\n style=\"edit\"\n html << \"<label>#{label}</label>\"\n val = html_escape(contact.send(field_name))\n if val.blank?\n val = 'Click to edit' \n style << \" subtle-text\"\n end\n html << \"<span id=\\\"#{field_name}\\-#{contact.id}\\\" class=\\\"#{style}\\\">#{val}</span><br>\"\n html.join(\"\").html_safe\n end",
"def text_link(label,options={})\n options[:label]=label\n set RGhost::TextLinkIn.new(options)\n end",
"def nexia_link # :doc:\n content_box.a(:text => \"nexiahome.com\")\n end",
"def input_html_options; end",
"def input_text_with_search(objeto,campo,container_options = {},campo_options = {})\n route_for_seach = objeto.class.to_s.underscore.downcase.pluralize\n #opções de container_options\n container_class = container_options[:class].nil? ? \"field\" : container_options[:class]\n #opções de campo_options\n input_class = campo_options[:class].nil? ? \"\" : campo_options[:class]\n input_information = campo_options[:information] unless campo_options[:information].blank?\n input_error_message = campo_options[:error_message] unless campo_options[:error_message].blank?\n input_label_for = campo_options[:label_for].nil? ? \"txt#{campo.to_s.camelize}\" : campo_options[:label_for]\n input_name = campo_options[:input_name].nil? ? \"#{objeto.class.to_s.underscore.downcase}[#{campo}_name]\" : campo_options[:input_name]\n input_type = campo_options[:input_type].nil? ? \"text\" : campo_options[:input_type]\n\n input_hidden_name = \"#{objeto.class.to_s.underscore.downcase}[#{campo}_id]\"\n\n container = %()\n container << \"<div class='#{container_class}'>\"\n container << \"<span class='searchBtn'>\"\n container << \"<input type='hidden' name='#{input_hidden_name}' id='txtId'/>\"\n container << \"<label for='#{input_label_for}'>\"\n container << t(\"activerecord.attributes.#{objeto.class.to_s.underscore.downcase}.#{campo.to_s}\")\n container << \"<input type='text' name='#{input_name}' id='txtName' disabled='disabled' />\"\n container << link_to(\"...\",\"javascript:createSearchPopup(\\\"/admin/#{route_for_seach}/search\\\", 760, 540)\",:class => \"filter\",:title => \"clique para abrir o campo de busca\")\n container << \"</label>\"\n container << \"</span>\"\n container << \"<div class=\\\"clear\\\"> </div></div>\"\n container.html_safe\n end",
"def email_feedback_link\n select_list.a(:name => \"email-feedback\")\n # text: Send Suggestions/Feedback\n end",
"def typus_form_externals\n html = \"\"\n if @form_fields_externals\n @form_fields_externals.each do |field|\n model_to_relate = field.singularize.camelize.constantize\n # FIXME: The admin shouldn't be hardcoded.\n html << \"<h2 style=\\\"margin: 20px 0px 10px 0px;\\\"><a href=\\\"/admin/#{field}\\\">#{field.titleize}</a> <small>#{link_to \"Add new\", :model => field, :action => 'new', :btm => params[:model], :bti => params[:id], :bta => params[:action]}</small></h2>\"\n items_to_relate = (model_to_relate.find(:all) - @item.send(field))\n if items_to_relate.size > 0\n html << <<-HTML\n #{form_tag :action => \"relate\", :related => field, :id => params[:id]}\n <p>#{select \"model_id_to_relate\", :related_id, items_to_relate.map { |f| [f.name, f.id] }}\n #{submit_tag \"Add\"}\n </form></p>\n HTML\n end\n current_model = params[:model].singularize.camelize.constantize\n @items = current_model.find(params[:id]).send(field)\n html << typus_table(field, 'relationship') if @items.size > 0\n end\n end\n return html\n rescue Exception => error\n \"<p>There was an error when loading <code>config/typus.yml</code>.</p>\n <h3>Error</h3>\n <pre>#{error}</pre>\"\n end",
"def content_element_form_extension(context={})\n \n app = context[:app]\n \n locals = {:photo_album => SystemConfiguration::Variable.get('content_album_name').value, \n :width => SystemConfiguration::Variable.get('content_album_photo_width').value, \n :height => SystemConfiguration::Variable.get('content_album_photo_height').value}\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form_extension = renderer.render('formextension', 'em', locals)\n \n \n end",
"def set_product\n\t\t@firma = Firma.new\n\t\t@firma[:link]=\"www.fonasa.cl\"\n\tend",
"def create_and_link(title, itype, ltype, o={})\n item = Item.find_or_create(title, itype, o)\n Link.find_or_create(item.id, id, ltype, o)\n end",
"def call\n html.gsub(/\\[\\[([^\\]|]*)(\\|([^\\]]*))?\\]\\]/) do\n link = $1\n desc = $3 ? $3 : $1\n\n \"<a href=\\\"#{to_link link}\\\">#{to_description desc}</a>\"\n end\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields btn btn-success btn-block\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def new\n @instancia_item = InstanciaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end",
"def s_label; det.link(:text, 'Label'); end",
"def single_item_action_add_form_fields(form, document)\n single_item_action_form_fields(form, document, 'add')\n end",
"def remove_link\n # cocoon JS needs class specifically remove_fields.dynamic, just treat em all\n # like dynamic, it seems okay.\n template.link_to(I18n.t(\"kithe.repeatable_input.remove\"), '#', class: \"remove_fields dynamic btn btn-secondary\")\n end",
"def set_elements\n super\n element(:new_bib_button) {b.input(:id => \"bibCreateCurrentItemButton\")}\n element(:item_type_selector) {b.select_list(:id => \"newPurchasingItemLine.itemTypeDescription\")}\n element(:copies_field) {b.text_field(:id => \"newPurchasingItemLine.oleItemQuantity\")}\n element(:parts_field) {b.text_field(:id => \"newPurchasingItemLine.itemNoOfParts\")}\n element(:list_price_field) {b.text_field(:id => \"newPurchasingItemLine.itemListPrice\")}\n element(:public_view_checkbox) {b.checkbox(:id => \"newPurchasingItemLine.itemPublicViewIndicator\")}\n element(:item_price_source_selector) {b.select_list(:id => \"newPurchasingItemLine.itemPriceSourceId\")}\n element(:request_source_selector) {b.select_list(:id => \"newPurchasingItemLine.requestSourceTypeId\")}\n element(:format_selector) {b.select_list(:id => \"newPurchasingItemLine.formatTypeId\")}\n element(:category_selector) {b.select_list(:id => \"newPurchasingItemLine.categoryId\")}\n element(:route_to_requestor_checkbox) {b.checkbox(:id => \"newPurchasingItemLine.itemRouteToRequestorIndicator\")}\n element(:discount_field) {b.text_field(:id => \"newPurchasingItemLine.itemDiscount\")}\n element(:discount_type_selector) {b.select_list(:id => \"newPurchasingItemLine.itemDiscountType\")}\n element(:add_button) {b.input(:name => \"methodToCall.addItem\")}\n end",
"def add_me_link\n link_to_function(_(\"add me\")) do |page|\n page.insert_html(:bottom, \"task_notify\",\n :partial => \"tasks/notification\",\n :locals => { :notification => current_user })\n end\n end",
"def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end",
"def click_add_line_items_link\n add_line_items_link.click\n end",
"def link_to_add_field(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s + \"_form\", :f => builder)\n end\n link_to_function(name, (\"add_field(this, '#{association}', '#{escape_javascript(fields)}')\"))\n end",
"def render_crud_form_field(column, item, locals)\n locals = locals.merge({:item => item, :column => column})\n\n if param(column,:grouped_select)\n return content_tag(\n \"select\",\n tag(\"option\", :value => \"\") + grouped_options_for_select(param(column,:grouped_select), @item.send(column[:name])),\n :id => \"#{@singular.underscore}_#{column[:name]}\",\n :name => \"#{@singular.underscore}[#{column[:name]}]\"\n )\n elsif param(column,:select)\n locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n else\n type = param(column, :type, (item.attributes.include?(column[:name].to_s) ? item.column_for_attribute(column[:name]).type : \"other\")).to_s\n type = 'other_record' if param(column, :type, '') == '' && item.respond_to?(column[:name].to_s+\"_id\") && (attribute_class(column).respond_to?(:find) || column.include?(:find_class))\n locals = locals.merge({:type => type})\n\n if class_exists?('Lico::AutoCrud::Types::' + type.classify)\n return get_class('Lico::AutoCrud::Types::' + type.classify).to_input(item, column[:name], locals[:f], locals[:params])\n end\n \n return case type.to_sym\n when :boolean then locals[:f].check_box(column[:name], :class => 'in_boolean')\n when :country_select then locals[:f].localized_country_select(\n column[:name].to_s,\n [:NL, :BE, :LU, :FR, :DE],\n { :include_blank => '' },\n param(column, :params, { }).merge({ :class => 'in_country_select' })\n )\n when :currency then number_to_currency(0, :format => \"%u\") + \" \".html_safe + locals[:f].text_field(column[:name], :class => 'in_currency', :style => 'text-align: right', :value => number_to_currency(@item.send(column[:name]).to_f, :separator => \".\", :delimiter => \"\", :format => \"%n\"))\n when :custom then send(\"input_for_#{@singular.underscore}_#{column[:name].to_s}\", locals[:f], item)\n when :date then locals[:f].date_select(column[:name], param(column, :options, {}),{ :class => 'in_date' })\n when :time then locals[:f].time_select(column[:name], param(column, :options, {}),{ :class => 'in_time' })\n when :datetime then locals[:f].datetime_select(column[:name], :minute_step => 15, :class => 'in_datetime')\n when :file then locals[:f].file_field(column[:name], :class => 'in_file')\n when :hidden then locals[:f].hidden_field(column[:name], param(column, :params, { }).merge({:class => 'in_hidden'}))\n when :no_input then @item.send(column[:name])\n when :other_record then\n find_class = column.include?(:find_class) ? column[:find_class] : attribute_class(column)\n find_conditions = column[:conditions]\n find_items = find_class.find(:all, :select => param(column, :select, nil), :joins => param(column, :joins, []), :include => param(column, :include, []), :conditions => find_conditions).collect do |element| \n [ element.to_s, element.id ]\n end\n locals[:f].select(\"#{column[:name].to_s}_id\", find_items, { :include_blank => true }.merge(param(column, :options, {})))\n when :paperclip then\n item.send(column[:name].to_s).nil? ? \n # no image\n locals[:f].file_field(column[:name], :class => 'in_paperclip') :\n\n # with image\n image_tag(item.send(column[:name].to_s, param(column, :size))) +\n content_tag(\n \"div\", \n t('paperclip.upload_new') + \" \" + locals[:f].file_field(column[:name], :class => 'in_paperclip') +\n content_tag(\n \"div\",\n locals[:f].check_box(\"#{column[:name]}_delete\") +\n locals[:f].label(\"#{column[:name]}_delete\", t('paperclip.select_unlink'))\n )\n )\n when :password then locals[:f].password_field(column[:name], :class => 'in_password')\n when :select then locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n when :textarea then locals[:f].text_area(column[:name], {:class => 'in_textarea'}.merge(param(column, :params, { })))\n else\n locals[:f].text_field(column[:name], param(column, :params, { }).merge({:class => 'in_' + type}))\n end\n end\n end",
"def link_to_add_fields(name, f, association, divname, count_range, max_len, add_class)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n link_to_function(name, \"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\", \\\"#{divname}\\\", \\\"#{count_range}\\\")\", :class => \"add_fields \"+ add_class, 'data-max_len'=> max_len )\n\n end",
"def link(link_text)\n element(damballa(link_text+\"_link\")) { |b| b.link(:text=>link_text) }\n action(damballa(link_text)) { |b| b.link(:text=>link_text).click }\n end",
"def custom_link\n if self.permalink.blank?\n self.company_name\n else\n self.permalink\n end\n end",
"def html(args = nil)\n if args and args[:edit]\n url = self.url_edit\n else\n url = self.url\n end\n\n return \"<a href=\\\"#{Knj::Web.ahref_parse(url)}\\\">#{self.name_html}</a>\"\n end",
"def render\n # link_text = \"<span class='item-icon'>#{render_icon}</span>\"\n # link_text += \"<span class='descriptor-icon'>#{options[:descriptor_icon]}</span>\" if options[:descriptor_icon]\n # link_text += \"<span class='item-text'>#{h @name}</span>\"\n # link_text += \"<span class='item-count'>#{delimit @count}</span>\" if count\n # item = ''\n # item += \"<li>#{s_link_to link_text, @url, @options.selected_if(selected?)}</li>\" if count.nil? || count.positive?\n #\n # s item\n\n link_text = content_tag(:span, render_icon, class: 'item-icon')\n link_text += content_tag(:span, options[:descriptor_icon], class: 'descriptor-icon') if options[:descriptor_icon]\n link_text += content_tag(:span, @name, class: 'item-text')\n link_text += content_tag(:span, delimit(@count), class: 'item-count') if count\n\n content_tag :li do\n link_to link_text, @url, @options.selected_if(selected?)\n end\n\n end"
] |
[
"0.62943274",
"0.6286281",
"0.61402404",
"0.6097704",
"0.60930884",
"0.60856867",
"0.6066599",
"0.59867543",
"0.5954744",
"0.59289163",
"0.5901942",
"0.58983815",
"0.58983815",
"0.5868188",
"0.5823106",
"0.58228856",
"0.5783654",
"0.57812494",
"0.5779564",
"0.57718223",
"0.5745253",
"0.5738904",
"0.5737181",
"0.5721749",
"0.5705092",
"0.5701913",
"0.565023",
"0.56368166",
"0.56039757",
"0.55944496",
"0.55894977",
"0.55894136",
"0.5575911",
"0.55747056",
"0.55623496",
"0.5553849",
"0.55409014",
"0.5521019",
"0.5521019",
"0.5512434",
"0.5511443",
"0.5507817",
"0.54998815",
"0.54982394",
"0.54844606",
"0.54699874",
"0.5465208",
"0.5440383",
"0.5429328",
"0.5425469",
"0.5420688",
"0.54109824",
"0.5406343",
"0.54054105",
"0.539718",
"0.5395905",
"0.5371547",
"0.53707296",
"0.5370705",
"0.53513026",
"0.534833",
"0.532331",
"0.5320156",
"0.53138846",
"0.5288859",
"0.52875286",
"0.5280441",
"0.5279656",
"0.52787775",
"0.5275252",
"0.52747947",
"0.52709144",
"0.52523875",
"0.52498156",
"0.5247861",
"0.5243837",
"0.5239358",
"0.52313346",
"0.5229885",
"0.5224273",
"0.5223751",
"0.5223717",
"0.5223565",
"0.5220608",
"0.5220466",
"0.52177477",
"0.52174044",
"0.52079725",
"0.52037674",
"0.52009606",
"0.5198934",
"0.5197752",
"0.5191058",
"0.5186106",
"0.51849616",
"0.5184584",
"0.5182812",
"0.5182074",
"0.51815224",
"0.51779044"
] |
0.69687176
|
0
|
::: bp_directory_index ::: Muestra un arbol de carpetas y vistas en funcion del path del request
|
def bp_directory_index
tree_hash = BP.same_level_views("/base_project#{request.env['PATH_INFO']}")
p tree_hash
out = "<ul>"
tree_hash.keys.each do |tree_hash_key|
thk = tree_hash_key.gsub(".html.erb", "")
thk = thk.gsub("/mocks", "")
out += content_tag :li, thk.gsub("/", "")
out += "<ul>"
tree_hash[tree_hash_key].each do |tree_hash_value|
thv = tree_hash_value.gsub(".html.erb", "")
if thv != "index"
out += content_tag :li, link_to("#{thv}", "/mocks?t=#{thk}/#{thv}")
end
end
out += "</ul>"
out += "</li>"
end
out += "</ul>"
out.html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def directory_index\n end",
"def path(*) end",
"def bp_mock_directory_index\n\n tree_hash = BP.same_level_views(\"/mocks\")\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li, thk.gsub(\"/\", \"\")\n\n out += \"<ul>\"\n tree_hash[tree_hash_key].each do |tree_hash_value|\n thv = tree_hash_value.gsub(\".html.erb\", \"\")\n if thv != \"index\"\n out += content_tag :li, link_to(\"#{thv}\", \"/mocks/no_layout?t=#{thk}/#{thv}\")\n end\n\n end\n out += \"</ul>\"\n\n out += \"</li>\"\n end\n out += \"</ul>\"\n\n out.html_safe\nend",
"def index\n # List all folders and files in project result directory\n case params[:type]\n when 'result'\n # Get data: folder, file, path\n @content = BrowsingFile.bind_folder \"automations/#{params[:fold]}/reports\"\n @file = BrowsingFile.bind_files \"automations/#{params[:fold]}/reports\"\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=automations/%s/reports'>%s result</a>\" % [params[:fold], params[:fold]]\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n when 'checksum_comparison'\n @content = BrowsingFile.bind_folder 'public/checksum_packages'\n @file = BrowsingFile.bind_files 'public/checksum_packages'\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=public/checksum_packages'>checksum results</a>\"\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n end\n end",
"def directory_index\n return @directory_index\n end",
"def route_index; end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @directories }\n end\n end",
"def path() end",
"def path() end",
"def path() end",
"def url_for_index; end",
"def url_for_index; end",
"def directory; end",
"def directory; end",
"def path\n end",
"def path\n end",
"def path\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def directories; end",
"def directories; end",
"def scan(url)\n split_url_raw = url.split('/').find_all { |e| e!='' }\n split_url = split_url_raw.map { |u| Tree::Node.new(u, value: {:type => :directory}) }\n if url[-1] != '/' then \n split_url.last.value = {:type => :file}\n end\n match = @tree.root.scan_path(split_url) \n if !match then \n raise RoutingError, \"Can not find path in tree #{url}\"\n end\n\n node = match[:node]\n\n result = OpenStruct.new\n\n # if we point to a directory, fall-back to index\n if node.value[:type] != :file then \n index = node.children.find { |x| x.name == 'index' }\n if !index then \n raise RoutingError, \"Can't find index page in #{node.inspect}, we have #{node.children.map { |c| c.inspect}.join(\"<br>\")}\"\n end\n node = index \n result.action = 'index'\n else \n # sucalls\n if split_url.last.name =~ /^\\-(.*)\\-(.*)$/ then \n result.action = $1\n result.subcall = $2\n end\n end\n\n assigns = match[:assigns]\n\n\n result.url = url\n result.assigns = assigns\n result.script = node.value[:path]\n result.action ||= split_url.last.name\n result.base_url = split_url_raw.join('/')\n result.action_module = make_module(node.value[:base_path]) ## result.base_url)\n \n p = node\n pt = []\n begin\n val = p.value || {}\n pt << p if val[:type] == :directory\n p = p.parent\n end while p\n \n result.path_tree = pt\n\n last_part = split_url.last ? split_url.last.name : ''\n if last_part =~ /^\\-(.*)\\-(.*)$/ then \n result.subcall = $2\n result.action = $1\n end\n\n result\n end",
"def directory_index\n @hash[\"DirectoryIndex\"]\n end",
"def generate_directory_index(path)\n html = generate_header(path.blank? ? '/' : path, path)\n\n node = @server.tree.node_for_path(path)\n if node.is_a?(ICollection)\n html << '<section><h1>Nodes</h1>'\n html << '<table class=\"nodeTable\">'\n\n sub_nodes = @server.properties_for_children(\n path,\n [\n '{DAV:}displayname',\n '{DAV:}resourcetype',\n '{DAV:}getcontenttype',\n '{DAV:}getcontentlength',\n '{DAV:}getlastmodified'\n ]\n )\n\n sub_nodes.each do |sub_path, _sub_props|\n sub_node = @server.tree.node_for_path(sub_path)\n full_path = @server.base_uri + Http::UrlUtil.encode_path(sub_path)\n (_, display_path) = Http::UrlUtil.split_path(sub_path)\n\n sub_nodes[sub_path]['subNode'] = sub_node\n sub_nodes[sub_path]['fullPath'] = full_path\n sub_nodes[sub_path]['displayPath'] = display_path\n end\n sub_nodes.sort { |a, b| compare_nodes(a, b) }\n\n sub_nodes.each do |_, sub_props|\n type = {\n 'string' => 'Unknown',\n 'icon' => 'cog'\n }\n if sub_props.key?('{DAV:}resourcetype')\n type = map_resource_type(sub_props['{DAV:}resourcetype'].value, sub_props['subNode'])\n end\n\n html << '<tr>'\n html << '<td class=\"nameColumn\"><a href=\"' + escape_html(sub_props['fullPath']) + '\"><span class=\"oi\" data-glyph=\"' + escape_html(type['icon']) + '\"></span> ' + escape_html(sub_props['displayPath']) + '</a></td>'\n html << '<td class=\"typeColumn\">' + escape_html(type['string']) + '</td>'\n html << '<td>'\n if sub_props.key?('{DAV:}getcontentlength')\n html << escape_html(sub_props['{DAV:}getcontentlength'].to_s + ' bytes')\n end\n html << '</td><td>'\n if sub_props.key?('{DAV:}getlastmodified')\n last_mod = sub_props['{DAV:}getlastmodified'].time\n html << escape_html(last_mod.strftime('%B %e, %Y, %l:%M %P'))\n end\n html << '</td>'\n\n button_actions = ''\n if sub_props['sub_node'].is_a?(IFile)\n button_actions = '<a href=\"' + escape_html(sub_props['fullPath']) + '?sabreAction=info\"><span class=\"oi\" data-glyph=\"info\"></span></a>'\n end\n\n box = Box.new(button_actions)\n @server.emit('browserButtonActions', [sub_props['fullPath'], sub_props['subNode'], box])\n button_actions = box.value\n\n html << \"<td>#{button_actions}</td>\"\n html << '</tr>'\n end\n\n html << '</table>'\n\n end\n\n html << '</section>'\n html << '<section><h1>Properties</h1>'\n html << '<table class=\"propTable\">'\n\n # Allprops request\n prop_find = PropFindAll.new(path)\n properties = @server.properties_by_node(prop_find, node)\n\n properties = prop_find.result_for_multi_status[200]\n\n properties.each do |prop_name, prop_value|\n if @uninteresting_properties.include?(prop_name)\n html << draw_property_row(prop_name, prop_value)\n end\n end\n\n html << '</table>'\n html << '</section>'\n\n # Start of generating actions\n\n output = ''\n if @enable_post\n box = Box.new(output)\n @server.emit('onHTMLActionsPanel', [node, box])\n output = box.value\n end\n\n if output\n html << '<section><h1>Actions</h1>'\n html << '<div class=\"actions\">'\n html << output\n html << '</div>'\n html << '</section>'\n end\n\n html << generate_footer\n\n @server.http_response.update_header('Content-Security-Policy', \"img-src 'self'; style-src 'self';\")\n\n html\n end",
"def call env\n dir = File.join @public_dir, env['PATH_INFO']\n rewrite = env['PATH_INFO'] \n @order.reverse.each do |index|\n full_index = File.join dir, index\n new_path = File.join env['PATH_INFO'], index\n rewrite = new_path if File.exist? full_index\n end if File.directory? dir\n env['PATH_INFO'] = rewrite\n @app.call env\n end",
"def split_path; end",
"def search_path; end",
"def search_path; end",
"def ingest_path_info\n respond_to do |format|\n format.json {render json: ingest_directory_info(params[:path])}\n end\n end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def directory(dir); end",
"def index\n @directories = Directory.all\n end",
"def base_dir_for_path_parameters; end",
"def dir=(_arg0); end",
"def index_path\n \"#{path}/index.html\"\n end",
"def index(path = \"/\")\n \t\tlogin_filter\n\t\tpath = namespace_path(path)\n\t\t\n\t\tlist = @agent.post(\"/browse2#{path}?ajax=yes\", {\"d\"=> 1, \"t\" => @token })\n\t\t\n\t\tlisting = list.search('div.browse-file-box-details').collect do |file|\n\t\t\tdetails = {}\n\t\t\tdetails['name'] = file.at('div.details-filename a').content.strip\n\t\t\tdetails['url'] = file.at('div.details-filename a')[\"href\"]\n\t\t\t#details['size'] = file.at('div.details-size a').try(:content).try(:strip)\n\t\t\t#details['modified'] = file.at('div.details-modified a').try(:content).try(:strip)\n\t\t\t\n\t\t\tif match_data = details['url'].match(/^\\/browse_plain(.*)$/)\n\t\t\t\tdetails['directory'] = true\n\t\t\t\tdetails['path'] = normalize_namespace(match_data[1])\n\t\t\telsif match_data = details['url'].match(%r{^https?://[^/]*/get(.*)$})\n\t\t\t\tdetails['directory'] = false\n\t\t\t\tdetails['path'] = normalize_namespace(match_data[1])\n elsif match_data = details['url'].match(%r{^https?://[^/]*/u/\\d*/(.*)$})\n details['directory'] = false\n details['path'] = \"Public/#{match_data[1]}\"\n\t\t\telse\n\t\t\t\traise \"could not parse path from Dropbox URL: #{details['url'] }\"\n\t\t\tend\n\t\t\t\n\t\t\tdetails\n\t\tend\n\t\t#\n\n\t\treturn listing\n\tend",
"def dir(*) end",
"def basepath; end",
"def path(controller,folder, link_to_self,matter=nil)\n # the base url for a path is always the same:\n unless folder==nil\n url = url_for(:controller => controller, :action => 'folder_list', :id => nil)\n # start with the deepest folder and work your way up\n if link_to_self\n path = h(folder.name)\n id = folder.id.to_s\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n path = truncate_hover(folder.name,18,true) + \"/\" + path + '»'\n end\n\n # Finally, make it a link...\n path = ' <a href=\"#\" onclick= \"GetFoldersList('+ id + ',true);return false;\">' + h(path) + '» </a> '\n else\n path = truncate_hover(folder.name,30,false)\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n if controller=='workspaces'\n path =' <a href=\"#\" onclick= \"GetFoldersList('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '» </a> '+ path\n elsif controller=='repositories'\n path =' <a href=\"#\" onclick= \"GetFoldersListRepository('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '» </a> '+ path\n elsif controller=='document_homes'\n path =' <a href=\"#\" onclick= \"GetFoldersListMatter('+ folder.id.to_s + ',true,this,' + matter.id.to_s + ');return false;\">' + truncate_hover(folder.name,18,true) + '» </a> '+ path\n end\n end\n if controller=='document_homes'\n linkto = \"/matters/#{+ matter.id }/#{controller}\"\n path = '<a href=\"'+\"#{linkto }\"+'\">' +\" Root Folder\" + ' » </a> ' + path\n else\n path = '<a href=\"/' + \"#{controller}\" + '\">' +\" Root Folder\" + ' » </a> ' + path\n end\n end\n else\n path = 'Root Folder'\n end\n return path.html_safe!\n end",
"def dirs; end",
"def dirs; end",
"def paths\n {\n :homepage => '/',\n :people => '/people',\n :work => '/work',\n :labs => '/labs',\n :\"find-us\" => '/find-us',\n :\"pebbles-good-code\" => '/pebbles-good-code'\n }\nend",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end"
] |
[
"0.75283045",
"0.6429611",
"0.62999487",
"0.6243415",
"0.61129963",
"0.6066627",
"0.60164326",
"0.5972681",
"0.5972681",
"0.5972681",
"0.5968441",
"0.5968441",
"0.5949979",
"0.5949979",
"0.5946509",
"0.5946509",
"0.5946509",
"0.59423995",
"0.59423995",
"0.59423995",
"0.59423995",
"0.59423995",
"0.593943",
"0.593943",
"0.5930573",
"0.5884053",
"0.5881389",
"0.5880868",
"0.58793765",
"0.5860751",
"0.5860751",
"0.58256674",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.5820272",
"0.58185166",
"0.5768784",
"0.5765565",
"0.5763112",
"0.5762652",
"0.5742565",
"0.5735142",
"0.573103",
"0.57193005",
"0.5717377",
"0.5717377",
"0.5714161",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146",
"0.56871146"
] |
0.67258483
|
1
|
::: bp_mock_directory_index ::: Muestra un arbol de carpetas y vistas dentro de la carpeta mocks
|
def bp_mock_directory_index
tree_hash = BP.same_level_views("/mocks")
out = "<ul>"
tree_hash.keys.each do |tree_hash_key|
thk = tree_hash_key.gsub(".html.erb", "")
thk = thk.gsub("/mocks", "")
out += content_tag :li, thk.gsub("/", "")
out += "<ul>"
tree_hash[tree_hash_key].each do |tree_hash_value|
thv = tree_hash_value.gsub(".html.erb", "")
if thv != "index"
out += content_tag :li, link_to("#{thv}", "/mocks/no_layout?t=#{thk}/#{thv}")
end
end
out += "</ul>"
out += "</li>"
end
out += "</ul>"
out.html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def directory_index\n end",
"def test_directory_with_index\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory/\"\n end",
"def bp_directory_index\n tree_hash = BP.same_level_views(\"/base_project#{request.env['PATH_INFO']}\")\n\n p tree_hash\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li, thk.gsub(\"/\", \"\")\n\n out += \"<ul>\"\n tree_hash[tree_hash_key].each do |tree_hash_value|\n thv = tree_hash_value.gsub(\".html.erb\", \"\")\n if thv != \"index\"\n out += content_tag :li, link_to(\"#{thv}\", \"/mocks?t=#{thk}/#{thv}\")\n end\n\n end\n out += \"</ul>\"\n\n out += \"</li>\"\n end\n out += \"</ul>\"\n\n out.html_safe\nend",
"def index\n paths = Dir.glob(RAILS_ROOT + '/spec/fixtures/*.mif').select {|x| !x[/Book.mif$/]}\n paths << (RAILS_ROOT + '/spec/fixtures/Finance_Clauses.xml')\n paths << (RAILS_ROOT + '/spec/fixtures/ChannelTunnel/ChannelTunnelClauses.mif')\n paths << (RAILS_ROOT + '/spec/fixtures/ChannelTunnel/ChannelTunnelLordsClauses.mif')\n paths << (RAILS_ROOT + '/spec/fixtures/ChannelTunnel/ChannelTunnelLordsInboundClauses.mif')\n paths << (RAILS_ROOT + '/spec/fixtures/finance/2R printed/Clauses.mif')\n paths << (RAILS_ROOT + '/spec/fixtures/finance/2R printed/Schedules.mif')\n\n paths += Dir.glob(RAILS_ROOT + '/spec/fixtures/DigitalEconomy/*.mif').select {|x| !x[/Book.mif$/]}\n\n en_paths = []\n en_paths << (RAILS_ROOT + '/spec/fixtures/ChannelTunnel/ChannelTunnelENs.pdf')\n en_paths << (RAILS_ROOT + '/spec/fixtures/DigitalEconomy/ens/DigitalEconomy Bill.pdf')\n\n @clickable_file_types = '|Amendments|Clauses|Schedules|Marshalled List|Tabled Amendments|Tabled Report|Report|Arrangement|'\n\n @mif_files = MifFile.load(paths)\n @en_files = ExplanatoryNotesFile.load(en_paths)\n Effect.load(RAILS_ROOT + '/spec/fixtures/DigitalEconomy/effects/Digital Economy Bill Table of Effects.csv')\n\n @bill_names = @mif_files.collect(&:bill).collect{|x| x ? x.name : ''}.uniq.sort\n @files_by_bill = @mif_files.group_by{|x| x.bill ? x.bill.name : nil}\n @act_files = Dir.glob(RAILS_ROOT + '/spec/fixtures/Acts/*.xml')\n @title = \"Miffy\"\n render :template => 'index.haml'\n end",
"def test_root_with_index\n assert_pattern_match [ \"/\", \"index.vwf\", nil, nil ], \"/\"\n end",
"def test_application_as_directory\n assert_pattern_match [ \"/\", \"index.vwf\", nil, nil ], \"/\"\n assert_pattern_match [ \"/\", \"component.vwf\", nil, nil ], \"/component.vwf/\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory/\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf/\"\n end",
"def spec_dirs; end",
"def test_make_sure_the_testing_structure_works\n make_controller :mock\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end",
"def directory_index\n return @directory_index\n end",
"def spec_dirs=(_arg0); end",
"def mock_versions_for_platform(platform)\n # This is adapted from Fauxhai::Mocker::platform_path\n Dir.glob(File.join(Fauxhai.root, \"**/#{platform}/*.json\")).map { |it| File.basename(it, '.json') }\nend",
"def test_application_session_as_directory\n assert_pattern_match [ \"/\", \"index.vwf\", \"0000000000000000\", nil ], \"/0000000000000000/\"\n assert_pattern_match [ \"/\", \"component.vwf\", \"0000000000000000\", nil ], \"/component.vwf/0000000000000000/\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", \"0000000000000000\", nil ], \"/directory/0000000000000000/\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", \"0000000000000000\", nil ], \"/directory/component.vwf/0000000000000000/\"\n end",
"def test_add_dir()\n dirpath = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/\"\n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-A6-2671\"], [\"death_days_to\"], false)\n rs.add_all_sources(dirpath, false) # suppress progress bar for unit test\n\n assert_equal(rs.h.keys.size, 18)\n assert(rs.h.has_key?(\"biospecimen_sample\"))\n end",
"def directory_index\n @hash[\"DirectoryIndex\"]\n end",
"def index\n # List all folders and files in project result directory\n case params[:type]\n when 'result'\n # Get data: folder, file, path\n @content = BrowsingFile.bind_folder \"automations/#{params[:fold]}/reports\"\n @file = BrowsingFile.bind_files \"automations/#{params[:fold]}/reports\"\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=automations/%s/reports'>%s result</a>\" % [params[:fold], params[:fold]]\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n when 'checksum_comparison'\n @content = BrowsingFile.bind_folder 'public/checksum_packages'\n @file = BrowsingFile.bind_files 'public/checksum_packages'\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=public/checksum_packages'>checksum results</a>\"\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n end\n end",
"def test_application_with_public_path\n assert_pattern_match [ \"/\", \"index.vwf\", nil, \"file.ext\" ], \"/file.ext\"\n assert_pattern_match [ \"/\", \"component.vwf\", nil, \"file.ext\" ], \"/component.vwf/file.ext\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, \"file.ext\" ], \"/directory/file.ext\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, \"file.ext\" ], \"/directory/component.vwf/file.ext\"\n end",
"def get_index(*params); raise('Stub or mock required.') end",
"def test_application_as_file\n assert_pattern_match [ \"/\", \"component.vwf\", nil, nil ], \"/component.vwf\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf\"\n end",
"def test_subdirectory_name\n tested('somedir/img.jpg')\n tested[:digest] = 'abc123'\n tested.write\n\n assert_path_exists temp_dir('somedir/img.jpg.json')\n end",
"def _build_file_index(services)\n services.flat_map do |service|\n service.gemspec.files.map { |f| ::File.expand_path(f, service.path) }\n end\n end",
"def stub_view_routes\n\n view.stub( :experiment_path ).and_return( '/split_cat/experiment' )\n view.stub( :experiments_path ).and_return( '/split_cat/experiments' )\n view.stub( :new_experiment_path ).and_return( '/split_cat/experiments/new' )\n\nend",
"def mock_executable_dir(executable_name)\n File.join(\"kit\", executable_name, \"bin\")\n end",
"def test_index\n login\n get(:index)\n default_sorted_by = \"sort_by_#{::Query::ImageBase.default_order}\".to_sym.l\n\n assert_template(\"index\")\n assert_template(partial: \"_matrix_box\")\n assert_displayed_title(\"Images by #{default_sorted_by}\")\n end",
"def directories; end",
"def directories; end",
"def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end",
"def test_files\n `touch ../harness/test/foo ../harness/test/bar`\n f = @td.files\n assert_equal(2, f.length)\n assert(f.find \"foo\")\n assert(f.find \"bar\")\n end",
"def test_list(path)\n if File.basename(path) =~ /^\\W/\n [] # skip .hiddens and such\n elsif File.directory?(path) then\n puts \"Looking for tests in #{path}\"\n Dir.entries(path).\n collect { |entry| test_list(File.join(path,entry)) }.\n flatten.\n compact\n elsif path =~ /\\.rb$/\n puts \"Found #{path}\"\n [path]\n #[path[/\\S+\\/(\\S+)$/,1]]\n end\nend",
"def test_listedpath\n server = nil\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n\n # create a deep dir\n basedir = tempfile\n testdir = \"#{basedir}/with/some/sub/directories/for/testing\"\n oldfile = File.join(testdir, \"oldfile\")\n assert_nothing_raised {\n system(\"mkdir -p #{testdir}\")\n File.open(oldfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n @@tmpfiles << basedir\n }\n\n # mounty mounty\n assert_nothing_raised {\n server.mount(basedir, \"localhost\")\n }\n\n list = nil\n # and then check a few dirs\n assert_nothing_raised {\n list = server.list(\"/localhost/with\", :manage, false, false)\n }\n\n assert(list !~ /with/)\n\n assert_nothing_raised {\n list = server.list(\"/localhost/with/some/sub\", :manage, true, false)\n }\n\n assert(list !~ /sub/)\n end",
"def samples\n home = File.expand_path('../..', __FILE__)\n Dir.glob(\"#{home}/spec/samples/*.ooc\")\nend",
"def stubstub(subject)\n if subject.is_a?(Peep::GoproFolder)\n expect(Dir).to receive(:glob).with('/Volumes/*').and_return([\"/Volumes/#{subject.name}\"])\n expect(File).to receive(:directory?).with(\"/Volumes/#{subject.name}\").and_return(true)\n expect(File).to receive(:exist?).with(\"/Volumes/#{subject.name}/DCIM/100GOPRO\").and_return(true)\n expect(File).to receive(:exist?).with(\"/Volumes/#{subject.name}/MISC\").and_return(true) # this just surpresses the logger warning of a missing MISC folder\n end\nend",
"def test_list_root_items\n elfinder = ElFinder::Connector.new({\n :root => @vroot,\n :url => '/elfinder',\n :tree_sub_folders => false,\n :original_filename_method => lambda {|file| File.basename(file.path)}\n })\n\n h, r = elfinder.run(:cmd => 'open', :init => 'true', :target => '', :tree => true)\n assert_equal 0, r[:tree][:dirs].count\n end",
"def test_index\n # make sure public can access\n get(:index)\n\n assert_response(:success)\n assert_head_title(:glossary_term_index_title.l)\n\n GlossaryTerm.find_each do |term|\n assert_select(\n \"a[href *= '#{glossary_term_path(term.id)}']\", true,\n \"Glossary Index missing link to #{term.unique_text_name})\"\n )\n end\n end",
"def getTestContent\n return [\n \"#{@RepositoryDir}/Binaries/DummyBinary\",\n Proc.new do |iInstallLocation|\n # *iInstallLocation* (_String_): Installation directory\n FileUtils::mkdir_p(iInstallLocation)\n FileUtils::cp('DummyBinary', iInstallLocation)\n next true\n end\n ]\n end",
"def directory; end",
"def directory; end",
"def test_folders\n assert_equal(['folder1'], cmk.folders)\n end",
"def mirror_spec_gemdir\n define_directories\n FileUtils.mkdir_p( @scratch_dir )\n FileUtils.cp_r( @idx_test_datadir, @scratch_dir )\n end",
"def index\n @mock_servers = MockServer.all\n end",
"def render_results\n initialize_target_directory\n\n options = { disable_escape: true }\n template_path = File.expand_path('../templates/index.html.slim', __FILE__)\n rendered_template = Slim::Template.new(template_path, options).render(self)\n\n File.open(\"#{@target_dir}/index.html\", 'w') do |file|\n file.write rendered_template\n end\n end",
"def index\n client = DropboxApi::Client.new(\"C8Eg7_xlTzAAAAAAAAAAMduh226EdjZy_X_pVqXkbOUenDBMOVpQwo0zhF9sr8bC\")\n @result = client.list_folder \"/Yann Doré\"\n pp @result.entries\n @result.has_more? \n end",
"def parse_directories(files, diffs)\n files.sort!\n\n # Initialize those hashes, where each key will map to hash, in wich\n # each key maps to an array:\n # {\n # key1: {\n # },\n # key2: {\n # },\n # }\n #\n without_diffs = Hash.new { |h,k| h[k] = {} }\n with_diffs = Hash.new { |h,k| h[k] = {} }\n\n directories = files.map { |f| f.split('/').first }.uniq\n groups = directories.map { |dir| dir.split('_').first }.uniq\n\n\n # Fill in the files as variants\n directories.each do |directory|\n group = directory.split('_')[0]\n test_name = test_name_from_dir(directory)\n\n # Determines the type of test by the presence of the diff.png\n # file in the folder.\n # Ideally the manifest file format would be different and\n # include the test type with\n if files.select { |file_name| file_name.start_with?(directory) }.any? { |file_name| file_name.include?('diff.png') }\n variants = variants_for_page(directory, diffs)\n else\n variants = variants_for_api_endpoint(directory, diffs, files)\n end\n\n if diffs[directory]\n with_diffs[group][test_name] = variants\n else\n without_diffs[group][test_name] = variants\n end\n end\n\n return groups, without_diffs, with_diffs\n\n # For reference\n # gallery_format = {\n # \"1080\" => {\n # \"name\" => [\n # {\n # image: \"full_img_src\",\n # thumb: \"thumb_src\",\n # domain: \"production\"\n # }, {\n # image: \"foo_src\",\n # thumb: \"thumb_src\",\n # domain: \"test\"\n # }, {\n # image: \"diff_src\",\n # thumb: \"diff_thumb_src\",\n # domain: \"diff\",\n # diff_amt: 0.1\n # }\n # }\n # }\n # }\n end",
"def initialize\n #get a list of all folders, then get a list of all\n #test files for each folder\n @base_dir = __FILE__ + '../../../test/functional/'\n \n @func_areas = Hash.new\n test_dir = Dir.new(@base_dir)\n \n folders = test_dir.entries\n \n folders.each do |folder|\n \n if !File.basename(@base_dir + folder).index(\".\") \n if File.ftype(@base_dir + folder)== \"directory\"\n @func_areas[File.basename(folder)]= get_test_files_for_dir(folder)\n end\n end\n end\n end",
"def describe\n\t\t\"Shows the folder and files of the present working directory.\"\n\tend",
"def test_application_session_as_file\n assert_pattern_match [ \"/\", \"component.vwf\", \"0000000000000000\", nil ], \"/component.vwf/0000000000000000\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", \"0000000000000000\", nil ], \"/directory/0000000000000000\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", \"0000000000000000\", nil ], \"/directory/component.vwf/0000000000000000\"\n end",
"def test_files\n get_folder_files(TESTS_PATH)\n end",
"def mock_with_basedir(mock, basedir)\n config = IO.readlines(mock)\n basedir = \"config_opts['basedir'] = '#{basedir}'\"\n config.unshift(basedir)\n tempdir = Pkg::Util::File.mktemp\n newmock = File.join(tempdir, File.basename(mock))\n File.open(newmock, 'w') { |f| f.puts config }\n newmock\nend",
"def test_specifics_index_views\n ebay_singles = generate_ebay_items_with_size(25, \"7\\\"\")\n ebay_singles.map {|ebay_item| ebay_item.save}\n get :singles, :page => 1, :sort => ENDTIME, :order => DESC\n check_index_items(ebay_singles.reverse[0..19])\n\n ebay_eps = generate_ebay_items_with_size(25, \"10\\\"\")\n save_ebay_items(ebay_eps)\n get :eps, :page => 1\n check_index_items(ebay_eps.reverse[0..19])\n\n ebay_lps = generate_ebay_items_with_size(25, \"LP\")\n save_ebay_items(ebay_lps)\n get :lps, :page => 1\n check_index_items(ebay_lps.reverse[0..19])\n\n other_items = generate_ebay_items_with_size(25, \"something else\")\n save_ebay_items(other_items)\n get :other, :page => 1\n check_index_items(other_items.reverse[0..19])\n end",
"def dir_alias()\n #This is a stub, used for indexing\n end",
"def index(base_path, glob = nil)\n\t\tglob = '*' if glob == '' or glob.nil?\n\t\tdirs = []\n\t\tfiles = []\n\t\t::Dir.chdir(base_path) do\n\t\t\t::Dir.glob(glob).each do |fname|\n\t\t\t\tif ::File.directory?(fname)\n\t\t\t\t\tdirs << fname + '/'\n\t\t\t\telse\n\t\t\t\t\tfiles << fname\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.sort + files.sort\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, base_path\n\tend",
"def root\n rails_root = Minitest::Mock.new\n rails_root.expect \\\n :join,\n \"test/mock/app/controllers/**/*_controller.rb\",\n [String]\n rails_root\n end",
"def test_list_file(basename)\n FilePath.new(build_module.root, \"%s.lists.%s\" % [ name, basename ])\n end",
"def result\n # @param <foo>\n puts ::Dir.entries('/app').join(\"\\n\")\nend",
"def dirs; end",
"def dirs; end",
"def test_import_files\n fnsarray = [[\"afile\", \"bfile\", \"../cfile\"], \n \"./adir/afile\", \n \"\", \n [false, true, 1234],\n ]\n fnsarray.each do |fns|\n $mock.expect :add_import, true, [fns]\n import fns\n assert $mock.verify\n end\n\tend",
"def test_index\n create_document(\"about.md\") # setup necessary data\n create_document(\"changes.txt\")\n\n get \"/\"\n \n assert_equal(200, last_response.status)\n assert_equal(\"text/html;charset=utf-8\", last_response[\"Content-Type\"])\n assert_includes(last_response.body, \"about.md\")\n assert_includes(last_response.body, \"changes.txt\")\n\n end",
"def test_application_session_with_public_path\n assert_pattern_match [ \"/\", \"index.vwf\", \"0000000000000000\", \"file.ext\" ], \"/0000000000000000/file.ext\"\n assert_pattern_match [ \"/\", \"component.vwf\", \"0000000000000000\", \"file.ext\" ], \"/component.vwf/0000000000000000/file.ext\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", \"0000000000000000\", \"file.ext\" ], \"/directory/0000000000000000/file.ext\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", \"0000000000000000\", \"file.ext\" ], \"/directory/component.vwf/0000000000000000/file.ext\"\n end",
"def installed_spec_directories; end",
"def index\n @directories = Directory.all\n end",
"def test_subdirectories\n sd = @td.subdirectories\n assert_equal(5, sd.length)\n assert(sd.find \"failed\")\n assert(sd.find \"inactive\")\n assert(sd.find \"new\")\n assert(sd.find \"passed\")\n assert(sd.find \"unclassified\")\n end",
"def generate_gallery_index\n galleries_dir = File.join(@site_path, @config[:gallery_path])\n\n if File.exist?(galleries_dir)\n photo_root = File.join(@config[:site_path], @config[:photo_path])\n\n @log.debug(\" generating the gallery index\")\n\n links = {}\n\n Find.find(galleries_dir) do |path|\n if path =~ /\\w+\\.gallery/\n gallery = YAML.load_file(path)\n\n gallery[:photos].each_with_index do |photo_path, i|\n desc_file = \"#{photo_path.split('.')[0]}.description\"\n gallery[:photos][i] = YAML.load_file(File.join(@site_path, @config[:photo_path], desc_file))\n gallery[:photos][i][:path] = File.join(photo_root, photo_path)\n gallery[:photos][i][:thumb] = File.join(photo_root, File.dirname(photo_path), gallery[:photos][i][:thumb])\n end\n\n # Sort the images in chronological (alphabetical) order.\n #gallery[:photos].sort! {|x,y| x[:path] <=> y[:path]}\n\n # Mark up the description text.\n gallery[:description] = Markdown.new(gallery[:description]).to_html\n\n # Pick the name for the result file.\n gallery_path = path.gsub('gallery', 'html')\n\n File.open(gallery_path, 'w') do |f|\n page = {}\n page[:title] = gallery[:name]\n page[:body] = generate_gallery(gallery)\n\n f << generate_page(page)\n end\n\n links[gallery[:name]] = gallery_path.gsub(@site_path, @config[:site_path])\n end\n end\n\n page = {}\n page[:title] = @config[:gallery_title]\n page[:body] = \"\"\n\n links.keys.sort.each do |k|\n page[:body] << \"<h3><a href='#{links[k]}'>#{k}</a></h3>\"\n end\n\n File.open(File.join(@site_path, @config[:gallery_path], 'index.html'), 'w') do |f|\n f << generate_page(page)\n end\n end\n end",
"def stub_rails_root(path='./spec/fixtures')\n Rails.stub(:root).and_return(Pathname.new(path))\nend",
"def lookup_raw_mock_list(test)\n file_key = form_file_key(test)\n return [] if @mocks[file_key].nil?\n return @mocks[file_key]\n end",
"def test_09\n assert_equal(\"second#index@frontend\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/second'})[2].join)\n assert_equal(\"second#index@admin\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/admin/second'})[2].join)\n end",
"def directory(dir); end",
"def test_search_data_repo\n with_search_testdata do |dsttree|\n # fake minimal search request from file1 deployed to /my/docs/repo1\n uri = \"http://www.example.com/search?calling-url=http://www.example.com/file_1.html&search-assets-top-rel=./gibsearch_assets&search-phrase=hejsan\"\n sp = SearchParameters.from_uri(uri, uri_mappings: {\"/\" => dsttree.pathname})\n repo = SearchDataRepo.new(sp.assets_fs_path)\n\n sec = repo.in_section(\"file1.adoc\", 1)\n assert_equal(\"File 1\", sec[:title])\n\n sec = repo.in_section(\"file1.adoc\", 2)\n assert_equal(\"File 1\", sec[:title])\n\n sec = repo.in_section(\"file1.adoc\", 6)\n assert_equal(\"Paragraph 1\", sec[:title])\n\n sec = repo.in_section(\"file1.adoc\", 75)\n assert_equal(\"Sub section 2\", sec[:title])\n end\n end",
"def respond_with_fake_directory(directory, children, base_directories, url_base_path, extra_payload = {}, is_head_request = false, api_opts = {})\n bases = {\n directory: base_directories[0],\n url_base_path: url_base_path\n }\n\n result = normalized_path_name(directory, bases)\n children_listing = children.map { |child| fake_dir_info(child['path'], bases) }\n result = result.merge({\n type: 'directory',\n children: children_listing\n })\n result = extra_payload.merge(result)\n\n respond(result, is_head_request, api_opts)\n end",
"def test_get_list_files()\n\n path = 'folder1'\n storage = 'First Storage'\n request = GetListFilesRequest.new(path, storage)\n\n result = @storage_api.get_list_files(request)\n assert result.code == 200, 'Error while getting list files'\n assert result.files != nil\n\n end",
"def folder\n @folder ||= './.tests_cli'\n end",
"def with_temporary_index\n Dir.mktmpdir('braid_index') do |dir|\n Operations::with_modified_environment(\n {'GIT_INDEX_FILE' => File.join(dir, 'index')}) do\n yield\n end\n end\n end",
"def test_listroot\n server = nil\n testdir, pattern, tmpfile = mktestdir\n\n file = nil\n checks = Puppet::Network::Handler.fileserver::CHECKPARAMS\n\n # and make our fileserver\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n # mount the testdir\n assert_nothing_raised {\n server.mount(testdir, \"test\")\n }\n\n # and verify different iterations of 'root' return the same value\n list = nil\n assert_nothing_raised {\n list = server.list(\"/test/\", :manage, true, false)\n }\n\n assert(list =~ pattern)\n\n assert_nothing_raised {\n list = server.list(\"/test\", :manage, true, false)\n }\n assert(list =~ pattern)\n\n end",
"def test_root_file\n assert_pattern_match [ \"/\", \"component.vwf\", nil, nil ], \"/component.vwf/\"\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def tests_names_building(tests_dir)\n dir = Pathname.new(tests_dir).realpath\n (Dir::entries(tests_dir) - ['.', '..']).sort!.collect! { |e| dir + e }\n end",
"def set_entries_for_path(path, directories, files)\r\n files_and_directories = directories.concat files\r\n fake_entries = [\".\", \"..\"].concat files_and_directories\r\n\r\n stub = Dir.stub!(:foreach)\r\n stub = Dir.should_receive(:foreach).with(path).at_least(:once)\r\n fake_entries.each { |e| stub.and_yield(e) }\r\n\r\n directories.each do |entry| \r\n stub_is_file(path, entry, false)\r\n end\r\n\r\n files.each do |entry| \r\n stub_is_file(path, entry, true)\r\n end\r\nend",
"def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links \n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\" <a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end",
"def stub_directory(path)\n double('stat', readable?: true, file?: false, directory?: true).tap do |double|\n allow(Bolt::Util).to receive(:file_stat).with(path).and_return(double)\n end\n end",
"def list_directories(client)\n client.directories.each do |directory|\n puts \"Directory: #{directory.name}\"\n puts \" Description: #{directory.description}\"\n puts \" Status: #{directory.status}\"\n puts \" Href: #{directory.href}\"\n end\nend",
"def test_keyword_index_builder\n CEdictImporter.create_headword_index\n end",
"def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links\n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\" <a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end",
"def expected_path_for_dummy_values start_index\n \"value#{start_index}\"\n end",
"def correction_with_tests_directory\n @tests_names.each do |t|\n correction_with_test(t)\n end\n end",
"def testNormalTrackWithAliasList\n execute_Mix_WithConf({\n :Recordings => {\n :Tracks => {\n [1] => {\n :Env => :Env1,\n :Alias => [ 'Track 1', 'Track 2' ]\n }\n }\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Track 2' => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1, :Cleaned_Env1_1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Env1.1.04.NoiseGate.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => '02_Clean/Record/Env1.1.04.NoiseGate.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert Dir.glob('05_Mix/Env1.1.Calibrated.0.Test.????????????????????????????????.wav').empty?\n assert_wave_lnk '02_Clean/Record/Env1.1.04.NoiseGate', '05_Mix/Final/Final.wav'\n end\n end",
"def index\n # base_url, token, app_id, app_secret\n temp = @folder_client.index({id_parent_folder: -1})\n @contents = temp[:data]\n temp2 = @document_client.index(id_parent_folder: -1)\n @contents = @contents + temp2[:data]\n @current_folder = Folder.new({name: 'Root'})\n @success = temp[:status] and temp2[:status]\n\n end",
"def index\n Index.new(root, paths, extensions, aliases)\n end",
"def test_mb\n\t\t@listing = MediaBackup.new({\n\t\t\t:generate => './Test/TestDataFolder',\n\t\t\t:bp => Dir.pwd\n\t\t})\n\n\t\t@expec_listing = MediaBackup.new()\n\t\t@expec_listing.basePath = Dir.pwd\n\t\t@expec_listing.infoList = [\n\t\t\t{\n\t\t\t\t:filename=>\"AnotherTestFile.xyz\",\n\t\t\t\t:path=>\"Test/TestDataFolder/\",\n\t\t\t\t:size=>53,\n\t\t\t\t:checksum=>\"47ba5e3bc41c710bd25fc01be1a18e21\",\n\t\t\t\t:status=>0,\n\t\t\t\t:action=>0\n\t\t\t},\n\t\t\t{\n\t\t\t\t:filename=>\"TestFile.txt\",\n\t\t\t\t:path=>\"Test/TestDataFolder/\",\n\t\t\t\t:size=>80,\n\t\t\t\t:checksum=>\"17467d85d61f5d4523fd1785680f32ef\",\n\t\t\t\t:status=>0,\n\t\t\t\t:action=>0\n\t\t\t},\n\t\t\t{\n\t\t\t\t:filename=>\"TestFile.txt\",\n\t\t\t\t:path=>\"Test/TestDataFolder/TestSubFolder1/\",\n\t\t\t\t:size=>110,\n\t\t\t\t:checksum=>\"c8ea95565095d0453665eb6aecd152e2\",\n\t\t\t\t:status=>0,\n\t\t\t\t:action=>0\n\t\t\t}\n\t\t]\n\n\t\tassert_equal(@listing, @expec_listing, 'First listing in mbtest')\n\n\n\t\t# Here is another test for if the generate path = base path\n\t\t# as would be on server when backing up\n\t\tfullPathToServDir = Dir.pwd + '/Test/TestDataFolder'\n\t\t@listing_wbase = MediaBackup.new({\n\t\t\t:generate => fullPathToServDir,\n\t\t\t:bp => fullPathToServDir\n\t\t})\n\n\t\t@expec_listing_wbase = MediaBackup.new()\n\t\t@expec_listing_wbase.basePath = fullPathToServDir\n\t\t@expec_listing_wbase.infoList = [\n\t\t\t{\n\t\t\t\t:filename=>\"AnotherTestFile.xyz\",\n\t\t\t\t:path=>\"\",\n\t\t\t\t:size=>53,\n\t\t\t\t:checksum=>\"47ba5e3bc41c710bd25fc01be1a18e21\",\n\t\t\t\t:status=>0,\n\t\t\t\t:action=>0\n\t\t\t},\n\t\t\t{\n\t\t\t\t:filename=>\"TestFile.txt\",\n\t\t\t\t:path=>\"\",\n\t\t\t\t:size=>80,\n\t\t\t\t:checksum=>\"17467d85d61f5d4523fd1785680f32ef\",\n\t\t\t\t:status=>0,\n\t\t\t\t:action=>0\n\t\t\t},\n\t\t\t{\n\t\t\t\t:filename=>\"TestFile.txt\",\n\t\t\t\t:path=>\"TestSubFolder1/\",\n\t\t\t\t:size=>110,\n\t\t\t\t:checksum=>\"c8ea95565095d0453665eb6aecd152e2\",\n\t\t\t\t:status=>0,\n\t\t\t\t:action=>0\n\t\t\t}\n\t\t]\n\n\t\tassert_equal(@listing_wbase, @expec_listing_wbase, 'Listing w base')\n\n\t\ttemp_f = './Test/Temporary_Saved_MediaBackupForTest.tsv'\n\t\t@listing.saveToTSV(temp_f)\n\n\t\treadback_list = MediaBackup.new({:saved => temp_f})\n\n\t\tassert_equal @listing, readback_list\n\n\t\tFile.delete(temp_f)\n\n\t\t# Try some calls to MediaSafeServer\n\t\n\t\t# Test that I can do a simple get to '/'\n\t\tget '/'\n\t\tassert last_response.ok?\n\t\tassert(last_response.body.include?('Hooray'), 'Basic get test')\n\n\t\t# Create a MediaBackup to send over\n\t\tb = MediaBackup.new({\n\t\t\t:generate => './Test/TestDataFolder',\n\t\t\t:bp => Dir.pwd\n\t\t})\n\t\t\n\t\tpost '/query', b.to_json()\n\n\t\tassert last_response.ok?\n\n\t\t# Okay it should have responded with JSON for the server statuses\n\t\tserver_b = MediaBackup.new()\n\t\tserver_b.from_json(last_response.body)\n\t\t\n\t\tserver_b.infoList.each { |finfo|\n\t\t\tassert_equal MFileStatus::SAFE, finfo[:status]\n\t\t}\n\t\tassert_equal Dir.pwd, server_b.basePath\n\n\t\t# Now test checking status when some things are NOT yet backed up\n\t\t# Add a file temporarily in the test data dir\n\t\tnewfilename = 'newfile.txt'\n\t\tbackupfolder = './Test/TestDataFolder/'\n\t\tsleep 1\n\t\tfnew = File.new(backupfolder + newfilename,'w')\n\t\tfnew.puts 'This file is new and not yet be backed up.'\n\t\tfnew.close\n\t\tsleep 1\n\n\t\t# Now create the \"client\" MediaBackup object\n\t\tb = MediaBackup.new({\n\t\t\t:generate => backupfolder,\n\t\t\t:bp => Dir.pwd\n\t\t})\n\n\t\t# Now remove the file so the server won't see it\n\t\tFile.delete(backupfolder + newfilename)\n\t\tsleep 0.1\n\n\t\t# And ask the server status on files\n\t\tpost '/query', b.to_json()\n\n\t\tassert last_response.ok?\n\t\tserver_b = MediaBackup.new()\n\t\tserver_b.from_json(last_response.body)\n\n\t\t# So, status-wise, all should be safe except the one not present\t\n\t\tserver_b.infoList.each { |finfo|\n\t\t\tif(finfo[:filename] == newfilename)\n\t\t\t\tassert_equal MFileStatus::NOT_PRESENT, finfo[:status]\n\t\t\telse\n\t\t\t\tassert_equal MFileStatus::SAFE, finfo[:status]\n\t\t\tend\n\t\t}\n\n\t\t# Test telling it hey we backed something up\n\t\tpost '/log_safe', b.to_json()\n\n\t\t# Later, put in check on response\n\t\tassert(last_response.ok?, 'Response received from log_safe.')\n\t\tassert(last_response.body.include?('ROGER'))\n\tend",
"def spec\n File.join root, 'spec'\n end",
"def test_directories(suite)\n absolute_paths_for(\"spec/#{suite}\")\n end",
"def test_contradictory\n make_controller :contradictory\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end",
"def index_prebuilt!\n Dir.glob(\"#{PREBUILT_DIR}/**/[^_]*.*\") do |filename|\n config.add_page(filename.sub(\"#{PREBUILT_DIR}/\", ''), file: filename, digest: true)\n end\n end",
"def test_store_file\n #emulate the saving of a file whose content is 'test content'\n @writer.save_file('test content')\n #we expect three chunks for\n expected_chunks = ['test ', 'conte', 'nt']\n expected_chunks_sha = expected_chunks.map{|s| ComputeSHADigest s}\n #A. Each of the chunk is named with the sha on its content\n expected_chunks_sha.each{|sha| assert( @ioservice.exists? :chunk, sha )}\n \n #B. The filename is retrieved from the sha of the whole string\n file_sha = ComputeSHADigest 'test content'\n assert( @ioservice.exists?(:file, file_sha), \"file not found: #{file_sha} in #{@ioservice.store[:file]}\" )\n #C. The file lists all its chunks\n @ioservice.read_elem(:file, file_sha) do |c|\n c.each_line.zip(expected_chunks_sha).each{ |l, sha| assert_equal(l.strip, sha) }\n end\n #D. the adlers directory should be filled with the adler32 code of each chunk\n CheckChunksInAdlerDirectory( @adlers, expected_chunks )\n end",
"def dir(*) end",
"def test_generate_succeeds\n Index.generate(TEST_FILE, index_filename)\n end",
"def path_to_mock_module(name,file=nil)\n path = File.expand_path(\"files/modules/#{name}\", File.dirname(__FILE__))\n raise \"dir Path not found: '#{path}'\" unless File.directory? path\n\n if file\n path = File.expand_path(file,path)\n raise \"file Path not found: '#{path}'\" unless File.file? path\n end\n\n path\nend",
"def test_can_add_paths_to_library_path\n Crd::Spec.new 'Testing' do |s|\n s.library_path << 'test/fixtures'\n assert_equal( [ 'test/fixtures' ], s.library_path )\n end\n end"
] |
[
"0.6691094",
"0.66083425",
"0.6074296",
"0.60325736",
"0.59579116",
"0.5950772",
"0.58903176",
"0.58669245",
"0.586233",
"0.5782827",
"0.5778735",
"0.5760948",
"0.5714595",
"0.56046224",
"0.56026816",
"0.5549639",
"0.55079776",
"0.5466253",
"0.54230106",
"0.5415844",
"0.5414339",
"0.53818154",
"0.537727",
"0.53735316",
"0.53735316",
"0.53533334",
"0.5329635",
"0.5321409",
"0.5301798",
"0.52911526",
"0.52879673",
"0.52864957",
"0.52847743",
"0.52773196",
"0.526899",
"0.526899",
"0.5268336",
"0.523468",
"0.5222428",
"0.5213357",
"0.52078426",
"0.51995",
"0.5190206",
"0.5189906",
"0.5189884",
"0.5176069",
"0.51758724",
"0.5172007",
"0.5170397",
"0.5147016",
"0.51461035",
"0.51402456",
"0.5134682",
"0.51315176",
"0.51315176",
"0.51297045",
"0.51289827",
"0.5122091",
"0.51148254",
"0.51097983",
"0.5097788",
"0.5091904",
"0.5089671",
"0.50875497",
"0.5086258",
"0.50836843",
"0.50774497",
"0.50708354",
"0.50656885",
"0.5036013",
"0.503056",
"0.50277126",
"0.5027004",
"0.50221103",
"0.50221103",
"0.50221103",
"0.50221103",
"0.50221103",
"0.50167066",
"0.5014817",
"0.50120425",
"0.5011622",
"0.49990532",
"0.4994583",
"0.49897286",
"0.4989669",
"0.49784273",
"0.49748552",
"0.4974244",
"0.49740353",
"0.49710596",
"0.49589723",
"0.49508488",
"0.49497497",
"0.49398184",
"0.493938",
"0.493115",
"0.49280506",
"0.49235973",
"0.4919903"
] |
0.6713913
|
0
|
::: bp_meta_tags ::: 31/05/2012 ................................................................................................... Add baseproject meta tags
|
def bp_meta_tags
"<meta name='base-project-version' content='#{bp_version}'>".html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_meta_tags_title\n set_meta_tags site: 'benradler.com'\n end",
"def set_meta_tags(meta_tags)\n self.meta_tags.update(meta_tags)\n end",
"def add_tags\n raise NotImplementedError\n end",
"def render_custom(tags)\n meta_tags.meta_tags.each do |name, data|\n Array(data).each do |val|\n tags << Tag.new(:meta, configured_name_key(name) => name, :content => val)\n end\n meta_tags.extract(name)\n end\n end",
"def render_custom(tags)\n meta_tags.meta_tags.each do |name, data|\n Array(data).each do |val|\n tags << Tag.new(:meta, :name => name, :content => val)\n end\n meta_tags.extract(name)\n end\n end",
"def register_tags(*additional_tags); end",
"def meta_tags\n @meta_tags ||= MetaTagsCollection.new\n end",
"def make_tags(item)\n\ttags_for(item, { :base_url => @site.config()[:base_url] + \"/tags/\" })\nend",
"def get_meta_tags\n if @content_package\n\n if @content_package.meta_image_uid\n image = \"#{Settings.site_url}#{@content_package.meta_image.thumb('1200x630#').url}\"\n elsif @content_package.respond_to?(:hero_image) && @content_package.hero_image.present?\n image = \"#{Settings.site_url}#{@content_package.hero_image.thumb('1200x630#').url}\"\n end\n\n meta_title = @content_package.meta_title.presence || Settings.default_meta_title\n meta_description = @content_package.meta_description.presence || Settings.default_meta_description\n meta_keywords = @content_package.meta_keywords.presence || Settings.default_meta_keywords\n if @content_package.hide_from_robots?\n meta_hide_from_robots = \"<meta name='robots' content='noindex, nofollow' />\\n\"\n end\n\n else\n meta_title = content_for(:title) || Settings.default_meta_title\n meta_description = content_for(:description) || Settings.default_meta_description\n meta_keywords = content_for(:keywords) || Settings.default_meta_keywords\n meta_hide_from_robots = nil\n end\n\n meta_description = strip_tags CGI.unescapeHTML(meta_description.strip)\n\n meta_image = image || content_for(:meta_image) || \"#{Settings.site_url}#{asset_path(Settings.default_fb_meta_image)}\"\n\n meta_values = [meta_title, meta_description, meta_image, meta_keywords, meta_hide_from_robots]\n\n pig_meta_tags(meta_values)\n end",
"def add_tags\n self.tag_list = 'bug, feature, improvement, feedback, discussion, help'\n end",
"def process_meta(repo, versions)\n @releases.push(\"#{repo_human(repo)} #{versions.last + @increment}\")\n @footer_locations.push(build_footer_locations(repo, versions.last + @increment))\n @tags.push(repo.sub('cockpit-', ''))\nend",
"def meta_tags(hash)\n meta_information.merge!(hash)\n end",
"def set_extra_stuff\n @templates = Template.all\n @tags = tags_for('Common')\n end",
"def set_site_meta_tags\n config = ZanoboRails::Crawlable.configuration\n\n site_ids = {\n separator: config.page_title_sitename_separator,\n reverse: config.page_title_sitename_pos == 'right'\n }\n\n if config.gplus_id.present?\n site_ids[:publisher] = \"https://plus.google.com/#{config.gplus_id}\"\n end\n if config.twitter_id.present?\n site_ids[:twitter] = \"@#{config.twitter_id}\"\n end\n if config.fb_app_id.present?\n site_ids[:fb] = { app_id: \"@#{config.fb_app_id}\" }\n end\n if config.site_name.present?\n site_ids[:open_graph] = { site_name: config.site_name }\n site_ids[:site] = config.site_name\n end\n\n set_meta_tags(site_ids)\n end",
"def set_meta_tags_for_url_path(base_url, request_fullpath)\n\n page_title = t(LOCALE_TITLE_KEY, default: SiteMetaInfoDefaults.title)\n page_desc = t(LOCALE_DESCRIPTION_KEY, default: SiteMetaInfoDefaults.description)\n\n set_meta_tags site: SiteMetaInfoDefaults.site_name,\n title: page_title,\n description: page_desc,\n keywords: create_keywords\n\n set_page_meta_images\n\n set_og_meta_tags(site_name: SiteMetaInfoDefaults.site_name,\n title: helpers.full_page_title(page_title: page_title),\n description: page_desc,\n type: t(LOCALE_TYPE_KEY, default: SiteMetaInfoDefaults.og_type),\n base_url: base_url,\n fullpath: request_fullpath)\n\n set_facebook_meta_tags\n\n set_twitter_meta_tags(card: t(LOCALE_TWITTER_CARD_KEY, default: SiteMetaInfoDefaults.twitter_card_type))\n\n end",
"def add_tags(tags)\n\t\t\t@metadata.attributes.update do |u|\n\t\t\t\tu.add(:tags => tags)\n\t\t\t\tu.add(:idenity => 1)\n\t\t\tend\n\t\t\treturn nil\n\t\tend",
"def dynamic_meta_tags\n @meta_tag_object = (@r_object || @page)\n return unless @meta_tag_object\n return unless @meta_tag_object.respond_to?(:meta_tags)\n meta_tags_list = []\n\n @meta_tag_object.meta_tags.each do |meta_tag|\n meta_tags_list << content_tag(:meta, \"\", name: meta_tag.meta_key, content: meta_tag.meta_value)\n end\n\n raw(meta_tags_list.join(\" \"))\n end",
"def add_tags(post_num_input, tags_input)\n tags_to_add = tags_input.split(\" \")\n tags_to_add.each do |x|\n BLOG[post_num_input].tags << x\n end\n puts ''\n puts 'Your tags have been added'\n puts BLOG[post_num_input].tags\n puts ''\n end",
"def set_page_meta_tags\n req = self.request\n set_meta_tags_for_url_path(req.base_url, req.fullpath)\n end",
"def meta_tags_with_multi_site=(tags)\n self.save if self.new_record?\n # just skip the whole method if the tags string hasn't changed\n return if tags == tag_list\n\n # Find site\n site_id = self.homepage_site.id\n\n # do we need to delete any tags?\n tags_to_delete = tag_list.split(MetaTag::DELIMITER) - tags.split(MetaTag::DELIMITER)\n tags_to_delete.select{|t| meta_tags.delete(MetaTag.find_by_name_and_site_id(t, site_id))}\n\n tags.split(MetaTag::DELIMITER).each do |tag|\n begin\n MetaTag.find_or_create_by_name_and_site_id(tag.strip.squeeze(\" \"), site_id).taggables << self\n rescue ActiveRecord::StatementInvalid => e\n # With SQLite3 - a duplicate tagging will result in the following message:\n # SQLite3::SQLException: SQL logic error or missing database: INSERT INTO taggings (\"meta_tag_id\", \"taggable_type\", \"taggable_id\") VALUES(11, 'Page', 74)\n # raise unless e.to_s =~ /duplicate/i\n end\n end\n end",
"def injectable_meta \n set_meta_tags title: \"#{controller_name.humanize.titleize + ' - ' + action_name.capitalize}\",\n description: 'NoBull Software Co.\\'s NoBull Website Ordering Thingy™!👋' ,\n keywords: 'webapp, web site development, business information',\n index: false,\n nofollow: true,\n icon: [\n { href: \"#{ActionController::Base.helpers.asset_path('favicon.ico')}\"},\n { href: \"#{ActionController::Base.helpers.asset_path('favicon-96x96.png')}\", sizes: '32x32 96x96', type: 'image/png' },\n { href: \"#{ActionController::Base.helpers.asset_path('apple-icon.png')}\", rel: 'apple-touch-icon-precomposed', sizes: '32x32', type: 'image/png' },\n ]\n end",
"def tag_list\r\n clean_string(general_metadata_sheet[*WBF[:meta_projects_pos]])\r\n end",
"def prepare_meta_tags(options={})\n site_name = I18n.t('meta_tag.site_name')\n title = I18n.t('meta_tag.title')\n description = I18n.t('meta_tag.description')\n image = options[:image] || ActionController::Base.helpers.image_url('/homepage/teaser_bg.jpg')\n current_url = request.url\n\n # Let's prepare a nice set of defaults\n defaults = {\n site: site_name,\n title: title,\n image: image,\n description: description,\n keywords: %w[bookmarks web mobile free application],\n twitter: {\n site_name: site_name,\n site: '@wundermarks',\n card: 'summary',\n description: :description,\n image: image\n },\n og: {\n url: current_url,\n site_name: site_name,\n title: :title,\n image: image,\n description: :description,\n type: 'website'\n }\n }\n\n options.reverse_merge!(defaults)\n\n set_meta_tags options\n end",
"def load_notetags\n super\n init_custom_fields\n end",
"def set_meta_tags_for_company(company)\n co_meta_info = CompanyMetaInfoAdapter.new(company)\n\n set_meta_tags title: co_meta_info.title,\n description: co_meta_info.description,\n keywords: co_meta_info.keywords,\n og: { title: helpers.full_page_title( page_title: co_meta_info.title),\n description: co_meta_info.og[:description] }\n\n end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def additional_tags=(value)\n @additional_tags = value\n end",
"def set_meta\n meta.tap do |m|\n m.tag = [{\n system: META_SYSTEM,\n code: META_CODE,\n display: META_DISPLAY\n }]\n end\n end",
"def resource_meta_tags\n meta_tags = [\n current_site.metatags,\n @page.metatags\n ].flatten.inject({}) do |tags, metatag|\n tags.merge(metatag.name => metatag.content)\n end\n\n { image_src: current_site.logo.url }.merge(meta_tags)\n .merge(title: @page.title)\n end",
"def create_tags\n\tend",
"def tags_to_add=(value)\n @tags_to_add = value\n end",
"def site_meta\n end",
"def site_meta\n end",
"def inherit_tags\n self.attached_tags += calendar.attached_tags if calendar\n self.attached_tags += event_venue.attached_tags if event_venue\n self.attached_tags.uniq!\n end",
"def render_meta_tags\n item = find_item\n\n if item.present?\n @meta_tags = item.meta_tags.published\n render meta_tags: @meta_tags\n end\n end",
"def setExtractMetaTags(value)\n @fields['extract_meta_tags'] = value\n self\n end",
"def complete_tags\n\n end",
"def init_tags\n add_tag :BOLD, '+b', '-b'\n add_tag :EM, '+_', '-_'\n add_tag :TT, '' , '' # we need in_tt information maintained\n end",
"def custom_meta_data\n end",
"def render_tag(tags, name, value, itemprop: nil)\n name_key ||= configured_name_key(name)\n tags << Tag.new(:meta, name_key => name.to_s, :content => value, :itemprop => itemprop) if value.present?\n end",
"def assign_resource_meta_tags\n assign_meta_tags(resource_meta_tags)\n end",
"def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end",
"def initialize(meta_tags)\n @meta_tags = meta_tags\n @normalized_meta_tags = {}\n end",
"def initialize(meta_tags)\n @meta_tags = meta_tags\n @normalized_meta_tags = {}\n end",
"def register_transitive_tags(object); end",
"def index\n @blogs = Blog.order(\"created_at DESC\")\n @all_tags = Tag.get_tags_count\n @tags_for_meta = []\n Tag.all.select(\"description\").each { |element| @tags_for_meta << element.description}\n end",
"def set_meta\n puts 'meta'\n end",
"def add_tags(new_tags)\n new_tags.each do |k, v|\n self.tags[k.to_s] = v\n end\n self\n end",
"def add_info_on_tag_ids\n desc_hash = Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck(:title, :tag_id, :aliased_tag_id)\n .map { |x| [x.first.downcase, x.second || x.third] }\n .select { |x| x.first.in?(@content_descriptions.map(&:downcase)) }\n .to_h\n @content.each do |c|\n c['tag_id'] = desc_hash[c['description'].downcase]\n end\n end",
"def meta name, contents\n Tagz.tag :meta, :name => name, :contents => contents \n end",
"def tags=(_arg0); end",
"def build_meta_tags(with: Metatags::BaseMetatags, instance: nil)\n self.meta_tags = with.new(instance, view_context)\n end",
"def tag(new_tag); end",
"def build_default_meta_tags\n klass = metatags_class || default_metatags_class\n build_meta_tags(with: klass, instance: metatags_instance)\n end",
"def meta_tag(*tags, &block)\n content_for(:meta_tags) { tags }\n content_for(:meta_tags) { concat(capture( &block), block.binding) if block_given? }\n end",
"def projects\n taggings.all(:conditions => { :taggable_type => :Project}).map(&:taggable)\n end",
"def tagBucket\n tagset = []\n\n MU::MommaCat.listStandardTags.each_pair { |key, value|\n tagset << { :key => key, :value => value }\n }\n\n if @config['tags']\n @config['tags'].each { |tag|\n tagset << { :key => tag['key'], :value => tag['value'] }\n }\n end\n\n if @config['optional_tags']\n MU::MommaCat.listOptionalTags.each { |key, value|\n tagset << { :key => key, :value => value }\n }\n end\n\n MU::Cloud::AWS.s3(credentials: @config['credentials'], region: @config['region']).put_bucket_tagging(\n bucket: @cloud_id,\n tagging: {\n tag_set: tagset\n }\n )\n\n end",
"def auto_create_tag\n\t\n\tget_tags.each do |tag|\n\t\t@items << Nanoc3::Item.new(\n\t\t\"<%= render 'tag', :tag => '#{tag}' %>\",\n\t { :title => \"Category: #{tag}\", :is_hidden => true, :tag => \"#{tag}\"}, # do not include in sitemap.xml\n\t \"/tags/#{tag}/\", # identifier\n\t :binary => false\n\t)\n\n\tend\n\tnil\nend",
"def tag *tags\n @tags += tags\n self\n end",
"def meta_keywords\n\t\t\"Add your keywords here. Find me in application_helper.rb\"\n\tend",
"def add_meta(meta)\n self.meta.merge!(meta)\n self\n end",
"def seo_tags\n seo_title + seo_meta_author + seo_meta_description\n end",
"def tags() ; info[:tags] ; end",
"def tags() ; info[:tags] ; end",
"def set_locale_meta_tags\n set_meta_tags(og: {locale: t('locale.short-code', default: 'en_US')} )\n # @todo When we support multiple locales, pull them in below\n #alternate: { \"fr\" => \"http://yoursite.fr/alternate/url\",\n # \"de\" => \"http://yoursite.de/alternate/url\" }\n end",
"def meta_tag(name, content)\n\t\ttag(:meta, name: name, content: content)\n\tend",
"def tag(*tags)\n p tags\n tags.each do |tag|\n tag << self\n @tags << tag\n end\n end",
"def tag(*tags)\n p tags\n tags.each do |tag|\n tag << self\n @tags << tag\n end\n end",
"def prepare_meta_tags(options = {})\n defaults = {\n author: nil,\n authors: [],\n description: nil,\n description_og: nil,\n description_twitter: nil,\n images: [],\n #is_duplicate?: false,\n # # used to determine if we should rel=canonical, true if viewing a paginated\n # just comparing request url to canonical for now\n # form of a full-page-enabled resource\n keywords: [],\n nofollow?: false,\n noindex?: false,\n page: nil, # Have to throw this into the title\n pages: nil, # along with this\n title: nil, # Just the descriptive part of the title\n #title_format: nil, # Title with placeholders for sitename, pages, and separators\n # disabling this for now, because getting it to with with meta-tags\n # current title passing scheme would require reading placement and\n # then monkey-patching parameters\n #title_separator: '|', #set this at higher level # '-', 'on', ':', etc\n #title_site_name_position: 'right', #set this at higher level\n #title_site_name: SITE_IDS[:NAME], # provided earlier on, meta-tags ties to other site identifier tags\n title_og: nil,\n title_twitter: nil,\n type: 'page', # og and twitter need types, we generate from our map if missing\n type_og: nil,\n type_twitter: nil,\n video: nil,\n url: nil, # canonical, required by og \"#{request.url}\"\n url_current: request.url,\n url_next: nil, # if paged and no full-page alternative\n url_prev: nil, # if paged and no full-page alternative\n }\n options.reverse_merge! defaults\n\n # @todo Raise some errors if mandatory things are missing as required by\n # og and twitter, i.e.\n # We want this to fill out as much as possible, but it needs a base of info\n # description\n # title (except certain cards...)\n # url - this is the big one, always needed\n # image_url - for og\n if options[:url].blank?\n raise MetaTagError, 'No url defined for content, required by OG and needed if protocol different from canonical'\n end\n\n # initialize return array\n return_values = {\n author: [],\n og: { image: []},\n twitter: { creator: []}\n }\n\n # Authors\n options[:authors] << options[:author] if options[:author]\n options[:authors].each do |author|\n if author.has_key?(:gplus_id) and (id = author[:gplus_id])\n return_values[:author] << \"https://plus.google.com/#{id}\"\n end\n if author.has_key?(:twitter_id)\n return_values[:twitter][:creator] << id\n end\n end\n\n # Descriptions\n return_values[:description] = options[:description]\n return_values[:og][:description] = options[:description_og]\n return_values[:twitter][:description] = options[:description_twitter]\n\n # Images\n # @todo existence checks and warnings for sizes, AR, filesize, etc\n # @todo Need to take in all images and distribute to each stream according to size appropriateness,\n # unless specifically tagged to a stream\n\n # Images - OG\n # @todo pass https url through secure_url, width and height once after\n # https://github.com/kpumuk/meta-tags/issues/63 is resolved\n options[:images].each do |image|\n if image.has_key? :url\n return_values[:og][:image] << image[:url]\n\n #if image.has_key? :width and image.has_key? :height\n # return_values[:og][:image][:width] = image[:width].to_i\n # return_values[:og][:image][:height] = image[:height].to_i\n #end\n end\n end\n\n # Images - Twitter\n # Falls back to open graph, let's rely on that for now\n # @todo Support custom images for twitter\n\n # Keywords\n return_values[:keywords] = options[:keywords]\n\n # Noindex, nofollow\n # @todo Build in checking for if these are turned off for this object type somewhere\n return_values[:noindex] = options[:noindex?]\n return_values[:nofollow] = options[:nofollow?]\n\n # Titles\n return_values[:og][:title] = options[:title_og] if options[:title_og]\n return_values[:twitter][:title] = options[:title_twitter] if options[:title_twitter]\n\n #if options.has_key)[:title_format]\n # #if options[:title_page_format]\n #\n # end\n # return_values[:title] = options[:title_format].gsub(['special','characters'],['value','otherval'])\n #else\n if options[:pages] and options[:page] and options[:pages] > 1 and options[:page] > 1\n return_values[:title] = [\n options[:title],\n t('pagination.page_x_of_y', page: options[:page], pages: options[:pages])\n ]\n else\n return_values[:title] = options[:title]\n end\n #end\n\n # Types\n og_content_type = options[:type_og]\n if og_content_type and ZanoboRails::Crawlable.content_types_for(:og).include? og_content_type\n return_values[:og][:type] = og_content_type\n elsif type_provided = (general_type = options[:type] and ZanoboRails::Crawlable.general_content_types.include? general_type)\n return_values[:og][:type] = ZanoboRails::Crawlable::Advisor.og_content_type_for(general_type)\n else\n # Type is REQUIRED, we really should test for required values.\n return_values[:og][:type] = ZanoboRails::Crawlable::Advisor.recommend(:content_type, :og).to_s\n end\n\n twitter_content_type = options[:type_twitter]\n if twitter_content_type and ZanoboRails::Crawlable.content_types_for(:twitter).include? twitter_content_type\n return_values[:twitter][:type] = twitter_content_type\n elsif type_provided\n return_values[:twitter][:type] = ZanoboRails::Crawlable.twitter_content_type_for(general_type)\n else\n # Type is REQUIRED\n return_values[:twitter][:type] = ZanoboRails::Crawlable::Advisor.recommend(:content_type, :twitter).to_s\n end\n\n # URLS\n # og:url\n # twitter:url\n # rel=canonical\n return_values[:og][:url] = options[:url]\n return_values[:twitter][:url] = options[:url]\n return_values[:canonical] = options[:url] unless request.url == options[:url]\n return_values[:next] = options[:url_next]\n return_values[:prev] = options[:url_prev]\n\n # Video\n #og:video => {\n # :director => 'http://www.imdb.com/name/nm0000881/',\n # :writer => ['http://www.imdb.com/name/nm0918711/', 'http://www.imdb.com/name/nm0177018/']\n #}\n\n # Tell og and twitter to use primary description and title if nothing is customized to them\n return_values[:og][:description] = :description if return_values[:og][:description].nil?\n return_values[:twitter][:description] = :description if return_values[:twitter][:description].nil?\n return_values[:og][:title] = :title if return_values[:og][:title].nil?\n return_values[:twitter][:title] = :title if return_values[:twitter][:title].nil?\n\n return_values\n end",
"def add_contextual_tags(context_tags, context)\r\n Tagging.destroy_all(:taggable_id => self.id, :taggable_type => \"Profile\", :context => context) # destroy old taggings\r\n unless context_tags.nil?\r\n context_tags.split(\",\").slice(0...10).each do |tag|\r\n context_tag = Tag.find_or_create_with_like_by_name(tag.clean)\r\n taggings << Tagging.create(:tag_id => context_tag.id, :context => context)\r\n end\r\n end \r\n end",
"def title\n \"#{super} #{self.tags.map(&:name).join(\" \")}\"\n end",
"def init_tags\n add_tag :BOLD, '**', '**'\n add_tag :EM, '*', '*'\n add_tag :TT, '`', '`'\n end",
"def tag; end",
"def tag; end",
"def set_record_metatags! tags, record\n tags['title'] = record.name\n tags['description'] = record.excerpt if record.respond_to?(:excerpt)\n tags['og:url'] = wm_url_for(record)\n tags['og:type'] = 'article'\n tags['og:image'] = record.thumbnail.url if record.try(:thumbnail).present?\n tags['og:article:published_time'] = record.created_at.to_s(:db)\n tags['og:article:modified_time'] = record.updated_at.to_s(:db)\n tags['og:article:section'] = record.category&.name if record.is_a?(Article)\n tags['twitter:card'] = 'summary'\n\n set_locale_metatags!(tags, record) if record.try(:translatable?)\n set_static_page_metatags!(tags, record) if record.is_a?(StaticPage)\n set_video_metatags!(tags, record) if record.try(:vimeo_metadata).present?\n end",
"def meta_keywords\n # Change the value below between the quotes.\n \"ezonline, ez troubleshooter, repository\"\n end",
"def update_meta_tag(key, value)\n set_meta_tags({key => value})\n end",
"def create_tag_pages\n tag_set(items).each do |tag|\n page_identifier = @config[:tags][:page] % tag\n next unless item_by_identifier(page_identifier).nil?\n item = Nanoc3::Item.new(\n # content\n @config[:tags][:content],\n # do not include in sitemap.xml\n { :title => @config[:tags][:title] % tag,\n :tag => tag,\n :page_size => 10,\n :kind => 'tag'\n }.merge(@config[:tags][:attributes]),\n # identifier\n page_identifier,\n # options\n :binary => false\n )\n item.page_items = items_with_tag(tag, items).sort { |x, y| x[:created_at] <=> y[:created_at] }\n items << item\n end\n end",
"def tag(*tags)\n tags.each { |tag| @tags << tag }\n end",
"def tags() []; end",
"def init_tags\n add_tag :BOLD, \"<b>\", \"</b>\"\n add_tag :TT, \"<tt>\", \"</tt>\"\n add_tag :EM, \"<em>\", \"</em>\"\n end",
"def []=(name, value)\n @meta_tags[name] = value\n end",
"def tag(name); end",
"def initialize\n @meta_tags = ActiveSupport::HashWithIndifferentAccess.new\n end",
"def common_tags_to_add\n common_tags = []\n common_tags << self.merger\n common_tags << self if self.canonical\n common_tags << self.parents\n common_tags.flatten.uniq.compact\n end",
"def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end",
"def custom_meta_data\n {\n position: 7,\n title_before: I18n.t('admin.website')\n }\n end",
"def set_tags(given_tags = {})\n @tags.merge!(given_tags)\n end",
"def tag_map\n { artist: :artist,\n album: :album,\n title: :title,\n t_num: :tracknumber,\n year: :date,\n genre: :genre }\n end",
"def meta_tag_description\n $tracer.trace(__method__)\n return ToolTag.new(jquery(\"meta[name='description']\"),__method__)\n end",
"def add_tags_for(p_artist)\n\t\t\tbegin\n\n\t\t\t\t# Check parameter\n\t\t\t\treturn unless p_artist.is_a? Artist\t\t\t\t\n\t\t\t\t\n\t\t\t\t# Temporary store tags for the given artist\n\t\t\t\ttags = p_artist.tags\n\t\t\t\t\n\t\t\t\t# Proceed only if there are tags to be added\n\t\t\t\tunless tags.empty?\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t# Create separated list of tags\n\t\t\t\t\ttag_list = p_artist.tags.join(@@settings[:tag_separator])\n\t\t\t\t\t\n\t\t\t\t\t# Assign the new tags to the grouping (iTunes)\n\t\t\t\t\t# and genre (ID3 v2, Winamp) tag fields\n\t\t\t\t\ttag.grouping = tag_list\n\t\t\t\t\ttag.genre = tag_list\n\t\t\t\t\t\n\t\t\t\t\t# Update the ID3 Tag\n\t\t\t\t\ttag.update!\n\t\t\t\tend\n\t\t\t\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e \n\t\t\t\tlog.error e\n\t\t\tend\t\t\t\n end",
"def add_tags(*new_tags)\n raise TypeError, \"Must set agent= before using tag manager\" unless @agent\n @agent.update_tags(new_tags, [])\n true\n end",
"def set_video_metatags! tags, record\n metadata = record.vimeo_metadata\n metadata = metadata[:horizontal] if metadata.key?(:horizontal)\n return unless metadata.present?\n\n tags.merge!({\n 'og:type' => 'video.other',\n 'og:image' => metadata[:thumbnail],\n 'og:video' => metadata[:download_url],\n 'og:video:duration' => metadata[:duration],\n 'og:video:release_date' => record.created_at.to_s(:db),\n 'twitter:card' => 'player',\n 'twitter:player:url' => metadata[:embed_url],\n 'twitter:player:width' => metadata[:width],\n 'twitter:player:height' => metadata[:height],\n })\n end",
"def add_tag(key, value, source=Metadata::Source::METRIC)\n tags << Metadata.new(:key => key, :value => value, :source => source,\n :object_type => Metadata::Type::METRIC, :object_fk_id => id)\n nil\n end",
"def add_tags(host)\n host[:host_tags].merge(\n 'beaker_version' => Beaker::Version::STRING,\n 'jenkins_build_url' => @options[:jenkins_build_url],\n 'department' => @options[:department],\n 'project' => @options[:project],\n 'created_by' => @options[:created_by],\n 'name' => host.name,\n 'roles' => host.host_hash[:roles].join(', ')\n )\n end",
"def tagline; end"
] |
[
"0.66166747",
"0.64490247",
"0.6427762",
"0.63269556",
"0.63182783",
"0.63060045",
"0.62989634",
"0.61403334",
"0.61169416",
"0.6104548",
"0.6090257",
"0.6070195",
"0.6065026",
"0.60502315",
"0.6030636",
"0.60273206",
"0.60210395",
"0.60089767",
"0.5995537",
"0.59758747",
"0.595846",
"0.5955465",
"0.59053004",
"0.58479095",
"0.58321416",
"0.58260953",
"0.58260953",
"0.58260953",
"0.58260953",
"0.58260953",
"0.5789523",
"0.5786062",
"0.5773633",
"0.5751685",
"0.57383126",
"0.57307804",
"0.57307804",
"0.5713052",
"0.5703965",
"0.56875896",
"0.56870604",
"0.56710154",
"0.5669115",
"0.5645187",
"0.5640384",
"0.5631642",
"0.56281686",
"0.56281686",
"0.55922556",
"0.55912334",
"0.5586255",
"0.55611485",
"0.55605227",
"0.55556387",
"0.5551883",
"0.5546589",
"0.55416834",
"0.55392325",
"0.5521923",
"0.5518912",
"0.54849374",
"0.5482219",
"0.5477193",
"0.5464287",
"0.54601896",
"0.54345083",
"0.5432103",
"0.5432103",
"0.5411215",
"0.54062766",
"0.53889894",
"0.53889894",
"0.5386628",
"0.5375159",
"0.53592366",
"0.5349769",
"0.5342937",
"0.5342937",
"0.53398865",
"0.53215563",
"0.5321435",
"0.53203756",
"0.53196764",
"0.53078955",
"0.5302871",
"0.5300629",
"0.5293363",
"0.5277217",
"0.5271216",
"0.52631986",
"0.5253756",
"0.5251942",
"0.524539",
"0.5244875",
"0.523001",
"0.5228708",
"0.5227665",
"0.52268404",
"0.5220303",
"0.52178097"
] |
0.66026044
|
1
|
filter by post type. TODO
|
def by_type
filter(:type) do |post, type|
post.post_type.casecmp(type).zero?
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_post_types(args = {}, output = 'names', operator = 'and')\n field = ( 'names' == output ) ? 'name' : false\n\n wp_filter_object_list(Railspress.GLOBAL.wp_post_types, args, operator, field)\n end",
"def index\n \n @post_type = params[:type] \n the_posts = Post.all\n if !@post_type.blank?\n the_posts = the_posts.where(:post_type => @post_type)\n end\n \n if current_user && current_user.is_admin?\n @posts = the_posts\n elsif current_user\n @posts = the_posts.where(\"user_id = ?\", current_user.id) \n else\n @posts = the_posts.where(\"posted_on >= ? and post_type != ?\", 24.hours.ago, \"Personal\")\n end\n \n if @post_type == \"Question\" && current_user\n # based on user's answered questions, display same question\n user_answered_qids = Post.where(:user_id => current_user.id).pluck(:question_id).compact.uniq\n @posts = Post.where(\"question_id in (?)\", user_answered_qids)\n end\n\n end",
"def filter(type)\n print_items @items.select { |item| item.type.casecmp(type).zero? }\n end",
"def economics_posts\n\t\t@posts = Post.where(category: 1, published: true)\n\t\trender \"posts/types/_posts_by_type\"\n\tend",
"def index\n @admin_posts = Post.where(\"type <> 'VideoPost'\")\n end",
"def index\n @posts = Post.where(boardtype: params[:type])\n #localhost:3000/posts?type=auction 혹은 /posts?type=rent로 하면 해당 게시글만 보여짐\n end",
"def filter\n params.merge!(user_id: session[:user_id])\n case params[:filter_select]\n when gender_and_location_filter\n @posts = Post.filter_by_gender(post_filter_params).filter_by_location(post_filter_params)\n when pace_filter\n @posts = Post.filter_by_pace(post_filter_params)\n when age_filter\n @posts = Post.filter_by_age(post_filter_params)\n when time_filter\n @posts = Post.filter_by_time(post_filter_params)\n when commitment_filter\n @posts = Post.filter_by_commitment(post_filter_params)\n end\n\n render json: @posts, each_serializer: PostSerializer\n end",
"def post_type\n @type = params[:type].blank? ? \"Post\" : params[:type]\n @type.constantize\n end",
"def post_type\n @type = params[:type].blank? ? \"Post\" : params[:type]\n @type.constantize\n end",
"def is_post?\n is_entry? && params[:_entry_type_] == 'post'\n end",
"def add_work_type_filter\n return if options[:work_types].blank?\n body.filter(:terms, work_types: options[:work_types])\n end",
"def _filter_by_type(collection, owner_type)\n negate_owner_type = owner_type[0] == '!'\n tracker_owner_type = negate_owner_type ? owner_type.slice(1..-1) : owner_type\n type_constant_names = _tracker_constant_names_for_type(tracker_owner_type)\n collection.where(\"trackers.type #{ negate_owner_type ? 'NOT' : '' } IN (?)\", type_constant_names)\n end",
"def add_type_filter(criteria)\n unless params[:type_uri].blank?\n @type_filter = params[:type_uri]\n @type = RdfType.find(@type_filter) rescue nil\n criteria.where(\"?uri a <#{@type_filter}>\")\n end\n criteria\n end",
"def index\n #the index gets all available Postings where type='transportation'\n @posting = Posting.where(:types=> :transportation)\n end",
"def types_filter\n types_filter = self[:types_filter] || []\n return types_filter if types_filter.any?\n options.fetch 'types_filter', []\n end",
"def index\n @sites = current_user.sites\n @posts = current_user.posts.filter_post_type(params[:post_type]).filter_site(params[:site]).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @posts }\n end\n end",
"def content_type\n if params[:content] == 'before_after'\n @post = @business.before_afters.find_by(slug: params[:content_type])\n elsif params[:content] == 'event'\n @post = @business.events.find(params[:content_type])\n @upcoming_events = @post.event_definition.events.\n where.not(id: @post.id).\n where('occurs_on >= ?', Time.zone.now).\n order(occurs_on: :asc).\n page(1).\n per(4)\n elsif params[:content] == 'event_definition'\n @post = @business.event_definitions.find(params[:content_type])\n elsif params[:content] == 'gallery'\n @post = @business.galleries.find_by(slug: params[:content_type])\n elsif params[:content] == 'offer'\n @post = @business.offers.find_by(slug: params[:content_type])\n elsif params[:content] == 'post'\n @post = @business.posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'quick_post'\n @post = @business.quick_posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'job'\n @post = @business.jobs.find_by(slug: params[:content_type])\n elsif params[:content] == \"creation_post\"\n @post = @business.creation_posts.find_by(slug: params[:content_type])\n elsif params[:content] == \"profile_post\"\n @post = @business.profile_posts.find_by(slug: params[:content_type])\n end\n end",
"def post_type; model_name; end",
"def post_type; model_name; end",
"def content_type\n if params[:content] == 'before_after'\n @post = @business.before_afters.find_by(slug: params[:content_type])\n elsif params[:content] == 'event'\n @post = @business.events.find(params[:content_type])\n @upcoming_events = @post.event_definition.events.\n where.not(id: @post.id).\n where('occurs_on >= ?', Time.zone.now).\n order(occurs_on: :asc).\n page(1).\n per(4)\n elsif params[:content] == 'event_definition'\n @post = @business.event_definitions.find(params[:content_type])\n elsif params[:content] == 'gallery'\n @post = @business.galleries.find_by(slug: params[:content_type])\n elsif params[:content] == 'offer'\n @post = @business.offers.find_by(slug: params[:content_type])\n elsif params[:content] == 'post'\n @post = @business.posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'quick_post'\n @post = @business.quick_posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'job'\n @post = @business.jobs.find_by(slug: params[:content_type])\n end\n end",
"def get_all_post_types\n post_types = {'Interview' => '<i class=\"fa fa-fw fa-newspaper-o\"></i>',\n 'Case Study' => '<i class=\"fa fa-fw fa-list\"></i>',\n 'Facebook' => '<i class=\"fa fa-fw fa-facebook-official\"></i>',\n 'Twitter' => '<i class=\"fa fa-fw fa-twitter\"></i>',\n 'LinkedIn' => '<i class=\"fa fa-fw fa-linkedin-square\"></i>',\n 'Instagram' => '<i class=\"fa fa-fw fa-instagram\"></i>',\n 'Blog Post' => '<i class=\"fa fa-fw fa-wordpress\"></i>',\n 'White Paper' => '<i class=\"fa fa-fw fa-file-o\"></i>',\n 'Ebook' => '<i class=\"fa fa-fw fa-book\"></i>',\n 'Slidedeck' => '<i class=\"fa fa-fw fa-map-o\"></i>',\n 'Video' => '<i class=\"fa fa-fw fa-video-camera\"></i>',\n 'Podcast' => '<i class=\"fa fa-fw fa-microphone\"></i>'\n }\n end",
"def filter(query_type, options = {})\n bool.filter(query_type, options)\n self\n end",
"def resource_type_filter\n return filter_for(:resource_type_id, \n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], _(\"Resource Type\"))\n end",
"def is_a_post?\n self.object_type == :post\n end",
"def index\n @posts = Post.joins(:user).where([\"posts.user_id IS NOT NULL AND users.type_user = ? AND posts.post_id IS NOT NULL\", \"Wholeseller\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def filter(item_type)\n case item_type\n when 'todo' then item_type = TodoItem\n when 'event' then item_type = EventItem\n when 'link' then item_type = LinkItem\n else raise UdaciListErrors::InvalidFilterType,\n \"#{type_desc} is not a valid filter type\"\n end\n output(item_type)\n end",
"def filter type\n if type_allowed?(type.downcase) # Downcase the filter type and check if it's allowed (exists in lists)\n list_type = @@list_types[type.downcase.to_sym]\n @items.select { |item| item.is_a? list_type }\n # Set the title equal to the filter and output the\n # Header and items (as long as there are items to put)\n @title = \"Filtered by: \" + type.capitalize\n puts header\n puts output_for items if items\n else\n raise InvalidFilter, \"Invalid Filter: #{filter}\"\n end\n end",
"def filter_content_type\n case record.filter_id\n when '', 'WymEditor'\n return \"text/html\"\n when 'Textile', 'Markdown'\n return \"text/plain\"\n end\n end",
"def proper_types\n Page.distinct(:_type).reject { |type| type.constantize.new.entry? }\n end",
"def products_by_type(type)\n all_products.select { |product| filter_item_by_type(product, TARGET_PRODUCT_FIELD, type) }\nend",
"def search_type\r\n posting_type == 'Freight' ? 'LoadingSpace' : 'Freight'\r\n end",
"def filters(type=nil)\n unless(type)\n @filters.dup\n else\n const = Splib.find_const(type)\n type = const unless const.nil?\n @filters[type] ? @filters[type].dup : nil\n end\n end",
"def index\n if params.has_key?(:content)\n @rent_posts = RentPost.order(\"created_at DESC\").page(params[:page]).per(5).where('content like ?', \"%#{params[:content]}%\")\n else\n @rent_posts = RentPost.where(rented: false).order(\"created_at DESC\").page(params[:page]).per(5)\n end\n end",
"def resource_type_filter\n return filter_for(:resource_type_id,\n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], ResourceType.model_name.human)\n end",
"def index\n filter = params[:filter]\n @job_posts = \n if filter\n JobPost.filter_job_type(filter).pagination(page: params[:page])\n else\n JobPost.pagination(page: params[:page])\n end\n end",
"def filter_content_types(recommendations_types)\n Content.filter_content_types(recommendations_types)\n end",
"def filtered_index(type)\n return unless (term = params.dig(:filter, :term).strip)\n\n case type\n when :clade\n clade_filter(term)\n when :region\n region_filter(term)\n # when :user\n # user_filter(term)\n end\n end",
"def filter_collection(type, collection)\n # Ignore filtering if `where` is not in frontmatter.\n return collection unless cfg.dig(type, 'where')\n cfg.dig(type, 'where').each do |attr, value|\n # Resolve attribute if it is referencing object(s).\n attr = (attr.split('.').size > 1) ? attr.split('.') : attr\n # Resolve value if it is meant to be dynamic.\n value = page.data[value[1..-1]] if value.start_with?(':')\n # Filter the collection.\n collection = collection.select do |obj|\n # If the attribute is referencing a string we know the value is\n # either a string or an array. If it is a string, match exactly, but\n # if it is an array, look for inclusion.\n if attr.is_a?(String)\n v = obj.data[attr]\n v.is_a?(Array) ? v.include?(value) : v == value\n # If the attribute is an object or array of objects, dig into the\n # object(s) to find the appropriate value to match or be included,\n # as specified above.\n else\n v = obj.data[attr.first]\n v.is_a?(Array) ? v.collect{|x| x.dig(*attr[1..-1])}.include?(value) : v.dig(*attr[1..-1]) == value\n end\n end\n end\n collection\n end",
"def index\n\n if current_user.admin?\n @posts = Post.order(:due_date).where(completed: false)\n else\n @posts = Post.order(:due_date).where(user_id: current_user.email).where(completed: false)\n end\n\n #for filter feature\n if params[:category]\n @post = Post.order(:due_date).where(user_id: current_user.email).where(completed: false).where(category: params[:category])\n else\n @post = Post.order(:due_date).where(user_id: current_user.email).where(completed: false)\n \n end\n end",
"def get_posts_for_user filter, page, per_page, user_id, status, open\n if filter == \"open\"\n @posts = Post.paginate(page: page, :per_page => per_page, :conditions => ['user_id = ? AND status = ? AND open = ?', user_id, status, open])\n elsif filter == \"watched\"\n @posts = []\n Watchedpost.find_each(:conditions => ['user_id = ?', user_id], :select => 'post_id') do |watched_post|\n @posts << Post.first(:conditions => ['id = ?', watched_post.post_id])\n end\n @posts = @posts.paginate(:page => params[:page], :per_page => 20)\n elsif filter == \"archived\"\n @posts = Post.paginate(page: params[:page], :per_page => 20, :conditions => ['user_id = ? AND status = ? AND open = ?', user_id, STATUS_ACTIVE, false]) \n else\n\n end\n end",
"def proper_pages\n Page.where(:_type.in => proper_types)\n end",
"def posts\n Post.filter(:tag_id => self.tag_id)\n end",
"def comments\n posts.all :conditions => { :object_type => :comment }\n end",
"def filter_item_by_type(item, field, value)\n item[field] == value\nend",
"def facets_of_filter_type(filter_type)\n return unless filter_class = available_filter_of_type(filter_type)\n proper_field = has_applied_filter_of_type?(filter_type) ? applied_filter_of_type(filter_type).field : filter_class.field\n self.facets.options.delete(:page)\n self.facets.options.delete(:per_page)\n self.facets[proper_field]\n end",
"def by_type\n filter(:type) do |timeline, type|\n timeline.artifact_type.casecmp(type).zero?\n end\n end",
"def post_type_name\n post_type = PostType.find self.post_type_id\n\n if post_type\n return post_type.name \n else\n return nil\n end\n end",
"def get_posts(person)\n person.out_e(:POSTED).in_v(type: 'post')\nend",
"def index\n filter_by_type unless filter_by_tag\n @blog_posts ||= BlogPost.all\n @blog_posts = @blog_posts.paginate(page: params[:page], per_page: 25)\n end",
"def is_blog_post?\n self.type == 'Blog'\n end",
"def is_blog_post?\n self.type == 'Blog'\n end",
"def index\n # all post that did not have whole seller id\n @posts = Post.joins(:user).where([\"posts.user_id IS NOT NULL AND users.type_user = ? AND posts.post_id IS NULL\", \"Seller\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.where('status != ?', 'hidden')\n @posts = @posts.order(\"created_at DESC\")\n # @posts = @posts.where('created_at > ?', 20.hours.ago)\n @shared_post = Post.first\n if params['category']\n @posts = @posts.where(category: params['category'])\n end\n if params['contains']\n @posts = @posts.to_a.select {|post| post.includes_filter(params['contains'])}\n end\n # @posts.sort {|a,b| (a.created_at <=> b.created_at)}.reverse!\n # @posts.sort {|a,b| a.helping_users.count <=> b.helping_users.count}\n @posts = @posts.paginate(:page => (params[:page] || 1), :per_page =>3)\n end",
"def search_for_type(type)\n q = type\n # search for tweets containing type or #type\n # save them to DB if request is valid (ie not an exception)\n end",
"def index\n get_posts_with_filter\n end",
"def products\n post_types.where(slug: 'commerce').first.try(:posts)\n end",
"def filter_types(input)\n input.reject { |k,v|\n ( skipped_types + [:notype, :other] ).include?(v[:type])\n }\n end",
"def index\n @article_type_filter = (params[:article_type_filter] || ArticleType.all.each.collect{|article_type| article_type.id}).collect{|filter| filter.to_i}\n @articles = Article.where(article_type_id: @article_type_filter)\n end",
"def select_job_postings(graph) \n graph.select { |obj| obj.key?(\"@type\") && (obj[\"@type\"] == \"JobPosting\") }\n end",
"def index\n #debugger\n if params[:search] && !params[:type].equal?(nil)\n #debugger\n @post = Post.search(params[:search], params[:type]).order(\"created_at DESC\").paginate(page: params[:page], per_page: 10)\n\n #debugger\n case params[:type]\n when \"Entertainment\"\n render 'dashboard/entertainment'\n when \"Lifestyle\"\n render 'dashboard/new'\n when \"Food\"\n render 'dashboard/food'\n when \"Sport\"\n render 'dashboard/sport'\n when \"Technology\"\n render 'dashboard/tech'\n when \"Video\"\n render 'dashboard/video'\n end\n\n elsif params[:search] && params[:type].equal?(nil)\n @post = Post.search(params[:search], params[:type]).order(\"created_at DESC\").paginate(page: params[:page], per_page: 10)\n render 'static_pages/index'\n else\n @post = Post.all.order('created_at DESC').paginate(page: params[:page], per_page: 10)\n render 'static_pages/index'\n end\n end",
"def post_type_link(text, type = nil)\r\n type = text if type.nil?\r\n link_to text, :controller => 'post', :action => 'list_by_type',\r\n :type => type\r\n end",
"def get_post_type_object(post_type)\n\n if !Railspress::PHP.is_scalar(post_type) || Railspress.GLOBAL.wp_post_types[post_type].blank?\n return nil\n end\n\n Railspress.GLOBAL.wp_post_types[post_type]\n end",
"def sanitize_post(post, context = 'display')\n if !post.kind_of?(Hash) # obj??\n # Check if post already filtered for this context.\n return post if post.filter == context\n post.id = 0 if post.id.blank?\n post.attributes.each do |field|\n post.write_attribute(field, sanitize_post_field(field, post.read_attribute(field), post.id, context))\n end\n post.filter = context\n elsif post.kind_of?(Hash)\n # Check if post already filtered for this context.\n return post if post.filter == context\n post['id'] = 0 if post.id.blank?\n post.each {|field, value| post[field] = sanitize_post_field(field, value, post['id'], context)}\n post.filter = context\n end\n return post\n end",
"def index\n @material_categories = MaterialCategory.all\n @material_categories = @material_categories.where(oftype: MaterialCategory.oftypes[params[:oftype]]) if params[:oftype].present?\n end",
"def index \n\n @posts = Post.find(@user_id)\n\n # Get Params\n params_title = params[:title]\n params_category = params[:category] #ADASDSA\n \n # Retorna el post dependiendo el filtro\n return category_title_filter if params_category && params_title\n return title_filter if params_title \n return category_filter if params_category \n \n # Si no se hay parametros para filtrar retorna todos los posts\n render json: @posts, status: :ok, each_serializer: PostListSerializer\n end",
"def filtered_by_target_type(target_type)\n filtered_by_association_type(\"target\", target_type)\n end",
"def filter\n filter_type = params[:filter][:type]\n case filter_type\n when \"last_seven\", \"weekly\"\n @filter = \"Weekly\"\n @filtered_runs = current_user.runs.in_the_last_week\n when \"last_thirty\", \"monthly\"\n @filter = \"Monthly\"\n @filtered_runs = current_user.runs.in_the_last_thirty_days\n when \"year\", \"yearly\"\n @filter = \"Yearly\"\n @filtered_runs = current_user.runs.in_the_last_year\n when \"lifetime\"\n @filter = \"Lifetime\"\n @filtered_runs = current_user.runs.most_recent_by_date\n end\n\n respond_to do |format|\n format.js\n end\n\n end",
"def index\n\n if params[:search] and params[:type]\n @questions = Question.where(\"category LIKE ? and (title LIKE ? or quest LIKE ?)\",\"%#{params[:type]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\")\n elsif params[:type]\n @questions = Question.where(\"category LIKE ?\",\"%#{params[:type]}%\")\n elsif params[:search]\n @questions = Question.where(\"title LIKE ? or quest LIKE ?\",\"%#{params[:search]}%\",\"%#{params[:search]}%\")\n else\n @questions = Question.all\n end\n\n\n end",
"def filter_group query_params, *types\n types = [:select, :scope, :date_range, :search] if types.empty?\n query_params.filters.each do |field, config|\n type = config[:type]\n concat render_filter(query_params, field, type) if types.include?(type || :search)\n end\n end",
"def index\n @posts = Post.all.where(\"tipo = ?\",\"url\").order(\"points DESC\")\n end",
"def filter(type)\n list = @items.select { |item| item.class.class_name == type }\n if list.empty?\n fail UdaciListErrors::NoItems, \"No items of type: #{type}\"\n else\n list\n end\n end",
"def filters(type)\n case type\n when :before\n namespaces = self.ancestors + [self]\n all_filters = namespaces.map(&:befores).flatten\n when :after\n namespaces = [self] + self.ancestors.reverse\n all_filters = namespaces.map(&:afters).flatten\n else\n raise 'Invalid filter type. Use :before or :after'\n end\n all_filters.select{|f| f[:opts][:all] || self.send(\"#{type}s\").include?(f) }\n end",
"def relation_filter_for_relation_type(relation_type)\n self.class.relation_filter_for_relation_type(relation_type)\n end",
"def filter(type, &b)\n @app.filters[type] << b\n end",
"def filtered_by_type(notifiable_type)\n filtered_by_association_type(\"notifiable\", notifiable_type)\n end",
"def typus_fields_for(filter); end",
"def type\n self.class.name.demodulize.underscore.gsub(/_filter$/, '').to_sym\n end",
"def getassociated(type)\n self.forward_items_dataset.filter(\"content LIKE '%type\\\":\\\"#{type}%'\")\n end",
"def non_applied_facets_of_filter_type(filter_type)\n return {} unless has_facets_of_filter_type?(filter_type)\n values = applied_filter_values_of_type(filter_type).map {|v| v.to_s}\n facets_of_filter_type(filter_type).reject {|k,v| values.include?(k.to_s)}\n end",
"def post_type_link(text, type = nil)\n type = text if type.nil?\n link_to text, :controller => 'tumble', :action => 'list_by_post_type',\n :type => type\n end",
"def archives_for_type(type, post)\n archives = Archive.all.select { |archive| archive if archive.same_type?(type) }\n images_types = %w(jpg png gif jpeg)\n files_types = %w(rar zip pdf txt)\n html = %()\n\n if images_types.include? type \n archives.each do |archive|\n html << build_structure(archive, type, post)\n end\n elsif files_types.include? type\n archives.each do |archive| \n html << build_structure(archive, type, post)\n end\n end\n content_tag(:ul, html.html_safe, :class => 'thumbnails')\n end",
"def index\n @static_contents = StaticContent.all\n @static_contents = @static_contents.filter_by_type(params[:type]) if params[:type].present?\n end",
"def search_type\n case type\n when \"opinions\"\n query.only_amendables\n when \"amendments\"\n query.only_visible_emendations_for(@current_user, @component)\n else # Assume 'all'\n query.amendables_and_visible_emendations_for(@current_user, @component)\n end\n end",
"def get_content_type_slug(env)\n if request.post? && (path_info =~ %r(^/entry_submissions/(.*)) || params[:content_type_slug])\n $1 || params[:content_type_slug]\n end\n end",
"def category_title_filter\n\n string_title = \"posts.title LIKE '#{params[:title]}'\"\n string_cate = \"categories.name LIKE '#{params[:category]}'\"\n \n filter_cat_title = @posts.where(status: true)\n .where(string_cate)\n .joins(:category).select(:id,:title,:image,:content)\n .where(string_title)\n \n \n \n\n render json: { \n message: \"Filter to Category and Post title\",\n object: filter_cat_title \n }\n end",
"def load_content(post_type)\n content = []\n q = @db.query(\"select distinct *\n from wp_posts as p\n where p.post_type = '#{post_type}' and p.post_status = 'publish'\n order by id desc\")\n\n q.each_hash do |p|\n post = OpenStruct.new(p)\n post.categories = self.post_categories(post.ID).map { |c| @categories[c] }\n post.comments = self.post_comments(post.ID)\n content.push post\n end\n\n return content\n end",
"def uncategorized\n @posts = Refinery::Blog::Post.uncategorized.page(params[:page])\n end",
"def index\n if params[:client_id].presence\n @posts = Post.all.filter(params.slice(:searched_keyword, :address, :status)).where(client_id: params[:client_id]).order(params[:order]).reverse.paginate(:page => params[:page], :per_page => params[:per_page])\n @state = 'client_posts'\n elsif params[:teenager_id].presence\n @posts = Service.where(teenager_id: params[:teenager_id]).reverse.paginate(:page => params[:page], :per_page => params[:per_page])\n @state = 'teenager_posts'\n else\n #get the array and then use where to transform back to activerecord_relation\n @posts = Post.all.filter(params.slice(:searched_keyword, :address, :status ,:category_id, :type_id)).order(params[:order]).reverse.paginate(:page => params[:page], :per_page => params[:per_page])\n @state = 'all'\n end\n end",
"def apply_category_filter\n return if params[:category].blank?\n Category.find(params[:category]).tap do |category|\n @posts = @posts.where category: category\n add_breadcrumb \"by category \\\"#{category.humanize}\\\"\"\n end\n end",
"def index\n @types = Type.where(trash: false)\n end",
"def filter_resources(resources, opts)\n if opts[:type] && opts[:name]\n resources.select { |r| r.type == opts[:type] && r.name == opts[:name] }\n elsif opts[:type]\n resources.select { |r| r.type == opts[:type] }\n elsif opts[:name]\n resources.select { |r| r.name == opts[:name] }\n else\n resources\n end\n end",
"def oz_post_types(sep = ', ')\n TYPES.dup.keys.map { |type| post_type_link(type + 's', type) }.join(sep)\n end",
"def filter\n if params[:modelsearch]\n @results = Carmodel.where('title LIKE ?', \"%#{params[:modelsearch]}%\")\n @model_type = 'modeltype'\n end\n if params[:subtypesearch]\n @results = Carmodelsubtype.where('title LIKE ?', \"%#{params[:subtypesearch]}%\")\n @model_type = 'subtype'\n end\n respond_to do |format|\n format.js\n end\n end",
"def filter\n end",
"def searchPost(keyword)\n posts = Post.where(deleted_user_id: nil).where(\"title like ? or description like ?\", \"%\" + keyword + \"%\", \"%\" + keyword + \"%\")\n end",
"def index\n @posts = Post.search(params[:type], params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.json { render json: @tags }\n end\n end",
"def is_post_type_archive?(post_types = '')\n return @is_post_type_archive if post_types.blank? || !@is_post_type_archive\n\n post_type = get('post_type')\n if post_type.is_a?(Array)\n post_type = post_type.first\n end\n post_type_object = get_post_type_object(post_type)\n\n post_types.include?(post_type_object.name)\n end",
"def oz_post_types(sep = ', ')\r\n TYPES.dup.keys.map { |type| post_type_link(type + 's', type) }.join(sep)\r\n end",
"def filter_categories_by_primary_category(posts)\n filtered = []\n for post in posts\n for post_category in post.categories\n filtered.push(post_category) unless RESTRICTED_CATEGORIES.include? post_category\n end\n end\n filtered.sort.uniq\n end",
"def filters; end"
] |
[
"0.6780538",
"0.6536971",
"0.64968675",
"0.6395417",
"0.6232085",
"0.6226156",
"0.62162143",
"0.6113875",
"0.6113875",
"0.60949653",
"0.6090159",
"0.60430235",
"0.5985461",
"0.597882",
"0.5977049",
"0.59760654",
"0.59688866",
"0.59646165",
"0.59646165",
"0.5956579",
"0.59489495",
"0.5947447",
"0.59413725",
"0.59157366",
"0.5905802",
"0.590061",
"0.5868965",
"0.5851838",
"0.5840804",
"0.5830461",
"0.5787202",
"0.5780722",
"0.57750916",
"0.57721514",
"0.57506263",
"0.5740339",
"0.57047033",
"0.5704024",
"0.56785756",
"0.56755424",
"0.56676996",
"0.56516385",
"0.564912",
"0.5634463",
"0.5613072",
"0.5607433",
"0.5597789",
"0.55864763",
"0.5567503",
"0.55659866",
"0.55659866",
"0.553791",
"0.5536354",
"0.55229056",
"0.5522061",
"0.55212927",
"0.5510799",
"0.550936",
"0.55086434",
"0.5508139",
"0.5486104",
"0.54801613",
"0.5471658",
"0.5470054",
"0.5461756",
"0.54424214",
"0.54333806",
"0.5430581",
"0.5427678",
"0.5422781",
"0.53758895",
"0.5363083",
"0.53531986",
"0.53473866",
"0.534008",
"0.5333166",
"0.5318944",
"0.53170955",
"0.53119045",
"0.53093004",
"0.52863175",
"0.5273291",
"0.52563375",
"0.52558607",
"0.5255335",
"0.5240782",
"0.52371305",
"0.52360445",
"0.5226383",
"0.5224203",
"0.52232367",
"0.52179056",
"0.5213446",
"0.5209285",
"0.52009636",
"0.51960814",
"0.519132",
"0.51811224",
"0.5170501",
"0.51669383"
] |
0.8877474
|
0
|
GET /schmos GET /schmos.json
|
def index
@schmos = Schmo.all
@notes = Note.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end",
"def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end",
"def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end",
"def index\n @swms = Swm.all\n end",
"def set_schmo\n @schmo = Schmo.find(params[:id])\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def show\n if @cmm.nil?\n head :not_found\n else\n render json: @cmm.properties\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end",
"def show\n @cm = Cm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cm }\n end\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end",
"def index\n @sms_tmps = SmsTmp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sms_tmps }\n end\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end",
"def index\n @scandos = Scando.all\n end",
"def show\n render json: @shelter\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end",
"def index\n @socio_spcs = SocioSpc.all\n end",
"def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def show\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end",
"def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end",
"def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end",
"def show\n @sm_volume = SmVolume.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm_volume }\n end\n end",
"def show\n @miccropost = Miccropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @miccropost }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end",
"def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end",
"def index\n @smsnos = Smsno.all\n end",
"def index\n @shmarticles = Shmarticle.all\n end",
"def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end",
"def show\n @sms_tmp = SmsTmp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sms_tmp }\n end\n end",
"def index\n @sales_channels = SalesChannel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sales_channels }\n end\n end",
"def show\n @srsa = Srsa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @srsa }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def show\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scaff }\n end\n end",
"def index\n @custms = Custm.all\n end",
"def index\n @spoilers = Spoiler.all\n\n render json: @spoilers\n end",
"def index\n @clips = Clip.all\n respond_to do |format|\n format.json { render json: @clips.to_json(:include => [:sound_board_clip_sources, :image_playing, :image_default ]) }\n format.xml { render xml: @clips }\n end\n end",
"def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end",
"def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end",
"def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end",
"def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end",
"def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end",
"def list\n @sizes = Admin::Size.all\n\n render json: { sizes: @sizes }\n end",
"def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end",
"def index\n @shouts = Shout.all\n @shouts = Shout.order(\"created_at DESC\")\n @shouts = Shout.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shouts }\n end\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def show\n @swc = Swc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @swc }\n end\n end",
"def show\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sin }\n end\n end",
"def index\n @saccos = Sacco.all\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end",
"def get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def show\n @microposr = Microposr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposr }\n end\n end",
"def destroy\n @schmo.destroy\n respond_to do |format|\n format.html { redirect_to schmos_url, notice: 'Schmo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\n end\n end",
"def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end",
"def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end",
"def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @squishee_cup = SquisheeCup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squishee_cup }\n end\n end",
"def index\n @sms_retrievals = SmsRetrieval.all\n end",
"def index\r\n @salles = Salle.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @salles }\r\n end\r\n end",
"def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def show\n @sessions = MyStudio::Session.all\n @emails = Admin::Customer::Email.unsent\n @studio_users = User.with_studio_role\n @unsubscribes = Unsubscribe.all\n @prospects = Prospect.all\n @sessions_ready_count = MyStudio::Session.ready_to_generate_email.count\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_overview }\n end\n end",
"def index\n @csos = Cso.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @csos }\n end\n end",
"def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end",
"def index\n @nvs_subsystems = NvsSubsystem.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_subsystems }\n end\n end",
"def index\n @scams = Scam.all\n end",
"def index\n @services = Service.all\n @services_hash = @services.map do |s|\n {service: s, medium: s.medium.map { |media|\n media.as_json.merge({ media: url_for(media) })\n }, user: s.user.username, categories: s.categories}#, galleries: s.galleries\n \n end\n render json: @services_hash\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def index\n @shoes = Shoe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\n end\n end",
"def index\n @forecast_msizes = ForecastMsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_msizes }\n end\n end",
"def index\n @streams = Stream.all\n json_response(@streams)\n end",
"def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end",
"def index\n @sprints = Sprint.find_all_by_project_id(@project_id)\n @current_submenu = \"sprints\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end",
"def msau\n render json: get_msau(@visits)\n end",
"def index\n @shasums = Shasum.all\n end",
"def show\n @squish = Squish.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squish }\n end\n end",
"def index\n @service_schedules = ServiceSchedule.all\n\n render json: @service_schedules\n end",
"def index\n @medications = Medication.all\n render json: @medications\n end",
"def show\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def index\r\n @clocks = ClockResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @clocks }\r\n end\r\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index\n @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end",
"def show\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consensu }\n end\n end",
"def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end",
"def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end",
"def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json do\n stats = @mode.stats.map(&:to_simple)\n render json: stats, status: :ok\n end\n end\n end",
"def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\n end\n end"
] |
[
"0.6287215",
"0.6146774",
"0.6007942",
"0.59525365",
"0.5948356",
"0.59110683",
"0.58844894",
"0.5833501",
"0.580308",
"0.5789356",
"0.57869834",
"0.5767391",
"0.5719861",
"0.5718146",
"0.57129455",
"0.56987226",
"0.5695464",
"0.5675094",
"0.5659954",
"0.56318706",
"0.5610547",
"0.5604181",
"0.56012744",
"0.5593486",
"0.5582605",
"0.5571194",
"0.556907",
"0.5555952",
"0.55521417",
"0.55512035",
"0.55501443",
"0.5549913",
"0.55301595",
"0.55164516",
"0.5512784",
"0.55092317",
"0.5490207",
"0.548635",
"0.5483882",
"0.5482753",
"0.5477518",
"0.54728484",
"0.5445569",
"0.5444543",
"0.5443574",
"0.5441348",
"0.54393446",
"0.5433927",
"0.5426815",
"0.5419059",
"0.54185987",
"0.54179853",
"0.54083866",
"0.5400881",
"0.54008454",
"0.53977764",
"0.53930527",
"0.53930527",
"0.5392437",
"0.5392437",
"0.5389121",
"0.5385298",
"0.5381581",
"0.5381466",
"0.5377571",
"0.5374679",
"0.5373767",
"0.5363399",
"0.53630626",
"0.5358031",
"0.5351969",
"0.535101",
"0.5350653",
"0.53501683",
"0.5348227",
"0.53480834",
"0.53445894",
"0.53382164",
"0.53380615",
"0.5336122",
"0.5334381",
"0.5334146",
"0.5331991",
"0.5328592",
"0.5325346",
"0.53251636",
"0.5324124",
"0.5323782",
"0.53205174",
"0.53133446",
"0.5311829",
"0.5311237",
"0.53090703",
"0.53065366",
"0.53028136",
"0.53025883",
"0.5302185",
"0.5299395",
"0.52986765",
"0.52919847"
] |
0.60849845
|
2
|
GET /schmos/1 GET /schmos/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end",
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end",
"def set_schmo\n @schmo = Schmo.find(params[:id])\n end",
"def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end",
"def show\n @cm = Cm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cm }\n end\n end",
"def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end",
"def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end",
"def index\n @schmos = Schmo.all\n @notes = Note.all\n end",
"def show\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scaff }\n end\n end",
"def show\n if @cmm.nil?\n head :not_found\n else\n render json: @cmm.properties\n end\n end",
"def show\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end",
"def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end",
"def show\n @srsa = Srsa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @srsa }\n end\n end",
"def show\n @swc = Swc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @swc }\n end\n end",
"def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end",
"def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end",
"def show\n @sms_tmp = SmsTmp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sms_tmp }\n end\n end",
"def index\n @swms = Swm.all\n end",
"def show\n @sm_volume = SmVolume.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm_volume }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def show\n @squishee_cup = SquisheeCup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squishee_cup }\n end\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def show\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consensu }\n end\n end",
"def show\n @miccropost = Miccropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @miccropost }\n end\n end",
"def show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\n end\n end",
"def show\n @central_correio = CentralCorreio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @central_correio }\n end\n end",
"def index\n @sms_tmps = SmsTmp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sms_tmps }\n end\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @microposr = Microposr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposr }\n end\n end",
"def show\n @squish = Squish.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squish }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scrobble }\n end\n end",
"def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end",
"def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end",
"def show\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sin }\n end\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def show\n render json: @shelter\n end",
"def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end",
"def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end",
"def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end",
"def scrumboard\n @sprint = Sprint.find(params[:id])\n @current_submenu = \"sprints\"\n @current_subsubmenu = \"scrumboard\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end",
"def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end",
"def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end",
"def show\n @simnumlog = Simnumlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @simnumlog }\n end\n end",
"def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\n end\n end",
"def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def show\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sixmonth_customer }\n end\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def show\n render json: Server.where(name: params[:name]).first\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def show\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasp }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def show\n @srsaa = Srsaa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @srsaa }\n end\n end",
"def show\n @co_size = CoSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @co_size }\n end\n end",
"def show\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microplst }\n end\n end",
"def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end",
"def show\n @mecanicacomplejo = Mecanicacomplejo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mecanicacomplejo }\n end\n end",
"def show\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallresource }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def show\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stable }\n end\n end",
"def index\n @srsas = Srsa.all\n @srsas = Srsa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsas }\n end\n end",
"def show\n @curriculums_subject = CurriculumsSubject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculums_subject }\n end\n end",
"def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end",
"def show\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server1 }\n end\n end",
"def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end",
"def show\n @clip = Clip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clip }\n end\n end",
"def show\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def show\r\n @salle = Salle.find(params[:id])\r\n\r\n@machines = Machine.find(:all, :conditions =>{:salle_id => Salle.find(params[:id])})\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end",
"def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end",
"def show\n @mws_order = MwsOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mws_order }\n end\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end",
"def index\n @sprints = Sprint.find_all_by_project_id(@project_id)\n @current_submenu = \"sprints\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def show\n @wm = WmsResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wm }\n end\n end",
"def show\n @rpm = Rpm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rpm }\n end\n end",
"def show\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sproject }\n end\n end",
"def show\n @mostsmallconstruction = Mostsmallconstruction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallconstruction }\n end\n end",
"def index\n @smsnos = Smsno.all\n end",
"def index\n @macs = Mac.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @macs }\n end\n end",
"def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end",
"def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end",
"def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end",
"def show\n @system = System.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system }\n end\n end",
"def show\n @music = Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def show\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sslplan }\n end\n end",
"def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end",
"def show\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprintstory }\n end\n end",
"def index\n @socio_spcs = SocioSpc.all\n end",
"def show\n @user_sc = UserSc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_sc }\n end\n end",
"def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end",
"def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end"
] |
[
"0.64544874",
"0.6269609",
"0.61858207",
"0.61826146",
"0.6130916",
"0.61101973",
"0.6033174",
"0.59969854",
"0.598803",
"0.5985184",
"0.59719825",
"0.5898784",
"0.58714503",
"0.5871348",
"0.58592427",
"0.58543295",
"0.58455735",
"0.5834173",
"0.58272785",
"0.5826233",
"0.5822564",
"0.57894695",
"0.57795656",
"0.57745343",
"0.57709783",
"0.57697946",
"0.57521135",
"0.57448816",
"0.57266265",
"0.5711634",
"0.57021767",
"0.5695313",
"0.56790656",
"0.56662494",
"0.56614083",
"0.56486773",
"0.56370634",
"0.5628858",
"0.5624883",
"0.5624596",
"0.56173205",
"0.5614878",
"0.5614768",
"0.56000257",
"0.55978507",
"0.5595746",
"0.55948013",
"0.559471",
"0.55911607",
"0.55891544",
"0.55839735",
"0.5583641",
"0.5582421",
"0.558241",
"0.5548932",
"0.55463594",
"0.55446625",
"0.554305",
"0.55426764",
"0.55344826",
"0.55316556",
"0.5530302",
"0.5529857",
"0.5529549",
"0.55185735",
"0.5516295",
"0.5512948",
"0.5509153",
"0.55062497",
"0.5505763",
"0.54965353",
"0.54958194",
"0.54957116",
"0.549062",
"0.54891586",
"0.54888195",
"0.54874104",
"0.548692",
"0.5484893",
"0.54845214",
"0.5484455",
"0.5483209",
"0.5482043",
"0.54805374",
"0.5479371",
"0.5475548",
"0.54742974",
"0.5470256",
"0.5468351",
"0.546481",
"0.54640675",
"0.5462675",
"0.54624015",
"0.54624015",
"0.54540914",
"0.5450593",
"0.5447329",
"0.5443449",
"0.5442138",
"0.54403",
"0.5439536"
] |
0.0
|
-1
|
POST /schmos POST /schmos.json
|
def create
@schmo = Schmo.new(schmo_params)
respond_to do |format|
if @schmo.save
format.html { redirect_to @schmo, notice: 'Schmo was successfully created.' }
format.json { render :show, status: :created, location: @schmo }
else
format.html { render :new }
format.json { render json: @schmo.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @swm = Swm.new(swm_params)\n\n respond_to do |format|\n if @swm.save\n format.html { redirect_to @swm, notice: 'Swm was successfully created.' }\n format.json { render :show, status: :created, location: @swm }\n else\n format.html { render :new }\n format.json { render json: @swm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scando = Scando.new(scando_params)\n\n respond_to do |format|\n if @scando.save\n format.html { redirect_to @scando, notice: 'Scando was successfully created.' }\n format.json { render :show, status: :created, location: @scando }\n else\n format.html { render :new }\n format.json { render json: @scando.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @documentos_simposio = DocumentosSimposio.new(documentos_simposio_params)\n\n respond_to do |format|\n if @documentos_simposio.save\n format.html { redirect_to @documentos_simposio, notice: 'Documentos simposio was successfully created.' }\n format.json { render :show, status: :created, location: @documentos_simposio }\n else\n format.html { render :new }\n format.json { render json: @documentos_simposio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micorpost = Micorpost.new(params[:micorpost])\n\n respond_to do |format|\n if @micorpost.save\n format.html { redirect_to @micorpost, notice: 'Micorpost was successfully created.' }\n format.json { render json: @micorpost, status: :created, location: @micorpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micorpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shichoson = Shichoson.new(params[:shichoson])\n\n respond_to do |format|\n if @shichoson.save\n format.html { redirect_to @shichoson, notice: 'Shichoson was successfully created.' }\n format.json { render json: @shichoson, status: :created, location: @shichoson }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shichoson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @microposst = Microposst.new(params[:microposst])\n\n respond_to do |format|\n if @microposst.save\n format.html { redirect_to @microposst, notice: 'Microposst was successfully created.' }\n format.json { render json: @microposst, status: :created, location: @microposst }\n else\n format.html { render action: \"new\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schooladmin = Schooladmin.new(schooladmin_params)\n\n respond_to do |format|\n if @schooladmin.save\n format.html { redirect_to @schooladmin, notice: 'Schooladmin was successfully created.' }\n format.json { render :show, status: :created, location: @schooladmin }\n else\n format.html { render :new }\n format.json { render json: @schooladmin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @samochod = Samochod.new(samochod_params)\n\n respond_to do |format|\n if @samochod.save\n format.html { redirect_to @samochod, notice: 'Samochod was successfully created.' }\n format.json { render :show, status: :created, location: @samochod }\n else\n format.html { render :new }\n format.json { render json: @samochod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_schmo\n @schmo = Schmo.find(params[:id])\n end",
"def create\n @musico = Musico.new(musico_params)\n\n respond_to do |format|\n if @musico.save\n format.html { redirect_to @musico, notice: 'Musico was successfully created.' }\n format.json { render :show, status: :created, location: @musico }\n else\n format.html { render :new }\n format.json { render json: @musico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio_spc = SocioSpc.new(socio_spc_params)\n\n respond_to do |format|\n if @socio_spc.save\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_spc }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @method_sdm = MethodSdm.new(method_sdm_params)\n\n respond_to do |format|\n if @method_sdm.save\n format.html { redirect_to @method_sdm, notice: 'Method sdm was successfully created.' }\n format.json { render :show, status: :created, location: @method_sdm }\n else\n format.html { render :new }\n format.json { render json: @method_sdm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @csosn = Csosn.new(params[:csosn])\n\n respond_to do |format|\n if @csosn.save\n format.html { redirect_to @csosn, notice: 'Csosn was successfully created.' }\n format.json { render json: @csosn, status: :created, location: @csosn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response.headers['Content-Type'] = 'text/javascript'\n\n attributes = params.require(:board).permit(:name)\n @board = Board.create!(attributes)\n $redis.publish('boards:create', @board.to_json)\n render nothing: true\n end",
"def create\n megam_rest.post_subscriptions(to_hash)\n end",
"def create\n @miccropost = Miccropost.new(params[:miccropost])\n\n respond_to do |format|\n if @miccropost.save\n format.html { redirect_to @miccropost, notice: 'Miccropost was successfully created.' }\n format.json { render json: @miccropost, status: :created, location: @miccropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @miccropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suscription = Suscription.new(suscription_params)\n\n respond_to do |format|\n if @suscription.save\n format.html { redirect_to root_path, notice: 'Suscription was successfully created.' }\n format.json { render :show, status: :created, location: @suscription }\n else\n format.html { render :new }\n format.json { render json: @suscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @schmo.destroy\n respond_to do |format|\n format.html { redirect_to schmos_url, notice: 'Schmo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def sermon_params\n params.require(:sermon).permit(:title, :notes, :audio)\n end",
"def create\n @stoc = Stoc.new(stoc_params)\n\n respond_to do |format|\n if @stoc.save\n format.html { redirect_to @stoc, notice: 'Stoc was successfully created.' }\n format.json { render :show, status: :created, location: @stoc }\n else\n format.html { render :new }\n format.json { render json: @stoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @smsno = Smsno.new(smsno_params)\n\n respond_to do |format|\n if @smsno.save\n format.html { redirect_to @smsno, notice: 'Smsno was successfully created.' }\n format.json { render :show, status: :created, location: @smsno }\n else\n format.html { render :new }\n format.json { render json: @smsno.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def create\n @sinnoh = Sinnoh.new(sinnoh_params)\n\n respond_to do |format|\n if @sinnoh.save\n format.html { redirect_to @sinnoh, notice: 'Sinnoh was successfully created.' }\n format.json { render :show, status: :created, location: @sinnoh }\n else\n format.html { render :new }\n format.json { render json: @sinnoh.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sacco = Sacco.new(sacco_params)\n\n respond_to do |format|\n if @sacco.save\n format.html { redirect_to @sacco, notice: 'Sacco was successfully created.' }\n format.json { render :show, status: :created, location: @sacco }\n else\n format.html { render :new }\n format.json { render json: @sacco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sprint.save\n\n respond_with(@sprint)\n end",
"def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def create\n @sms_based = SmsBased.new(sms_based_params)\n\n respond_to do |format|\n if @sms_based.save\n format.html { redirect_to admin_services_path, notice: 'successfully created.' }\n format.json { render action: 'show', status: :created, location: @sms_based }\n else\n format.html { redirect_to admin_services_path, notice: 'Failed.' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shout = Shout.new(params[:shout])\n\n respond_to do |format|\n if @shout.save\n format.html { redirect_to @shout, notice: 'Shout was successfully created.' }\n format.json { render json: @shout, status: :created, location: @shout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @simulado = Simulado.new(simulado_params)\n\n respond_to do |format|\n if @simulado.save\n format.html { redirect_to @simulado, notice: 'Simulado was successfully created.' }\n format.json { render :show, status: :created, location: @simulado }\n else\n format.html { render :new }\n format.json { render json: @simulado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shoutout = Shoutout.new(create_params)\n if @shoutout.save\n render json: @shoutout, status: 201, location: api_v1_shoutout_path(@shoutout.id)\n else\n render json: { error: \"Application error\", status: 400 }, status: 400\n end\n end",
"def create\n puts management_params\n @management = Management.new(management_params)\n if @management.save\n render json: @management, status: :created\n else \n render json: @management.errors, status: :unprocessable_entity\n end\n end",
"def create\n @shop_claim = ShopClaim.new(shop_claim_params)\n\n if @shop_claim.save\n render json: @shop_claim, status: :created, location: @shop_claim\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end",
"def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end",
"def create\n @mircopost = Mircopost.new(mircopost_params)\n\n respond_to do |format|\n if @mircopost.save\n format.html { redirect_to @mircopost, notice: 'Mircopost was successfully created.' }\n format.json { render :show, status: :created, location: @mircopost }\n else\n format.html { render :new }\n format.json { render json: @mircopost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @musica = Musica.new(musica_params)\n\n respond_to do |format|\n if @musica.save\n format.html { redirect_to @musica, notice: 'Álbum publicada com sucesso!' }\n format.json { render :show, status: :created, location: @musica }\n else\n format.html { render :new }\n format.json { render json: @musica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def customer_update_mq\n body = CGI::parse(request.body.read)\n data = { 'payload' => body['payload'][0] }\n Customer.new(data).create\n respond_with({}, :location => nil, :status => 200)\n end",
"def create\n @minicurso = Minicurso.new(params[:minicurso])\n\n respond_to do |format|\n if @minicurso.save\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully created.' }\n format.json { render json: @minicurso, status: :created, location: @minicurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scheduled_chore = ScheduledChore.new(scheduled_chore_params)\n\n respond_to do |format|\n if @scheduled_chore.save\n format.html { redirect_to @scheduled_chore, notice: 'Scheduled chore created.' }\n format.json { render :show, status: :created, location: @scheduled_chore }\n else\n format.html { render :new }\n format.json { render json: @scheduled_chore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sponsercf = Sponsercf.new(sponsercf_params)\n\n respond_to do |format|\n if @sponsercf.save\n \n format.html { redirect_to @sponsercf, notice: 'Sponsercf was successfully created.' }\n format.json { render :show, status: :created, location: @sponsercf }\n else\n format.html { render :new }\n format.json { render json: @sponsercf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @microposr = Microposr.new(params[:microposr])\n\n respond_to do |format|\n if @microposr.save\n format.html { redirect_to @microposr, notice: 'Microposr was successfully created.' }\n format.json { render json: @microposr, status: :created, location: @microposr }\n else\n format.html { render action: \"new\" }\n format.json { render json: @microposr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micropst = Micropst.new(micropst_params)\n\n respond_to do |format|\n if @micropst.save\n format.html { redirect_to @micropst, notice: \"Micropst was successfully created.\" }\n format.json { render :show, status: :created, location: @micropst }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @micropst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shmarticle = Shmarticle.new(shmarticle_params)\n\n respond_to do |format|\n if @shmarticle.save\n format.html { redirect_to @shmarticle, notice: 'Shmarticle was successfully created.' }\n format.json { render :show, status: :created, location: @shmarticle }\n else\n format.html { render :new }\n format.json { render json: @shmarticle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @short_message = ShortMessage.new(short_message_params)\n\n client = GlobeLabs.new\n target = @short_message.target\n if target.present?\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n\n recepients = params[:recepients]\n Rails.logger.info(\"==== params:#{params.inspect}\")\n if recepients.present?\n Rails.logger.info(\"==== params:#{params[:recepients].inspect}\")\n recepients.each do |cell_no|\n @short_message = ShortMessage.new(short_message_params)\n @short_message.target = cell_no\n if @short_message.save\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n end\n end\n\n respond_to do |format|\n if @short_message.save\n format.html { redirect_to short_messages_path, notice: 'Short message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @short_message }\n else\n format.html { render action: 'new' }\n format.json { render json: @short_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @climb = Climb.new(params[:climb])\n respond_to do |format|\n if @climb.save\n Sesh.find(params[:sesh_id]).climbs << @climb\n format.html { redirect_to @climb.sesh, notice: 'Climb was successfully created.' }\n format.json { render json: @climb.sesh.data.to_json, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @climb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create\n @condclima = Condclima.new(params[:condclima])\n\n respond_to do |format|\n if @condclima.save\n format.html { redirect_to @condclima, notice: 'Condclima was successfully created.' }\n format.json { render json: @condclima, status: :created, location: @condclima }\n else\n format.html { render action: \"new\" }\n format.json { render json: @condclima.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response.headers[\"Content-Type\"] = \"text/javascript\"\n @card = @plan.cards.new(card_params)\n @card.save\n $redis.publish('messages.create', @card.to_json)\n end",
"def create\n @micrrapost = Micrrapost.new(params[:micrrapost])\n\n respond_to do |format|\n if @micrrapost.save\n format.html { redirect_to @micrrapost, notice: 'Micrrapost was successfully created.' }\n format.json { render json: @micrrapost, status: :created, location: @micrrapost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrrapost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sm = Sm.new(params[:sm])\n\n respond_to do |format|\n if @sm.save\n SmsMailer.send_sms(@sm).deliver\n format.html { redirect_to @sm, notice: \"SMS Sent successfully to #{@sm.number}.\" }\n format.json { render json: @sm, status: :created, location: @sm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @misuration_subscription = MisurationSubscription.new(misuration_subscription_params)\n @misuration_subscription.user_id=current_user.id\n respond_to do |format|\n if @misuration_subscription.save\n format.html { redirect_to @misuration_subscription, notice: 'Iscrizione al sensore creata correttamente' }\n format.json { render :show, status: :created, location: @misuration_subscription }\n else\n format.html { render :new }\n format.json { render json: @misuration_subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cso = Cso.new(params[:cso])\n\n respond_to do |format|\n if @cso.save\n format.html { redirect_to @cso, notice: 'Cso was successfully created.' }\n format.json { render json: @cso, status: :created, location: @cso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @daw_matricula_promo = DawMatriculaPromo.new(daw_matricula_promo_params)\n\n respond_to do |format|\n if @daw_matricula_promo.save\n format.html { redirect_to @daw_matricula_promo, notice: 'Daw matricula promo was successfully created.' }\n format.json { render :show, status: :created, location: @daw_matricula_promo }\n else\n format.html { render :new }\n format.json { render json: @daw_matricula_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def index\n @schmos = Schmo.all\n @notes = Note.all\n end",
"def schmo_params\n params.require(:schmo).permit(:name, :address, :ph, :email, :balance)\n end",
"def create\n @scaff = Scaff.new(params[:scaff])\n\n respond_to do |format|\n if @scaff.save\n format.html { redirect_to @scaff, notice: 'Scaff was successfully created.' }\n format.json { render json: @scaff, status: :created, location: @scaff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sm_volume = SmVolume.new(params[:sm_volume])\n\n respond_to do |format|\n if @sm_volume.save\n format.html { redirect_to @sm_volume, notice: 'Sm volume was successfully created.' }\n format.json { render json: @sm_volume, status: :created, location: @sm_volume }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sm_volume.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sasmap = Sasmap.new(params[:sasmap])\n\n respond_to do |format|\n if @sasmap.save\n format.html { redirect_to @sasmap, notice: 'Sasmap was successfully created.' }\n format.json { render json: @sasmap, status: :created, location: @sasmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sasmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sms_tmp = SmsTmp.new(params[:sms_tmp])\n\n respond_to do |format|\n if @sms_tmp.save\n format.html { redirect_to \"/home/sms\", notice: '短信模版创建成功.' }\n format.json { render json: @sms_tmp, status: :created, location: @sms_tmp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sms_tmp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @srsa = Srsa.new(params[:srsa])\n\n respond_to do |format|\n if @srsa.save\n format.html { redirect_to :action => 'index' }\n format.json { render json: @srsa, status: :created, location: @srsa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @srsa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sms_notification = SmsNotification.new(sms_notification_params)\n\n respond_to do |format|\n if @sms_notification.save\n format.html { redirect_to @sms_notification, notice: 'Sms notification was successfully created.' }\n format.json { render :show, status: :created, location: @sms_notification }\n else\n format.html { render :new }\n format.json { render json: @sms_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reporter_suscription = Reporter::Suscription.new(reporter_suscription_params)\n\n respond_to do |format|\n if @reporter_suscription.save\n format.html { redirect_to @reporter_suscription, notice: 'Suscription was successfully created.' }\n format.json { render :show, status: :created, location: @reporter_suscription }\n else\n format.html { render :new }\n format.json { render json: @reporter_suscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mongo_question = MongoQuestion.new(mongo_question_params)\n @mongo_question.topics = params['mongo_question']['topics']\n respond_to do |format|\n if @mongo_question.save\n format.html { redirect_to @mongo_question, notice: 'Mongo question was successfully created.' }\n format.json { render :show, status: :created, location: @mongo_question }\n else\n format.html { render :new }\n format.json { render json: @mongo_question.errors, status: :unprocessable_entity }\n end\n end\n\n Question.create mongo_id: @mongo_question._id, registrant_id: current_registrant_id\n end",
"def create\n @shout = Shout.new(params[:shout])\n\n sendPush (@shout.name + ' just shouted ' + @shout.shout_message)\n \n respond_to do |format|\n if @shout.save\n format.html { redirect_to(@shout, :notice => 'Shout was successfully created.') }\n format.xml { render :xml => @shout, :status => :created, :location => @shout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shout.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @schmarticle = Schmarticle.new(schmarticle_params)\n\n respond_to do |format|\n if @schmarticle.save\n format.html { redirect_to @schmarticle, notice: 'Schmarticle was successfully created.' }\n format.json { render :show, status: :created, location: @schmarticle }\n else\n format.html { render :new }\n format.json { render json: @schmarticle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @musictrack = Musictrack.new(musictrack_params)\n\n respond_to do |format|\n if @musictrack.save\n format.html { redirect_to @musictrack, notice: 'Musictrack was successfully created.' }\n format.json { render :show, status: :created, location: @musictrack }\n else\n format.html { render :new }\n format.json { render json: @musictrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sm = Sm.new(params[:sm])\n\n respond_to do |format|\n if @sm.save\n format.html { redirect_to(@sm, :notice => 'Sm was successfully created.') }\n format.xml { render :xml => @sm, :status => :created, :location => @sm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @smstag = Smstag.new(smstag_params)\n\n respond_to do |format|\n if @smstag.save and current_user\n format.html { redirect_to @smstag, notice: 'Smstag was successfully created.' }\n format.json { render :show, status: :created, location: @smstag }\n else\n format.html { render :new }\n format.json { render json: @smstag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @smurf = Smurf.new(params[:smurf])\n\n respond_to do |format|\n if @smurf.save\n format.html { redirect_to @smurf, notice: 'Smurf was successfully created.' }\n format.json { render json: @smurf, status: :created, location: @smurf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smurf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medusa_premis_representation_object = MedusaPremis::RepresentationObject.new(params[:medusa_premis_representation_object])\n\n respond_to do |format|\n if @medusa_premis_representation_object.save\n format.html { redirect_to(catalog_path(id: @medusa_premis_representation_object.id), notice: 'Representation object was successfully created.') }\n format.json { render json: @medusa_premis_representation_object, status: :created, location: @medusa_premis_representation_object }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medusa_premis_representation_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @custm = Custm.new(custm_params)\n\n respond_to do |format|\n if @custm.save\n format.html { redirect_to @custm, notice: 'Custm was successfully created.' }\n format.json { render :show, status: :created, location: @custm }\n else\n format.html { render :new }\n format.json { render json: @custm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prospecto_marca = ProspectoMarca.new(prospecto_marca_params)\n\n respond_to do |format|\n if @prospecto_marca.save\n format.html { redirect_to @prospecto_marca, notice: 'Prospecto marca was successfully created.' }\n format.json { render :show, status: :created, location: @prospecto_marca }\n else\n format.html { render :new }\n format.json { render json: @prospecto_marca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scoot = Scoot.new(scoot_params)\n \n respond_to do |format|\n if @scoot.save\n format.html { redirect_to root_url, notice: 'Scoot was successfully created.' }\n format.json { render :show, status: :created, location: @scoot }\n else\n format.html { render :new }\n format.json { render json: @scoot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medio = Medio.new(params[:medio])\n\n respond_to do |format|\n if @medio.save\n format.html { redirect_to @medio, :notice => 'Medio was successfully created.' }\n format.json { render :json => @medio, :status => :created, :location => @medio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @medio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_mural = Admin::Mural.new(admin_mural_params)\n\n respond_to do |format|\n if @admin_mural.save\n format.html { redirect_to @admin_mural, notice: 'Mural was successfully created.' }\n format.json { render :show, status: :created, location: @admin_mural }\n else\n format.html { render :new }\n format.json { render json: @admin_mural.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish(args)\n object = args[:object]\n action = args[:action]\n options = (args[:options] || {}).stringify_keys\n\n data = {\n :key => object.obj_key,\n :action => action,\n :headline => object.to_title,\n :url => object.public_url,\n :admin_url => object.admin_edit_url,\n :status => object.status\n }.merge(options)\n\n $redis.publish(\"scprcontent\", data.to_json)\n end",
"def create\n @sinistro = Sinistro.new(sinistro_params)\n\n respond_to do |format|\n if @sinistro.save\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully created.' }\n format.json { render :show, status: :created, location: @sinistro }\n else\n format.html { render :new }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suspect = Suspect.new(suspect_params)\n\n respond_to do |format|\n if @suspect.save\n format.html { redirect_to @suspect, notice: 'Suspect was successfully created.' }\n format.json { render :show, status: :created, location: @suspect }\n else\n format.html { render :new }\n format.json { render json: @suspect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @smallsurvey = Smallsurvey.new(smallsurvey_params)\n\n respond_to do |format|\n if @smallsurvey.save\n format.html { redirect_to final_path, notice: 'Smallsurvey was successfully created.' }\n format.json { render :show, status: :created, location: @smallsurvey }\n else\n format.html { render :new }\n format.json { render json: @smallsurvey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @minisound = Minisound.new(minisound_params)\n\n respond_to do |format|\n if @minisound.save\n format.html { redirect_to @minisound, notice: 'Minisound was successfully created.' }\n format.json { render :show, status: :created, location: @minisound }\n else\n format.html { render :new }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @semestre = Semestre.new(semestre_params)\n\n respond_to do |format|\n if @semestre.save\n format.html { redirect_to @semestre, notice: 'Semestre was successfully created.' }\n format.json { render :show, status: :created, location: @semestre }\n else\n format.html { render :new }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promo = Promo.new(params[:promo])\n\n respond_to do |format|\n if @promo.save\n format.html { redirect_to @promo, notice: 'Promo was successfully created.' }\n format.json { render json: @promo, status: :created, location: @promo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dis_generic_monograph = DisGenericMonograph.new(dis_generic_monograph_params)\n\n respond_to do |format|\n if @dis_generic_monograph.save\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully created.' }\n format.json { render :show, status: :created, location: @dis_generic_monograph }\n else\n format.html { render :new }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice }\n else\n format.html { render :new }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generatesingletestplan\n\trelease = params[:release]\n\tpriority = params[:priority]\n\texectype = params[:exectype]\n\ttimelimit = params[:timelimit]\n\t# получаем с сервера нужные данные\n\tmds = Hash.new()\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t\t# say Hello to server\n\t\tclient.puts \"MasterOnline\"\n\t\tclient.gets\n\t\tclient.puts \"master_set get_singletestplan #{release} #{priority} #{exectype} #{timelimit}\"\n\t\tmds = JSON.parse(client.gets)\n\t\tclient.puts \"master_set close_connection\"\n\t}\n\t# подготавливаем данные для отправки на веб страницу\n\tnewTree = mds\n\t#newTree = newTree[\"TestItem\"][0]\n\t# новое дерево\n\t# вводим фиктивную вершину\n\tvalue = Hash.new()\n\tvalue[:data] = \"Тестирование \" + release\n\t\tfalseAttr = Hash.new()\n\t\tfalseAttr[:class] = \"jstree-checked\"\n\t\tfalseAttr[:id] = \"0001\"\n\t\tfalseAttr[:MethodName] = \"\"\n\t\tfalseAttr[:UnitName] = \"\"\n\tvalue[:attr] = falseAttr\n\t# получаем дерево\n\tchildrens = Array.new()\n\tnewTree[\"TestItem\"].each do |x|\n\t\ttree = createTreeForView(x)\n\t\tchildrens.push(tree)\n\tend\n\tvalue[:children] = childrens\n\trawarray = { :data => value}\n\tmds_for_send = rawarray.to_json\n\trender :text => mds_for_send\n end",
"def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end",
"def create\n @sprint = Sprint.new(params[:sprint])\n\n respond_to do |format|\n if @sprint.save\n format.html { redirect_to [:admin, @sprint], notice: 'Sprint was successfully created.' }\n format.json { render json: @sprint, status: :created, location: @sprint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @men_shop_collection = MenShopCollection.new(men_shop_collection_params)\n\n respond_to do |format|\n if @men_shop_collection.save\n format.html { redirect_to @men_shop_collection, notice: 'Men shop collection was successfully created.' }\n format.json { render :show, status: :created, location: @men_shop_collection }\n else\n format.html { render :new }\n format.json { render json: @men_shop_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def register_sale_mq\n body = CGI::parse(request.body.read)\n data = { 'payload' => body['payload'][0] }\n RegisterSale.new(data).create\n respond_with({}, :location => nil, :status => 200)\n end",
"def create\n @spdatum = Spdatum.new(params[:spdatum])\n\n respond_to do |format|\n if @spdatum.save\n format.html { redirect_to @spdatum, notice: 'Spdatum was successfully created.' }\n format.json { render json: @spdatum, status: :created, location: @spdatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spdatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micgropost = Micgropost.new(params[:micgropost])\n\n respond_to do |format|\n if @micgropost.save\n format.html { redirect_to(@micgropost, :notice => 'Micgropost was successfully created.') }\n format.xml { render :xml => @micgropost, :status => :created, :location => @micgropost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @micgropost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sim = Sim.new(sim_params)\n\n respond_to do |format|\n if @sim.save\n format.html { redirect_to @sim, notice: 'Sim fue creada exitosamente' }\n format.json { render :show, status: :created, location: @sim }\n else\n format.html { redirect_to new_sim_url, alert: @sim.errors }\n format.json { render json: @sim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud_servicio = SolicitudServicio.new(params[:solicitud_servicio])\n\n respond_to do |format|\n if @solicitud_servicio.save\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully created.' }\n format.json { render json: @solicitud_servicio, status: :created, location: @solicitud_servicio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @smoking = Smoking.new(smoking_params)\n\n respond_to do |format|\n if @smoking.save\n format.html { redirect_to @smoking, notice: 'Smoking was successfully created.' }\n format.json { render :show, status: :created, location: @smoking }\n else\n format.html { render :new }\n format.json { render json: @smoking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scaff = Scaff.new(scaff_params)\n\n respond_to do |format|\n if @scaff.save\n format.html { redirect_to @scaff, notice: 'Scaff was successfully created.' }\n format.json { render :show, status: :created, location: @scaff }\n else\n format.html { render :new }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ref_sanatorium = Ref::Sanatorium.new(params[:ref_sanatorium])\n\n respond_to do |format|\n if @ref_sanatorium.save\n format.html { redirect_to ref_sanatoria_path, notice: I18n.t(:record_created) }\n format.json { render json: @ref_sanatorium, status: :created, location: @ref_sanatorium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_sanatorium.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.58984995",
"0.550309",
"0.5471433",
"0.5392018",
"0.5322792",
"0.53135544",
"0.53125525",
"0.5302609",
"0.5298284",
"0.5283186",
"0.52796805",
"0.52739847",
"0.5272804",
"0.5253575",
"0.5250156",
"0.5247957",
"0.5247251",
"0.5244934",
"0.52402085",
"0.52375656",
"0.52326375",
"0.5227095",
"0.5225492",
"0.5220677",
"0.52167845",
"0.5213581",
"0.5209809",
"0.5201148",
"0.5193617",
"0.51794654",
"0.5177593",
"0.5158168",
"0.51257217",
"0.5113005",
"0.5103037",
"0.5087332",
"0.5083862",
"0.5071749",
"0.5071433",
"0.5065421",
"0.50622815",
"0.5060628",
"0.5056454",
"0.50492233",
"0.5046715",
"0.5040616",
"0.5040284",
"0.503848",
"0.5013349",
"0.5003825",
"0.4997002",
"0.4993913",
"0.49919686",
"0.4984734",
"0.49777517",
"0.4976492",
"0.4970226",
"0.4969381",
"0.49692932",
"0.4968014",
"0.49637628",
"0.49626848",
"0.49613324",
"0.49604818",
"0.49586722",
"0.49586168",
"0.49494666",
"0.49449697",
"0.4941744",
"0.49404812",
"0.49355373",
"0.49285564",
"0.49214888",
"0.49093646",
"0.4904311",
"0.49038866",
"0.49006888",
"0.48953113",
"0.4894697",
"0.48911068",
"0.48890394",
"0.48816565",
"0.4873782",
"0.4867975",
"0.48654902",
"0.48652625",
"0.48637015",
"0.48622397",
"0.48597676",
"0.4859568",
"0.4859478",
"0.4858213",
"0.48574552",
"0.4857167",
"0.485283",
"0.4848644",
"0.48458573",
"0.4844701",
"0.4843352",
"0.4842636"
] |
0.6403342
|
0
|
PATCH/PUT /schmos/1 PATCH/PUT /schmos/1.json
|
def update
respond_to do |format|
if @schmo.update(schmo_params)
format.html { redirect_to @schmo, notice: 'Schmo was successfully updated.' }
format.json { render :show, status: :ok, location: @schmo }
else
format.html { render :edit }
format.json { render json: @schmo.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def patch!\n request! :patch\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @socio_spc.update(socio_spc_params)\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @samochod.update(samochod_params)\n format.html { redirect_to @samochod, notice: 'Samochod was successfully updated.' }\n format.json { render :show, status: :ok, location: @samochod }\n else\n format.html { render :edit }\n format.json { render json: @samochod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @sf_sobject = Sfsync::Sobject.find(params[:id])\n \n respond_to do |format|\n if @sf_sobject.update_attributes(params[:sf_sobject])\n format.html { redirect_to @sf_sobject, notice: 'Sobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sf_sobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @schooladmin.update(schooladmin_params)\n format.html { redirect_to @schooladmin, notice: 'Schooladmin was successfully updated.' }\n format.json { render :show, status: :ok, location: @schooladmin }\n else\n format.html { render :edit }\n format.json { render json: @schooladmin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n if @shichoson.update_attributes(params[:shichoson])\n format.html { redirect_to @shichoson, notice: 'Shichoson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shichoson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @scando.update(scando_params)\n format.html { redirect_to @scando, notice: 'Scando was successfully updated.' }\n format.json { render :show, status: :ok, location: @scando }\n else\n format.html { render :edit }\n format.json { render json: @scando.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_claim = ShopClaim.find(params[:id])\n\n if @shop_claim.update(shop_claim_params)\n head :no_content\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @sms_based.update(sms_based_params)\n format.html { redirect_to @sms_based, notice: 'Sms based was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n if @scaff.update_attributes(params[:scaff])\n format.html { redirect_to @scaff, notice: 'Scaff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scomp.update(scomp_params)\n format.html { redirect_to @scomp, notice: 'Scomp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @scomp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @small_concert.update(small_concert_params)\n format.html { redirect_to '/admin/small_concerts', notice: 'Small concert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @small_concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spliff.update(spliff_params)\n format.html { redirect_to '/spliffs', notice: 'Spliff was successfully updated.' }\n format.json { redirect_to '/spliffs', status: :ok, location: '/spliffs' }\n else\n format.html { render :edit }\n format.json { render json: @spliff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @serial_chronology.update(serial_chronology_params)\n format.html { redirect_to :back, notice: 'Serial chronology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Serial chronology was NOT successfully updated.' }\n format.json { render json: @serial_chronology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slam = Slam.find(params[:id])\n \n respond_to do |format|\n if @slam.update_attributes(params[:slam])\n format.html { redirect_to @slam, notice: 'Fixed up!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @srsa = Srsa.find(params[:id])\n\n respond_to do |format|\n if @srsa.update_attributes(params[:srsa])\n format.html { redirect_to @srsa, notice: 'Srsa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @srsa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scool.update(scool_params)\n format.html { redirect_to @scool, notice: 'Scool was successfully updated.' }\n format.json { render :show, status: :ok, location: @scool }\n else\n format.html { render :edit }\n format.json { render json: @scool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scaff.update(scaff_params)\n format.html { redirect_to @scaff, notice: 'Scaff was successfully updated.' }\n format.json { render :show, status: :ok, location: @scaff }\n else\n format.html { render :edit }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sche_t.update(sche_t_params)\n format.html { redirect_to @sche_t, notice: 'Sche t was successfully updated.' }\n format.json { render :show, status: :ok, location: @sche_t }\n else\n format.html { render :edit }\n format.json { render json: @sche_t.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\r\n respond_to do |format|\r\n if @sivic_model.update(sivic_model_params)\r\n format.html { redirect_to @sivic_model, notice: 'Sivic model was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_model.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sacco.update(sacco_params)\n format.html { redirect_to @sacco, notice: 'Sacco was successfully updated.' }\n format.json { render :show, status: :ok, location: @sacco }\n else\n format.html { render :edit }\n format.json { render json: @sacco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_contcelula.update(sivic_contcelula_params)\r\n format.html { redirect_to @sivic_contcelula, notice: 'Sivic contcelula was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_contcelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n if @csosn.update_attributes(params[:csosn])\n format.html { redirect_to @csosn, notice: 'Csosn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sa_request.update(sa_request_params)\n format.html { redirect_to @sa_request, notice: 'Sa request was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request }\n else\n format.html { render :edit }\n format.json { render json: @sa_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @documentos_simposio.update(documentos_simposio_params)\n format.html { redirect_to @documentos_simposio, notice: 'Documentos simposio was successfully updated.' }\n format.json { render :show, status: :ok, location: @documentos_simposio }\n else\n format.html { render :edit }\n format.json { render json: @documentos_simposio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ressources = MaintenanceRessource.order(:service_id, :name);\n @maintenance.creator_id = current_user.utilisateur.id\n @maintenance.contact_id = @maintenance.creator_id if @maintenance.contact_id.nil?\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to maintenances_url, notice: \"Maintenance was successfully updated.\" }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_cpf.update(socio_cpf_params)\n format.html { redirect_to @socio_cpf, notice: 'Socio cpf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_cpf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n if @sin.update_attributes(params[:sin])\n format.html { redirect_to @sin, notice: 'Binge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n if @mostsmallmission.update_attributes(params[:mostsmallmission])\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n if @scrobble.update_attributes(params[:scrobble])\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n if @clasp.update_attributes(params[:clasp])\n format.html { redirect_to @clasp, notice: 'Clasp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clasp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shouldersbiceps1.update(shouldersbiceps1_params)\n format.html { redirect_to \"/shouldersbiceps1s\"}\n format.json { render :show, status: :ok, location: @shouldersbiceps1 }\n else\n format.html { render :edit }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n if @minicurso.update_attributes(params[:minicurso])\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @matrixspecy.update(matrixspecy_params)\n format.html { redirect_to @matrixspecy, notice: 'Matrixspecy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @matrixspecy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with []\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scheduled_chore.update(scheduled_chore_params)\n format.html { redirect_to @scheduled_chore, notice: 'Scheduled chore updated.' }\n format.json { render :show, status: :ok, location: @scheduled_chore }\n else\n format.html { render :edit }\n format.json { render json: @scheduled_chore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cello_master.update(cello_master_params)\n format.html { redirect_to @cello_master, notice: 'Cello master was successfully updated.' }\n format.json { render :show, status: :ok, location: @cello_master }\n else\n format.html { render :edit }\n format.json { render json: @cello_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n if @sabio.update_attributes(params[:sabio])\n format.html { redirect_to @sabio, notice: 'El Sabio fue actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sabio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n respond_to do |format|\n if @server.update_attributes(params[:server])\n @server.send_update\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @camp.update(camp_params)\n format.html { redirect_to @camp, notice: \"#{@camp.name} was revised in the system.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.jdson { render json: @camp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to customer_survey_path(@customer,@survey), notice: \"#{@survey.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sys_op = SysOp.find(params[:id])\n\n respond_to do |format|\n if @sys_op.update_attributes(params[:sys_op])\n format.html { redirect_to @sys_op, notice: 'Sys op was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sys_op.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @syohin.update(syohin_params)\n format.html { redirect_to @syohin, notice: 'Syohin was successfully updated.' }\n format.json { render :show, status: :ok, location: @syohin }\n else\n format.html { render :edit }\n format.json { render json: @syohin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cosmetic.update(cosmetic_params)\n format.html { redirect_to @cosmetic, notice: 'Cosmetic was successfully updated.' }\n format.json { render :show, status: :ok, location: @cosmetic }\n else\n format.html { render :edit }\n format.json { render json: @cosmetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end"
] |
[
"0.60670775",
"0.60602576",
"0.60271037",
"0.59614265",
"0.594393",
"0.59209156",
"0.5903024",
"0.5900323",
"0.58891106",
"0.5885256",
"0.588278",
"0.58802676",
"0.586252",
"0.5852165",
"0.58440155",
"0.5823932",
"0.582176",
"0.58198524",
"0.58171576",
"0.58167857",
"0.58106357",
"0.5799344",
"0.57979435",
"0.57953626",
"0.5787466",
"0.57852143",
"0.57798696",
"0.57715553",
"0.5770569",
"0.5770252",
"0.5760613",
"0.57567066",
"0.5745512",
"0.57446766",
"0.57402074",
"0.57306594",
"0.5719884",
"0.5709801",
"0.57080925",
"0.5706636",
"0.5705417",
"0.57013744",
"0.56987345",
"0.5694212",
"0.56938285",
"0.568864",
"0.56804544",
"0.5679152",
"0.5677178",
"0.5676738",
"0.5673007",
"0.56729823",
"0.56661594",
"0.56653756",
"0.5664794",
"0.5663074",
"0.5658397",
"0.5657171",
"0.5654216",
"0.5651466",
"0.564995",
"0.5645911",
"0.5639251",
"0.5636003",
"0.5622",
"0.5621792",
"0.5615363",
"0.5613464",
"0.5609308",
"0.5607985",
"0.56012046",
"0.5600528",
"0.5599188",
"0.55989313",
"0.55973816",
"0.5592845",
"0.55915856",
"0.55911106",
"0.55911106",
"0.55904704",
"0.5585177",
"0.55828923",
"0.55828136",
"0.55812144",
"0.5580183",
"0.55793643",
"0.55786633",
"0.55785644",
"0.55782765",
"0.55756456",
"0.55753076",
"0.5575292",
"0.55752826",
"0.55716634",
"0.55701685",
"0.55700296",
"0.55694383",
"0.5568337",
"0.5568337",
"0.55680656"
] |
0.62560153
|
0
|
DELETE /schmos/1 DELETE /schmos/1.json
|
def destroy
@schmo.destroy
respond_to do |format|
format.html { redirect_to schmos_url, notice: 'Schmo was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @msd.destroy\n respond_to do |format|\n format.html { redirect_to coas_url, notice: 'Msd was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @scam.destroy\n respond_to do |format|\n format.html { redirect_to scams_url, notice: 'Scam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @samochod.destroy\n respond_to do |format|\n format.html { redirect_to samochods_url, notice: 'Samochod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ss.destroy\n respond_to do |format|\n format.html { redirect_to sses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shichoson = Shichoson.find(params[:id])\n @shichoson.destroy\n\n respond_to do |format|\n format.html { redirect_to shichosons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @csh.destroy\n respond_to do |format|\n format.html { redirect_to cshes_url, notice: 'Csh was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @schooladmin.destroy\n respond_to do |format|\n format.html { redirect_to schooladmins_url, notice: 'Schooladmin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adminmatrixgenu.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixgenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scando.destroy\n respond_to do |format|\n format.html { redirect_to scandos_url, notice: 'Scando was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sche_t.destroy\n respond_to do |format|\n format.html { redirect_to sche_ts_url, notice: 'Sche t was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sacco.destroy\n respond_to do |format|\n format.html { redirect_to saccos_url, notice: 'Sacco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scheduled_chore.destroy\n respond_to do |format|\n format.html { redirect_to scheduled_chores_url, notice: 'Scheduled chore deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shouldersbiceps1.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps1s_url, notice: 'Shouldersbiceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slam = Slam.find(params[:id])\n @slam.destroy\n\n respond_to do |format|\n format.html { redirect_to slams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sch = Sche.find(params[:id])\n @sch.destroy\n\n redirect_to sches_path\n end",
"def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scaff = Scaff.find(params[:id])\n @scaff.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_scaff.destroy\n respond_to do |format|\n format.html { redirect_to test_scaffs_url, notice: 'Test scaff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scaff.destroy\n respond_to do |format|\n format.html { redirect_to scaffs_url, notice: 'Scaff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secco.destroy\n respond_to do |format|\n format.html { redirect_to curso_seccos_url, notice: 'Secco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @smsno.destroy\n respond_to do |format|\n format.html { redirect_to smsnos_url, notice: 'Smsno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @smurf = Smurf.find(params[:id])\n @smurf.destroy\n\n respond_to do |format|\n format.html { redirect_to smurves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @csosn = Csosn.find(params[:id])\n @csosn.destroy\n\n respond_to do |format|\n format.html { redirect_to csosns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitemenu.destroy\n respond_to do |format|\n format.html { redirect_to sitemenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_spc.destroy\n respond_to do |format|\n format.html { redirect_to socio_spcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @suc = Suc.find(params[:id])\n @suc.destroy\n\n respond_to do |format|\n format.html { redirect_to sucs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cm = Cm.find(params[:id])\n @cm.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spice.destroy\n\n head :no_content\n end",
"def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @shouldersbicepshome3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbicepshome3s_url, notice: 'Shouldersbicepshome3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sa = Sa.find(params[:id])\n @sa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sinnoh.destroy\n respond_to do |format|\n format.html { redirect_to sinnohs_url, notice: 'Sinnoh was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @microposst = Microposst.find(params[:id])\n @microposst.destroy\n\n respond_to do |format|\n format.html { redirect_to micropossts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @method_sdm.destroy\n respond_to do |format|\n format.html { redirect_to method_sdms_url, notice: 'Method sdm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @simple_chore.destroy\n respond_to do |format|\n format.html { redirect_to simple_chores_url, notice: 'Simple chore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @smallsurvey.destroy\n respond_to do |format|\n format.html { redirect_to smallsurveys_url, notice: 'Smallsurvey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @client.delete( name )\n end",
"def destroy\n @schicht.destroy\n respond_to do |format|\n format.html { redirect_to schichts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @suscription.destroy\n respond_to do |format|\n format.html { redirect_to suscriptions_url, notice: 'Suscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to(csos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shcedule.destroy\n respond_to do |format|\n format.html { redirect_to shcedules_url, notice: 'Shcedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @documentos_simposio.destroy\n #respond_to do |format|\n # format.html { redirect_to documentos_simposios_url, notice: 'Documentos simposio was successfully destroyed.' }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @shunfengch = Shunfengche.find(params[:id])\n @shunfengch.destroy\n\n respond_to do |format|\n format.html { redirect_to shunfengches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystock.destroy\n respond_to do |format|\n format.html { redirect_to mystocks_path, notice: 'mystock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sms_retrieval.destroy\n respond_to do |format|\n format.html { redirect_to sms_retrievals_url, notice: 'Sms retrieval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_sanatorium = Ref::Sanatorium.find(params[:id])\n @ref_sanatorium.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_sanatoria_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'El plato se ha eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sour = @swit.sours.find(params[:id])\n @sour.destroy\n respond_to do |format|\n format.html { redirect_to swit_sours_path(@swit) }\n format.json { head :no_content }\n\n end\n end",
"def destroy\n @shmarticle.destroy\n respond_to do |format|\n format.html { redirect_to shmarticles_url, notice: 'Shmarticle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend"
] |
[
"0.6819303",
"0.68119663",
"0.6769391",
"0.6734435",
"0.67130286",
"0.66772836",
"0.66752416",
"0.6663666",
"0.66578764",
"0.6643312",
"0.66416097",
"0.6622077",
"0.6617451",
"0.6602217",
"0.6601949",
"0.659684",
"0.6590565",
"0.65671605",
"0.65500444",
"0.6539571",
"0.6537613",
"0.6531176",
"0.6531001",
"0.65286857",
"0.6527827",
"0.6517963",
"0.65146774",
"0.6509794",
"0.65042317",
"0.64939296",
"0.64850813",
"0.64663",
"0.6462014",
"0.6460058",
"0.6455232",
"0.6452037",
"0.6451663",
"0.64509314",
"0.6450479",
"0.644238",
"0.64415866",
"0.64347064",
"0.6432609",
"0.64229757",
"0.64229494",
"0.6422541",
"0.6413839",
"0.64085436",
"0.6404188",
"0.64019054",
"0.64000016",
"0.63944745",
"0.6388732",
"0.63845235",
"0.6382608",
"0.63708025",
"0.6369751",
"0.63690895",
"0.6366333",
"0.6364952",
"0.6364821",
"0.6363286",
"0.6362061",
"0.63580215",
"0.63528246",
"0.6342124",
"0.6341827",
"0.63408655",
"0.6337469",
"0.6337414",
"0.63292634",
"0.63286036",
"0.6327335",
"0.6324641",
"0.63214505",
"0.6312155",
"0.63118106",
"0.63116115",
"0.6308918",
"0.63084966",
"0.63076127",
"0.6306531",
"0.6305579",
"0.6305537",
"0.630439",
"0.6303472",
"0.63032264",
"0.63015616",
"0.630006",
"0.6297361",
"0.62965465",
"0.6295248",
"0.62927586",
"0.6292262",
"0.6290271",
"0.62879646",
"0.6285434",
"0.6281953",
"0.627694",
"0.6274283"
] |
0.71664554
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_schmo
@schmo = Schmo.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def schmo_params
params.require(:schmo).permit(:name, :address, :ph, :email, :balance)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Area of the rectangle
|
def calculateArea
return @length * @breadth
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def area; rect size; end",
"def area_of_rect(l, w)\n return l * w\nend",
"def area_of_rectangle(width, length)\n width*length\nend",
"def getArea()\n getWidth() * getHeight()\n end",
"def getArea\n getWidth() * getHeight\n end",
"def rectangle_area(width, height)\n area = width * height\nend",
"def getArea\n getWidth() * getHeight\n end",
"def getArea\n getWidth() * getHeight\n end",
"def rectangleArea(h, w)\r\n h * w\r\nend",
"def getArea\n getWidth() * getHeight\n end",
"def getArea\n\t\tgetWidth() * getHeight\n\tend",
"def getArea\n\t\tgetWidth() * getHeight\n\tend",
"def rectangleArea(l, w)\n\t#Calculate the area\n\tl * w\nend",
"def getArea\n @width * @height * @length\n end",
"def area\n width() * height\n end",
"def area\n \t@width * @height\n end",
"def rectangleArea(width, height)\n # return width * height\n width * height\n # set end of rectangleArea function\nend",
"def area\n return @side_length * @side_length\n end",
"def area\n result = @length * @breadth\n puts\n puts \"area of square of length 4 should be 16 ✔\"\n puts \"area of rectangle with #{@length}, #{@breadth} should be #{result} ✔\"\n\n end",
"def get_area()\n @space.get_area()\n end",
"def area\n\n return @side_len * @side_len\n\n\n end",
"def area\n\t\t@side_length * @side_length\n\tend",
"def area(length, width)\n length * width\nend",
"def area\r\n return ( Math::PI * @radius * @radius).abs\r\n end",
"def area\n w * h\n end",
"def recArea(w, h) \n w * h \nend",
"def area\n\t\tMath::PI * (self.radius ^ 2)\n\tend",
"def area\n ( @width*@top) * ( 1.0 - ( ( 1.0 - @alpha.value) ** 2))\n end",
"def total_area\n\t\tarea = 0\n\t\tshapes.each do |shape|\n\t\t\tarea = area + shape.area\n\t\tend\n\t\treturn area\n\tend",
"def coordinate_area\n (@x_max.to_f - @x_min.to_f) * (@y_max.to_f - @y_min.to_f)\n end",
"def area\n\t\treturn @PI * @radius ** 2\n\tend",
"def area(length, width)\n length * width # Implicit return\nend",
"def printArea\n @area = getWidth() * getHeight\n puts \"Big box area is : #@area\"\n end",
"def area\n x, y, z = sides.sort\n (\n 0.25 * Math.sqrt((x + (y + c)) * (z - (x - y)) * (z + (x - y)) * (x + (y - z)))\n ).to_f.round(precision)\n end",
"def get_area()\n unless check_keyword?(\"HEIGHT\") and check_keyword?(\"WIDTH\")\n raise \"Error: In the command #{@utype}:#{@command_name} the area could not be evaluated. Either the HEIGHT or WIDTH is invalid.\\n #{output}\"\n end\n return get_keyword_value(\"WIDTH\").to_f * get_keyword_value(\"HEIGHT\").to_f\n end",
"def area\n return @area if defined?(@area)\n\n sum = 0.0\n (0...vertices.length).each do |i|\n prev = vertices[i - 1]\n curr = vertices[i]\n\n sum += ((prev.x * curr.y) - (prev.y * curr.x))\n end\n\n @area = sum / 2\n @area\n end",
"def printArea\n @area = getWidth() * getHeight\n puts \"Big box area is : #@area\"\n end",
"def printArea\n @area = getWidth() * getHeight\n puts \"Big box area is : #@area\"\n end",
"def printArea\n @area = getWidth() * getHeight\n puts \"Big box area is : #@area\"\n end",
"def printArea\n\t\t@area = getWidth() * getHeight\n\t\tputs \"Big box area is : #@area\"\n\tend",
"def area(length, width)\n a = length * width\n return a\nend",
"def printArea\n @area = getWidth() * getHeight\n puts \"Big boxie area is: #{@area}\"\n end",
"def area\r\n return (( (@p1.x*(@p2.y - @p3.y)) + (@p2.x*(@p3.y - @p1.y)) + (@p3.x*(@p1.y - @p2.y)) )/2.0).abs\r\n end",
"def get_area()\n OpenStudio::getArea(self.get_3d_polygon())\n end",
"def calc_area (base1,base2,height)\r\n\tarea = height * (base1 + base2) / 2.0\r\n\treturn area\r\nend",
"def area\n (@p1.x * @p2.y + @p2.x * @p3.y + @p3.x * @p1.y - @p1.y * @p2.x - @p2.y * @p3.x - @p3.y * @p1.x).abs / 2.0\n end",
"def find_area height, width\n\n\theight * width\nend",
"def height; rect.height; end",
"def find_area(height, width)\n height * width\nend",
"def overlap_area(rect)\n if !overlap?(rect)\n return 0\n end\n\n x_overlap = ([rect.x2,@x2].min) - ([rect.x1, @x1].max)\n y_overlap = ([rect.y2,@y2].min) - ([rect.y1, @y1].max)\n overlap = x_overlap * y_overlap\n end",
"def calc_area(len, wid)\n\tarea = len * wid\n\treturn area\nend",
"def printArea\n\t\t @area = getWidth() * getHeight\n\t\t puts \"Big box area is: #{@area}\"\n\t end",
"def find_area height, width\n\theight * width\nend",
"def getArea\n\n return \"Area from parent class is #{@width*@height}\"\n\n end",
"def width; rect.width; end",
"def area\r\n is_open ? width * length_opened : width * length\r\n end",
"def get_area\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n \n if height == nil || width == nil\n raise \"Error: In the command #{@utype}:#{@command_name} the area could not be evaluated. Either the HEIGHT or WIDTH is invalid.\\n #{output}\"\n end\n \n height = height.to_f\n width = width.to_f\n \n return height * width\n end",
"def area\n is_open ? width * length_opened : width * length\n end",
"def find_area\n\t\t@area = 0.5 * ((@point1.x - @point3.x)*(@point2.y - @point1.y) - (@point1.x - @point2.x)*(@point3.y - @point1.y)).abs\n\tend",
"def print_area\n @area = width() * height\n puts \"Big box area is: #@area\"\n end",
"def calculate_area\n\n \tarea = 3.14*@radius*@radius\n\n end",
"def find_area height, width\n area = height * width\n p area\nend",
"def RectangleArea(strArr)\n pool = strArr.join.scan(/(-?[0-9]+)/).flatten.map{|i|i.to_i}\n\n rec_l = [pool[1], pool[3], pool[5], pool[7]].sort\n rec_w = [pool[0], pool[2], pool[4], pool[6]].sort\n\n length = (rec_l[-1] - rec_l[0]).abs\n width = (rec_w[-1] - rec_w[0]).abs\n\n length * width\nend",
"def find_area height, width \n area= height * width \n puts area \nend",
"def inArea?(x,y,width,height)\n rect=Rect.new(x,y,width,height)\n return self.over?(rect)\n end",
"def calculate_area\n puts \"Area depends of figure, but we can calculate through triangles\"\n end",
"def getArea(ringNumber)\n\t((ringNumber-1)*2+1)**2\nend",
"def size(rect)\n return rect.width\n end",
"def area()\n segments.map { |seg| seg.area(start_point) }.reduce(:+)\n end",
"def getArea\r\n\t\treturn \"Area from Parent class is #{@width * @height}\"\r\n\tend",
"def size(rect)\n return rect.height\n end",
"def rectangle_area(str_arr)\n str_arr = str_arr.sort.map do |co_ord|\n co_ord.delete('()').split.map(&:to_i)\n end\n width = str_arr[2][0] - str_arr[0][0]\n height = str_arr[1][1] - str_arr[0][1]\n width * height\nend",
"def get_area\n return Engine::Area.new(calculate_top_point_internal, @area_width, @area_height)\n end",
"def width\r\n return self.rect.width\r\n end",
"def _getDrawingArea()\n drawingArea = Rect.new_with_nsrect(self.bounds())\n if drawingArea\n drawingArea.Deflate(@border, @border)\n# NSLog(\"drawingArea = #{drawingArea}\")\n end\n return drawingArea\n end",
"def rectangle(length:, width:)\n # now does squares!!!!\n (length.to_f * width.to_f).round(2)\n end",
"def get_area\n\t\tarea = @radius * 2 * @pi\n\t\tputs \"The area of the circle is #{area}\"\n\tend",
"def get_area\n\n # get the keyword value of shape\n shape = get_keyword_value(\"SHAPE\")\n\n # if the shape value is nil, or it is defined as \"NO-SHAPE\", the get_area value\n # would be defined, and would represent the get_area of the space\n if ( shape == nil || shape == \"NO-SHAPE\")\n area = get_keyword_value(\"AREA\")\n area = area.to_f\n return area\n\n # if the shape value is \"BOX\", the height and width key values are given,\n # and the get_area would be defined as their product\n elsif ( shape == \"BOX\" )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n\n # if the shape value is defined as a polygon , the get_area of the polygon would\n # represent the get_area of the space\n elsif ( shape == \"POLYGON\")\n return @polygon.get_area\n else\n raise \"Error: The area could not be evaluated. Please check inputs\\n \"\n\n end\n end",
"def circle_area(circle)\n circle.radius**2*Math::PI\nend",
"def get_area()\n # Finds the floor and space parents and assigns them to @floor and @space \n # variables to be used later\n begin\n floor = get_floor()\n space = get_space()\n # Get the keyword value for location\n location = get_keyword_value(\"LOCATION\")\n # Get the keyword value for polygon\n polygon_id = get_keyword_value(\"POLYGON\")\n rescue\n end\n \n \n # if the polygon_id keyword value was nil and the location value was nil, then \n # the height and width are directly defined within the \"exteriorWall\" command\n \n if ( location == \"BOTTOM\" || location == \"TOP\") && (space.get_shape != \"BOX\")\n return space.polygon.get_area \n \n elsif ( location == nil && polygon_id == nil )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n #puts \"Direct:\" + height + \" times \" + width\n height = height.to_f\n width = width.to_f\n \n return height * width\n elsif ( location == nil && polygon_id != nil)\n return space.polygon.get_area\n \n \n # if the location was defined as \"SPACE...\", it is immediately followed by a\n # vertex, upon which lies the width of the exteriorwall\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = space.polygon.get_length(location)\n if space.check_keyword?(\"HEIGHT\")\n height = space.get_height\n else\n height = floor.get_space_height\n end\n #puts floor.utype\n #puts \"Space:\" + height.to_s + \" times \" + width.to_s\n return width * height\n # if the shape was a box, the width and height would be taken from the\n # \"SPACE\" object\n elsif ( space.get_shape == \"BOX\" ) \n width = space.get_width\n height = space.get_height\n return width * height\n \n \n else\n raise \"The area could not be evaluated\"\n end\n end",
"def getPerimeter\n\t\t@length + @width + @height\n\tend",
"def getPerimeter\n\t\t@length + @width + @height\n\tend",
"def outer_height; rect.height + @border_thickness * 2; end",
"def area_of_triangle(base, height)\n (base * height) / 2\nend",
"def area_of_square(length)\n length*length\nend",
"def rect; end",
"def rect; end",
"def circle_area(radius)\n 3.14 * radius ** 2\nend",
"def height\n return self.rect.height\n end",
"def width\n return self.rect.width\n end",
"def outer_width; rect.width + @border_thickness * 2; end",
"def area(arr)\n \n x_values = []\n y_values = []\n arr.each do |xy|\n x_values << xy.first\n y_values << xy.last\n end\n \n xmin = x_values.min\n xmax = x_values.max\n \n ymin = y_values.min\n ymax = y_values.max\n \n area = (ymax - ymin) * (xmax - xmin)\n \n area\nend",
"def area(x=$game_player.x, y=$game_player.y)\n new_area = @areas.reverse.detect {|area| x >= area.x && y >= area.y }\n @area = new_area if @area != new_area\n @area\n end",
"def area()\n return Math::PI*(vRadio**2)\n end",
"def area radius \n puts radius * 2 * PI\n end",
"def printArea #----> this is protected class\n @area=getheight * getwidth\n puts \"the area of inside is :#@area\"\n end",
"def room_area(length, width)\n puts \"The area of the room in meters is: #{length * width}\"\n puts \"The area of the toom in square feet is: #{(length * width) * 10.7639}\"\nend",
"def area(box)\n nw_lon = box[0][0]\n nw_lat = box[0][1]\n se_lon = box[1][0]\n se_lat = box[1][1]\n y = abs(nw_lat - se_lat)\n x = abs(nw_lon - se_lon)\n x = x < 180 ? x : 360-x\n return x*y\n end",
"def getTriangleArea(x, y)\n # Write your code here\n base=x.max-x.min\n height=y.max-y.min\n\n (base*height)/2\nend",
"def area\n image_new(face_width, face_height)\n end"
] |
[
"0.8737281",
"0.85755885",
"0.85345465",
"0.8389151",
"0.8362794",
"0.8357164",
"0.8352748",
"0.8352748",
"0.8333851",
"0.83041334",
"0.82851213",
"0.8284972",
"0.827472",
"0.81114954",
"0.7995751",
"0.7797921",
"0.77665716",
"0.7748925",
"0.7668848",
"0.76174223",
"0.76136696",
"0.75976574",
"0.75491637",
"0.7505898",
"0.74939686",
"0.748194",
"0.748154",
"0.7476577",
"0.74449354",
"0.73606205",
"0.73492455",
"0.7327968",
"0.7324438",
"0.7320637",
"0.7307364",
"0.7273728",
"0.7260596",
"0.7260596",
"0.7260596",
"0.724999",
"0.7235185",
"0.7223454",
"0.72069025",
"0.7205777",
"0.7198698",
"0.71930444",
"0.7176858",
"0.71564156",
"0.71474916",
"0.7125323",
"0.71088445",
"0.7088412",
"0.70843476",
"0.7078316",
"0.70760113",
"0.70606196",
"0.7042845",
"0.70324105",
"0.70235336",
"0.70136523",
"0.69803244",
"0.69251764",
"0.691234",
"0.6888585",
"0.68837065",
"0.6873611",
"0.6854526",
"0.6851268",
"0.6843473",
"0.68319947",
"0.6831475",
"0.6814026",
"0.6788073",
"0.67721045",
"0.67585987",
"0.6723035",
"0.67190194",
"0.67138076",
"0.6710823",
"0.6691038",
"0.6688018",
"0.6688018",
"0.66863763",
"0.6669152",
"0.66665155",
"0.6665037",
"0.6665037",
"0.66581035",
"0.665245",
"0.66518855",
"0.66132003",
"0.65903294",
"0.6588846",
"0.6586534",
"0.6557931",
"0.65440273",
"0.6543205",
"0.65335876",
"0.6533084",
"0.6529309"
] |
0.7032526
|
57
|
write chain index to file. The file is a binary file, and payload of +block_list+ and +newest_block+ are stored.
|
def write_to_file
File.open(config.block_list_path, 'a') do |f|
block_count = old_newest_block ? (block_list.size - old_newest_block.height - 1) : block_list.size
block_list = self.block_list.sort{|(k1, v1), (k2, v2)| v1.height <=> v2.height}
block_list = block_list[(old_newest_block.height + 1)..-1] if old_newest_block
block_list.each_with_index do |(k, b), index|
f.write(b.to_payload)
f.flush
print "\r#{(((index + 1).to_f / block_count) * 100).to_i}% done write parsed block to #{config.block_list_path}."
end
f.write(newest_block.to_payload)
puts
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write_block(type,index,payload)\n return Logfiles.write_block(wio,type,index,payload)\n end",
"def save\n File.open(@index_file, 'wb') do |f|\n f.puts Marshal::dump([@terms, @index])\n end\n end",
"def save\n File.open(@index_file, 'wb') do |f|\n Marshal.dump([@terms, @index], f)\n end\n end",
"def write_blocks(nonce, start_block, block_count, data)\n # TODO: transactional integrity\n \n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_update_path start_block + i\n load_data[:ops] <<\n { :op => :update, :path => load_data[:path], :nonce => nonce,\n :data => data[i * block_size, block_size],\n :block => start_block + i, :session_id => @sid }\n add_tree_data_to_ops load_data[:ops]\n response = @fpga.perform_ops load_data[:ops]\n @tree_driver.perform_ops load_data[:ops]\n response.first\n end\n @disk.write_blocks start_block + @data_start, block_count, data\n { :hmacs => hmacs }\n end",
"def writeBlock(pieceIndex, offset, block)\n regions = @pieceMapper.findBlock(pieceIndex, offset, block.length)\n indexInBlock = 0\n regions.each do |region|\n # Get the IO for the file with path 'path'. If we are being used in a reactor, this is the IO facade. If we\n # are not then this is a real IO.\n io = @ioManager.get(region.path)\n if ! io\n # No IO for this file. \n raise \"This process doesn't have write permission for the file #{region.path}\" if File.exists?(region.path) && ! File.writable?(region.path)\n\n # Ensure parent directories exist.\n dir = File.dirname region.path\n FileUtils.mkdir_p dir if ! File.directory?(dir)\n\n begin\n io = @ioManager.open(region.path)\n rescue\n @logger.error \"Opening file #{region.path} failed: #{$!}\"\n raise \"Opening file #{region.path} failed\"\n end\n end\n\n io.seek region.offset, IO::SEEK_SET\n begin\n io.write(block[indexInBlock, region.length])\n indexInBlock += region.length\n rescue\n # Error when writing...\n @logger.error \"Writing block to file #{region.path} failed: #{$!}\"\n piece = nil\n break\n end\n\n break if indexInBlock >= block.length\n end\n end",
"def save_index\n @index.compute_digest(@data_file)\n @index.to_disk(@index_file)\n end",
"def to_file( f )\n size = 0\n @indexes.each { size += Index::FORMAT_SIZE }\n @idata.each do |i| \n size += IntData::FORMAT_SIZE\n size += i.data_size\n end\n\n buf = [@source, @name, @sym, @indexes.length(), @idata.length(), \n size].pack(PFORMAT)\n f.write(buf)\n @indexes.each { |i| i.to_file(f) }\n @idata.each { |i| i.to_file(f) }\n end",
"def construct_index\n @logger.fine('Constructing index...')\n File.open(@index_path, 'wb') do |f|\n write_int(@data_timestamp, f) # The timestamp value - used to determine if an index is valid.\n write_int(0, f) # The first row - always at offset 0.\n @data.each_line { write_int(@data.pos, f) } # The rest of the rows.\n end\n end",
"def save_level\n File.open(@file_name, 'w') do |file|\n @blocks_array.each do |block|\n new_block = Block.new block.relative_position\n puts new_block.to_s\n end\n end\n end",
"def write(block)\n @filemgr.write(block, @contents)\n end",
"def writeBlock(pieceIndex, offset, block)\n id = returnAndIncrRequestId\n return id if @state == :after_stop\n @requests.push [id, :write_block, pieceIndex, offset, block]\n @requestsSemaphore.signal\n id\n end",
"def write_dataBlock_to_file(miliseconds)\n\t\t# calculate the number of dataBlocks to write to file\n\t\tnumBlocks_to_write = (miliseconds.to_f * @sampleRate.to_f /\n\t\t @samples_per_dataBlock.to_f) / 1000.to_f\n\t\t# calculate bytes per sample\n\t\tif @bitsPerSample == 16\n\t\t\tbytesPerSample = 2\n\t\telsif @bitsPerSample == 32\n\t\t\tbytesPerSample = 4\n\t\tend\n\t\t# write the dataBlocks to file\n\t\tfor i in (0..numBlocks_to_write.round)\n\t\t\t# write binary to file with correct offset\n\t\t\tFile.write(@filename, @dataBlock_joined, @file_offset)\n\t\t\t# increment offset for next method call\n\t\t\t@file_offset += @samples_per_dataBlock * @numChannels * bytesPerSample\n\t\tend\n\tend",
"def export_blockchain(my_port)\r\n puts \"Exporting Blockchain...\".blue\r\n $status = \"Exporting Blockchain...\"\r\n file = File.new(\"#{my_port}_blockchain.txt\", \"w\")\r\n $blockchain.length.times do |i|\r\n file.puts \"From: #{$blockchain[i].payer}\"\r\n file.puts \"To: #{$blockchain[i].payee}\"\r\n file.puts \"Amount: #{$blockchain[i].amount}\"\r\n file.puts \"Mined By: #{$blockchain[i].miner}\"\r\n file.puts \"Previous Block Hash: #{$blockchain[i].prev_hash}\"\r\n file.puts \"Block Hash: #{$blockchain[i].hash}\"\r\n file.puts \"Nonce: #{$blockchain[i].nonce}\"\r\n file.puts \"------------------------------------------------------------------------------------------------------------------------\"\r\n end\r\n file.close\r\n puts \"Exported Blockchain\".blue\r\n $status = \"Exported Blockchain\"\r\nend",
"def new_chunk(index)\n chunk_num = (index / CHUNK_LINE_SIZE).to_i\n write_file = File.new(\"data/chunk#{chunk_num}\", \"w\")\n\n return write_file\nend",
"def write\n begin\n buf = [ @flags, @length, @id, @crc].pack(FORMAT)\n crc = Zlib.crc32(buf, 0)\n @file.seek(@addr)\n @file.write(buf + [ crc ].pack('L'))\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write blob header into flat file DB: \" +\n e.message\n end\n end",
"def write_list_index(list_index)\n file = File.open(\"jira-epic-progress.json\",\"w\")\n index = {\"index\" => (list_index + 1)}\n file.write(index.to_json)\nend",
"def save_index\r\n # if validate_markdown_repo\r\n\r\n # Write full list to json file\r\n open(INDEX_PATH, 'w') do |f|\r\n f.puts JSON.pretty_generate @index\r\n end\r\n\r\n commit_markdown_repo(@today, ar_add=nil, message='index ')\r\n # end\r\n end",
"def export\n return if fragments.count.zero?\n File.open(\"#{bin_file_name}.new\", \"wb\") do |f|\n i = 0;\n fragments.order(:order).each do |fr|\n i = export_object f, fr, i\n end\n end\n end",
"def saveIndex(fileName = \"dataTest.dat\", data)\n\t\tfile = File.new(fileName, \"w+\")\n\t\tserializedData = Marshal.dump(data)\n\t\tfile.write(serializedData)\n\t\tfile.close\n\tend",
"def commit(newrevision, content_io=nil)\n if not get_indexfile_with_revision(newrevision).nil?\n raise \"Committing already-existing revision: #{newrevision} for #{@fname}\"\n end\n if content_io.nil?\n compress_file_lines = Deflate.deflate(File.read(@fname))\n else\n cont = content_io.read\n compress_file_lines = Deflate.deflate(cont)\n end\n\n # append current file fname to datafile\n length = IO.readlines(@datafile).size\n\n File.open(@datafile, \"a\") do |append|\n append.puts compress_file_lines\n end\n length = IO.readlines(@datafile).size - length\n\n # new version is the old version plus 1\n # new offset is the last length + last offset\n parse_last_line = parse_indexfile_line get_indexfile_with_line(-1)\n new_offset = parse_last_line[1] + parse_last_line[2]\n\n File.open(@indexfile, \"a\") do |f|\n index_write_row(f, newrevision.to_s,\n new_offset.to_s, length.to_s)\n end\n end",
"def initialize(file, method = METHOD_BZ2, idx_size = 4, blocksize = 900000)\n @compressor = Compressor.new(method)\n @blocksize = blocksize\n @file = File.open(file, \"w\")\n @index = [] \n @cur_block, @buflocation, @size = 0, 0, 0\n @buffer = ''\n @location = 12 # (to hold start of index)\n @block_ary = [] \n @hardlinks = {}\n @idx_size = idx_size\n end",
"def write_indexes\n S3Object.store(File.join(basedir, 'index'), Marshal.dump(index), bucket_name)\n end",
"def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end",
"def flush\n flush_block unless @buffer.empty? \n process_hardlinks\n\n # writing the location of the archive (it's after the dump data)\n writeloc(@file, [@location].pack('V'), 0) \n\n indexloc = @location\n location = (sha1subset('FFFFFFFFFF', @idx_size) * 8) + indexloc\n # p = File.open(\"zlog\", \"w\")\n each_entry_with_index do |entry, idx|\n next if entry.nil? \n\n writeloc(@file, [location, entry.size].pack('V2'), (idx * 8) + indexloc)\n writeloc(@file, entry, location)\n\n # p << \"*\" * 80 << \"\\n\" \n # p << \"seek #{(idx * 8) + indexloc} location #{location} size #{entry.size}\" << \"\\n\"\n # p << unpack(entry).join(\":\") << \"\\n\"\n\n location += entry.size\n end\n\n # meta location\n writeloc(@file, [location, @compressor.method, @idx_size].pack('VCC'), 4)\n\n writeloc(@file, Marshal.dump(@meta), @location) if defined?(@meta)\n\n @file.close\n end",
"def write\n if File.exist?(@dir)\n FileWriter.write File.join(@dir, 'index.html'), @index\n end\n end",
"def rewrite_block(block)\n @header_chain.head = block.header\n @header_chain.write_header_hash_number(block.get_hash, block.number)\n end",
"def write_tail(f, pos)\n f.seek(0)\n f.write([pos].pack('N'))\n pos\n end",
"def save_search_index(index)\n require 'json'\n @updated_search_index = index\n search_index_path.open('w') do |io|\n io.write(@updated_search_index.to_json)\n end\n end",
"def write object, index\n raise NotImplementedError\n end",
"def flush_block\n bf_compr = @compressor.compress(@buffer)\n writeloc(@file, bf_compr, @location)\n @block_ary[@cur_block] = @@block.new(@cur_block, @location, bf_compr.size)\n\n @buffer = '' \n @buflocation = 0\n @cur_block += 1 \n @location += bf_compr.size\n end",
"def save\n File.write @path, @index.to_yaml, encoding: \"UTF-8\"\n end",
"def add_to_index_files(idx, name)\n year = NvdFileSystem::year_from_name(name)\n\n path=\"#{@nvdfs.root_path}/index\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{year}\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{idx}\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{name}\"\n\n begin\n File.open(path,\"wb\") {|f| f.write(\"\") }\n rescue Exception => ex\n str=\"unable to create index file #{path}\"\n puts str\n end\n\n end",
"def write(file)\n value.each do |item|\n # always write int4 in network order (as per GDSII spec)\n file.write [item].pack('N')\n end\n end",
"def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end",
"def save\n ole = File.open(@file_name, 'w')\n ole << header\n ole << fat\n @storages.each { |s| ole << s.to_s }\n ole << Array.new((512-(ole.pos % 512)), 0).pack('c*')\n ole << mini_fat\n ole << mini_fat_stream\n ole << fat_stream\n ole.close\n end",
"def write_index\n html = HtmlHelpers.build do |b|\n content = b.jumbotron(b.title(@config[:index_title], 'title'))\n content += b.title(RESOURCES_TEXT)\n content += b.unordered_list(resources.keys)\n content += b.link(\"#{ERROR_CODE_URL}.html\", b.subtitle(ERROR_CODE_TEXT)) unless error_codes.empty?\n container = b.container(b.row(content))\n b.html_header(header_title, container, @config[:inline_css])\n end\n write_to_file(\"#{output_dir}/index.html\", html)\n end",
"def write(&block)\n @write_block = block\n end",
"def write_entry(index_file, entry, journal, data)\n curr = self.size - 1\n \n node_map[entry.last] = curr\n \n link = entry.link_rev\n data_file = index_file[0..-3] + \".d\"\n \n entry = pack_entry entry, link\n \n data_file_handle = open(data_file, \"a\")\n index_file_handle = open(index_file, \"a+\")\n \n journal << {:file => data_file, :offset => offset}\n journal << {:file => index_file, :offset => curr * entry.size}\n \n data_file_handle.write data[:compression] if data[:compression].any?\n data_file_handle.write data[:text]\n \n data_file_handle.flush\n index_file_handle.write entry\n end",
"def save_block_on_main_branch(block, height, prev_work = 0)\n @block_index.insert_block(block, height, prev_work)\n !!Toshi::Models::Block.create_from_block(block, height, Toshi::Models::Block::MAIN_BRANCH, @output_cache, prev_work)\n @output_cache.flush\n end",
"def append_or_replace(block_name, src)\n if (block_name < 0 || block_name > name_max)\n raise ArgumentError,\"write to nonexistent block #{block_name}; only #{name_max} in file\"\n end\n\n if block_name == name_max\n write_hdr(HDR_MAXINDEX_, block_name+1)\n end\n\n write(block_name, src)\n end",
"def write_block(session_id, block_id, data, nonce)\n _check_block_id block_id\n session_cache_entry = @allocator.session_cache_entry session_id\n @storage.write_block block_id, data\n data_hash = @p.hash_engine.hash_block data\n @hash_tree_controller.sign_write_block block_id, data_hash, session_cache_entry, nonce\n end",
"def write\n file = ::File.open(@file, 'w')\n file.write(Bencode.encode(@data))\n file.close\n end",
"def append(transaction)\n File.open(append_file, 'a+') do |f|\n if f.pos == 0\n last_char = \"\\n\"\n else\n f.pos = f.pos - 1\n last_char = f.getc\n end\n\n f.write \"\\n\"\n f.write(transaction.to_ledger)\n end\n end",
"def write_obj_file output_path\n File.open(output_path, 'w') do |f|\n @vbuffer.each_triple do |a,b,c|\n f.puts \"v #{a} #{b} #{c}\"\n end\n @vnbuffer.each_triple do |a,b,c|\n f.puts \"vn #{a} #{b} #{c}\"\n end\n @fbuffer.each_triple do |a,b,c|\n f.puts \"f #{a+1}//#{a+1} #{b+1}//#{b+1} #{c+1}//#{c+1}\"\n end\n end\n self\n end",
"def write(file)\n @file_written = file\n file = Pathname.new(file)\n file.dirname.mkpath\n file.open \"w+\" do |output|\n output << self.build!\n end\n self\n end",
"def write\n File.open(path, 'w') { |file|\n file.write(FILE_HEADER + \"\\n\")\n file.write(encoded_body)\n }\n end",
"def write_item item_code, index\n write_raw_value item_code, index*16\n end",
"def to_file( f )\n buf = [ MAGIC, VERSION, @timestamp.to_i, @analyses.length() \n ].pack(PFORMAT)\n f.write(buf)\n\n @analyses.each do |a|\n a.to_file(f)\n end\n end",
"def write_file(log)\n log[:files_revised] += 1\n File.open(@name, \"w\") {|f| f.write(@content) }\n end",
"def write\n\t\tfile = File.new(@lock_file, \"w\")\n\t\tyield(file)\n\t\tfile.close\n\tend",
"def output(file, &block)\n @outfile = File.expand_path(file)\n @block = block\n self\n end",
"def write()\n f = File.open(\"#{@directory}/#{@filename}\", \"w\")\n f.write(@raw)\n f.close()\n end",
"def write(val)\n @file.seek(@address)\n @file.putc(val)\n @file.flush\n end",
"def initialize (filename)\n @indexname = filename + \".index\" \n @data_f = File.open(filename, \"w\")\n @index_f = File.open(@indexname, \"w\") \n @cur_num = 0 \n @cur_pos = @data_f.pos # 0\n end",
"def write_to(io)\n\t@io = io\n\t@bytes_written = 0\n\twrite_header()\n\t@update_block.call(nil, @seq.tracks.length, 0) if @update_block\n\t@seq.tracks.each_with_index do |track, i|\n write_track(track)\n @update_block.call(track, @seq.tracks.length, i) if @update_block\n\tend\n end",
"def write_to(io)\n\t@io = io\n\t@bytes_written = 0\n\twrite_header()\n\t@update_block.call(nil, @seq.tracks.length, 0) if @update_block\n\t@seq.tracks.each_with_index do |track, i|\n write_track(track)\n @update_block.call(track, @seq.tracks.length, i) if @update_block\n\tend\n end",
"def with_index_lock\n lock_path = \"#{@index_file}.lock\"\n File.open(lock_path, \"w+\") do |f|\n f.flock(File::LOCK_EX)\n yield\n end\n end",
"def write_index_file(html)\n index = File.open('/home/matt/Documents/programming/ruby/dmsw/index.html', 'w')\n index.write(html)\n index.close\n $log.info(\"Successfully created new index.html.\")\nend",
"def write_benchmark opts={}\n\t\tfiles, size = opts[:files], opts[:size]\n\t\tblock_size = opts[:block_size] || 100_000\n\t\tblock = 0.chr * block_size\n\t\tblocks, remaining = size.divmod block_size\n\t\tremaining = 0.chr * remaining\n\t\tTempfile.open 'ole_storage_benchmark' do |temp|\n\t\t\tOle::Storage.open temp do |ole|\n\t\t\t\tfiles.times do |i|\n\t\t\t\t\tole.file.open \"file_#{i}\", 'w' do |f|\n\t\t\t\t\t\tblocks.times { f.write block }\n\t\t\t\t\t\tf.write remaining\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def write(block_name, src_buffer)\n if block_name == @mem_file.size\n @mem_file << alloc_buffer\n end\n dest = @mem_file[block_name]\n ByteArray.copy(src_buffer,0,@block_size,dest,0)\n end",
"def write(filename, options = {}, &block)\n fail ArgumentError, 'Block required' unless block_given?\n File.open(filename, 'wb') do |f|\n f.write generate(options, &block)\n end\n end",
"def write row, index\n # Rails' fixture format has each row be a hash mapping the index\n # to the row data hash\n object = {index => row}\n\n # Convert the index-object to YAML\n data = object.to_yaml\n # Check conformance of the objects if we haven't already\n if !@checked\n detect_slicing_offsets data\n @checked = true\n end\n # Figure out which parts we need to chop off\n data = data.slice(@head_offset, data.length - @tail_offset)\n @io.write data\n end",
"def dump_index_cache(file)\n indexes = {}\n @indexes.sort.each do |k, v|\n indexes[k] = v\n end\n File.open(file, 'wb'){|f| f.write(Marshal.dump(indexes))}\n nil\n end",
"def write_binary_file\n return unless @binary_output_path\n\n # Write binary file if the binary_output option is set\n File.binwrite @binary_output_path, request.to_proto\n end",
"def index_write\n rugged_repository.index.reload\n yield(rugged_repository.index)\n rugged_repository.index.write\n end",
"def close\n if @fh\n @fh.puts \"\\n]\"\n @fh.close\n @fh = nil\n self.index += 1\n self.count = 0\n end\n end",
"def store_block blk\n log.debug { \"new block #{blk.hash}\" }\n\n existing = get_block(blk.hash)\n if existing && existing.chain == MAIN\n log.debug { \"=> exists (#{existing.depth}, #{existing.chain})\" }\n return [existing.depth]\n end\n\n prev_block = get_block(blk.prev_block.reverse_hth)\n unless @config[:skip_validation]\n validator = blk.validator(self, prev_block)\n validator.validate(rules: [:syntax], raise_errors: true)\n end\n\n if !prev_block || prev_block.chain == ORPHAN\n if blk.hash == Bitcoin.network[:genesis_hash]\n log.debug { \"=> genesis (0)\" }\n return persist_block(blk, MAIN, 0)\n else\n depth = prev_block ? prev_block.depth + 1 : 0\n log.debug { \"=> orphan (#{depth})\" }\n return [0, 2] unless (in_sync? || Bitcoin.network_name =~ /testnet/)\n return persist_block(blk, ORPHAN, depth)\n end\n end\n depth = prev_block.depth + 1\n\n checkpoint = @checkpoints[depth]\n if checkpoint && blk.hash != checkpoint\n log.warn \"Block #{depth} doesn't match checkpoint #{checkpoint}\"\n exit if depth > get_depth # TODO: handle checkpoint mismatch properly\n end\n if prev_block.chain == MAIN\n if prev_block == get_head\n log.debug { \"=> main (#{depth})\" }\n if !@config[:skip_validation] && ( !@checkpoints.any? || depth > @checkpoints.keys.last )\n if self.class.name =~ /UtxoStore/\n @config[:utxo_cache] = 0\n @config[:block_cache] = 120\n end\n validator.validate(rules: [:context], raise_errors: true)\n end\n res = persist_block(blk, MAIN, depth, prev_block.work)\n push_notification(:block, [blk, *res])\n return res\n else\n log.debug { \"=> side (#{depth})\" }\n return persist_block(blk, SIDE, depth, prev_block.work)\n end\n else\n head = get_head\n if prev_block.work + blk.block_work <= head.work\n log.debug { \"=> side (#{depth})\" }\n return persist_block(blk, SIDE, depth, prev_block.work)\n else\n log.debug { \"=> reorg\" }\n new_main, new_side = [], []\n fork_block = prev_block\n while fork_block.chain != MAIN\n new_main << fork_block.hash\n fork_block = fork_block.get_prev_block\n end\n b = fork_block\n while b = b.get_next_block\n new_side << b.hash\n end\n log.debug { \"new main: #{new_main.inspect}\" }\n log.debug { \"new side: #{new_side.inspect}\" }\n\n push_notification(:reorg, [ new_main, new_side ])\n\n reorg(new_side.reverse, new_main.reverse)\n return persist_block(blk, MAIN, depth, prev_block.work)\n end\n end\n end",
"def write_to_disk(disk, starting_block)\n nodes_per_block = self.class.nodes_per_block disk\n \n node, block = 1, starting_block\n while node <= node_count\n write_size = [nodes_per_block, node_count + 1 - node].min\n filler_size = disk.block_size - write_size * self.class.node_size\n \n write = Array.new(write_size + 1)\n 0.upto(write_size - 1) { |i| write[i] = self[node + i] }\n write[write_size] = \"\\0\" * filler_size\n disk.write_blocks block, 1, write.join \n \n node, block = node + write_size, block + 1\n end\n end",
"def open_index_file\n end",
"def getblockhash(index)\n @api.request 'getblockhash', index\n end",
"def create(revision=0, content_io=nil)\n # initialize datafile with compressed file @fname\n if content_io.nil?\n compress_file_lines = Deflate.deflate(File.read(@fname))\n else\n compress_file_lines = Deflate.deflate(content_io.read)\n end\n File.open(@datafile, \"w\") do |f|\n f.puts compress_file_lines\n end\n\n # initialize indexfile\n File.open(@indexfile, \"w\") do |f|\n index_write_row f, \"rev\", \"offset\", \"length\"\n index_write_row f, revision.to_s, \"0\", line_count_to_s(@datafile)\n end\n end",
"def store_index #:nodoc:\n return if @compatibility == 0\n\n indices = @db_indices\n reserved = 0x00000000\n row_min = @dim_rowmin\n row_max = @dim_rowmax\n\n record = 0x020B # Record identifier\n length = 16 + 4 * indices.size # Bytes to follow\n\n header = [record, length].pack('vv')\n data = [reserved, row_min, row_max, reserved].pack('VVVV')\n\n indices.each do |index|\n data = data + [index + @offset + 20 + length + 4].pack('V')\n end\n\n prepend(header, data)\n end",
"def write_nonblock\n end",
"def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end",
"def write_toc\n File.write('epub/OEBPS/toc.ncx', toc_ncx)\n end",
"def save_hash_tree(node_hashes)\n tree_size = SpStore::Merkle::HashTreeHelper.full_tree_node_count @blocks\n raise ArgumentError, \"Hash tree size doesn't match the size of the existed one\" unless (tree_size+1) == node_hashes.length\n File.open(disk_hash_file, 'wb') do |file|\n file.seek( hash_byte_size, IO::SEEK_SET)\n (1..tree_size).each do |node|\n file.write node_hashes[node]\n end\n end\n end",
"def write_binary(file:, data:, address: nil)\n File.open(file, 'wb') do |f|\n f.write Array(address).pack('S') if address\n f.write Array(data.flatten).pack('C*')\n end\n end",
"def open_index_file\n @index = File.open(@index_path, 'rb')\n end",
"def write(file)\n # write the length & header; always write length (int2) as network\n # order (as per GDSII spec)\n file.write [self.byte_size].pack('n')\n file.write [self.type].pack('c')\n file.write [self.data.type].pack('c')\n\n # now write the data...\n @data.write(file)\n end",
"def seek_at(index)\n @file.seek(index << @level, index < 0 ? IO::SEEK_END : IO::SEEK_SET)\n end",
"def write_training_file\n file = File.open('./train.data', 'w')\n\n file.puts \"#{@training_headlines.count} #{@number_of_inputs} #{@number_of_outputs}\"\n @training_headlines.find_each do |headline|\n file.puts vectorize_headline(headline).join(' ')\n file.puts vectorized_signs(headline).join(' ')\n file.puts\n file.puts\n end\n\n file.close\n end",
"def reset_index\n io_index.clear\n io.flush\n io.rewind\n yield(io, io_index) if block_given?\n self\n end",
"def write_benchmark opts={}\n files, size = opts[:files], opts[:size]\n block_size = opts[:block_size] || 100_000\n block = 0.chr * block_size\n blocks, remaining = size.divmod block_size\n remaining = 0.chr * remaining\n Tempfile.open 'ole_storage_benchmark' do |temp|\n Ole::Storage.open temp do |ole|\n files.times do |i|\n ole.file.open \"file_#{i}\", 'w' do |f|\n blocks.times { f.write block }\n f.write remaining\n end\n end\n end\n end\n end",
"def write_to_blobs_file(raw, address)\n begin\n File.write(@blobs_file_name, raw, address)\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write blobs file #{@blobs_file_name}: \" +\n e.message\n end\n end",
"def to_file( f )\n buf = [@name, @ref.binary_role(), @ref.binary_type(), @ref.name,\n @type, TYPE_SIZES[@type], \n @data.length()].pack(PFORMAT)\n f.write(buf)\n\n fmt_str = \"%s%d\" % [TYPES[@type], data.length]\n buf = data.pack(fmt_str)\n f.write(buf)\n end",
"def write_to(offset,args)\r\n\t\t\tif !@rw\r\n\t\t\t\traise \"The file #{@filename} is not writable\\n\"\r\n\t\t\tend\r\n\t\t\tself.seek_to(offset) or return\r\n\t\t\t@fh.print(args) or raise \"Error writing to offset #{offset} in file #{@filename}: $!\\n\"\r\n\t\t\toffset==0 ? '0E0' : offset\r\n\t\tend",
"def copy_to file\n file.puts \"# Revision #{@@outnum}<#{@num}>\" if $debug\n @newnum = @@outnum\n @@revision_number_mapping[@num] = @newnum\n @item[@item.type] = @newnum\n @@outnum += 1\n @item.copy_to file\n file.puts\n end",
"def add_block(block, state)\n start_time = Time.now\n\n mainchain_tip_hash = @storage.mainchain_tip_hash\n thischain_tip_hash = block.prev_block_hex\n\n mainchain_tip = @storage.block_header_for_hash(mainchain_tip_hash)\n thischain_tip = @storage.block_header_for_hash(thischain_tip_hash)\n\n # If the new work does not exceed the main chain work, stash this block away in a \"side branch\".\n # No further validations will be performed.\n if !thischain_tip.is_more_work?(mainchain_tip, block.hash, block.block_work)\n # This can only be possible on the sidechain, so we simply store the block without further validations.\n # Outputs will be validated when/if this block will become a part of the mainchain (see below).\n @storage.load_output_cache(block.tx)\n return persist_block_on_side_branch(block,\n @storage.height_for_block_header(thischain_tip) + 1,\n @storage.total_work_up_to_block_header(thischain_tip))\n end\n\n # New work is greater. Find the common ancestor block to rebuild the chain from there.\n # Scan both chains up to the common (minimum) height.\n # Then scan from there simultaneously until we hit the same hash.\n\n mainchain_ancestor = mainchain_tip\n thischain_ancestor = thischain_tip\n\n block_hashes_to_disconnect = []\n block_hashes_to_connect = []\n\n # 1. Scan each chain until the common min_height\n min_height = [ @storage.height_for_block_header(mainchain_ancestor),\n @storage.height_for_block_header(thischain_ancestor) ].min\n\n while @storage.height_for_block_header(mainchain_ancestor) > min_height\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n end\n\n while @storage.height_for_block_header(thischain_ancestor) > min_height\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # 2. Scan both chains simultaneously until we get to the same common ancestor\n while !(thischain_ancestor == mainchain_ancestor)\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # Finally we arrive at the common ancestor.\n # Now we need to attempt to disconnect old mainchain blocks and connect new thischain blocks.\n common_ancestor = mainchain_ancestor\n\n # 1. Disconnect the blocks on the mainchain to move them into the sidechain\n # We start from the latest hash and move on to the one right before the common ancestor.\n # Most of the time this array is empty, so no blocks are being disconnected.\n block_hashes_to_disconnect.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n if !self.disconnect_block(b, state)\n return false\n end\n end\n end\n\n # 2. Connect the blocks to form the new mainchain.\n # If any block is actually invalid (double-spends some outputs or has an invalid script),\n # this will fail and we would have to abort DB transaction to rollback all changes.\n block_hashes_to_connect.reverse.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(b, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(b)\n @output_cache.flush\n raise ex\n end\n end\n end\n\n measure_method(:add_block, start_time)\n log_raw_block_events(block.hash, \"add_block processing time: #{(Time.now - start_time).to_f}\")\n\n # Connect this new block too.\n @storage.load_output_cache(block.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(block, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(block)\n @output_cache.flush\n raise ex\n end\n end\n\n return true\n end",
"def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data\n if rest_offset\n file.seek(rest_offset, IO::SEEK_SET)\n end\n synchronize do\n voidcmd(\"TYPE I\")\n conn = transfercmd(cmd, rest_offset)\n loop do\n buf = file.read(blocksize)\n break if buf == nil\n conn.write(buf)\n yield(buf) if block\n end\n conn.close # closes the SSL\n conn.io.close # closes the TCP below it\n voidresp\n end\n end",
"def wrote_occurrence_file(current)\n if current % increment == 0\n info.attributes = {\n percent_complete: 50 + percent(current)/2,\n message: \"Wrote occurrence file for #{current}/#{species_count} species\"\n }\n info.save(path)\n end\n end",
"def do_write # :nodoc:\n yield\n\t \n\t if defined?(MAX_FILE_SIZE) && (wio.tell > MAX_FILE_SIZE)\n\t\tnew_file\n\t end\n\tend",
"def addDataToBlock(blockNumber, data, offset, shouldReportToDHT)\r\n assert @numBlocks > blockNumber\r\n blockToUse = @allBlocks[blockNumber]\r\n assert blockToUse\r\n return 0 if blockToUse.done?\r\n amountWritten = blockToUse.addToMe(data, offset)\r\n # not necessarily true if we write 'over' half of something assert amountWritten == data.length\r\n @totalBytesWritten += amountWritten\r\n if blockToUse.done? and shouldReportToDHT\r\n assert !blockToUse.alreadyReportedDoneToDHT\r\n blockToUse.alreadyReportedDoneToDHT = true\r\n @logger.log \"BM next reporting block #{blockNumber} done for #{localIP}:#{@p2pServerPort}\"\r\n blockToUse.set_block_done_in_dht\r\n end\r\n amountWritten\r\n end",
"def write_to(file_name, &block)\n file = File.new(file_name, \"w\")\n file.write \"---\\n\"\n yield(file) if block_given?\n file.write \"---\"\n file.close\nend",
"def build_index\n say \"Building index...\"\n\n # Get size in bytes, so we know when we've hit the end.\n file_size = File.size(@filename)\n CSV.open(@filename, :encoding => 'utf-8', :headers => true) do |csvin|\n\n # Get byte offset\n line_start = csvin.tell\n\n # Then read line\n count = 0\n while((line_start = csvin.tell) < file_size) do\n\n # Load the line\n line = csvin.shift()\n\n # Load the key up to the key size only\n key = get_minimal_key(line)\n \n # Save the file offset\n # TODO: ensure random access of the cache is possible\n $stderr.puts \"WARNING: Key at byte #{line_start} of #{@filename} collides with key at byte #{@cache[key]}.\" if @cache[key]\n @cache[key] = line_start\n\n print \"\\rLine: #{count+=1} \"\n end\n end\n print \"\\n\"\n \n say \"Finished building index\"\n end",
"def mark_output_as_spent(binary_tx_hash, output_index)\n @output_cache.mark_output_as_spent(binary_tx_hash, output_index, true)\n\n # Also mark outputs in the current block\n hash = Toshi::Utils.bin_to_hex_hash(binary_tx_hash)\n if dict = @current_block_transactions_map[hash]\n dict[:spent_outputs][output_index] = true\n end\n end",
"def write\n File.open(@file, 'a') do |w| \n w.write(\"\\n\"+ @name + \" \" + @path)\n end\n end",
"def write_varint_array(array, &block)\n if array.nil?\n write_varint(-1)\n else\n write_varint(array.size)\n array.each(&block)\n end\n end",
"def write_data_at_offset(offset, data)\n\t\t@file.seek(offset.to_i, IO::SEEK_END)\n\t\t@file << data\n\tend",
"def write(file)\n self.files.each { |l| file.puts l }\n end",
"def write(fragment); end"
] |
[
"0.6083968",
"0.58898723",
"0.5857545",
"0.58295625",
"0.5742699",
"0.5708285",
"0.5688307",
"0.56623816",
"0.5633655",
"0.5600889",
"0.55661744",
"0.5563343",
"0.5554566",
"0.54835206",
"0.54814553",
"0.5410083",
"0.5393533",
"0.530612",
"0.52935255",
"0.5284443",
"0.5175669",
"0.51724815",
"0.5150117",
"0.51467276",
"0.51433223",
"0.5135943",
"0.51235515",
"0.5118761",
"0.51132536",
"0.5087452",
"0.5058052",
"0.5056827",
"0.5039433",
"0.5022432",
"0.5014951",
"0.49948013",
"0.49843305",
"0.49812967",
"0.49774858",
"0.49769166",
"0.49467123",
"0.49353942",
"0.49278674",
"0.48999402",
"0.48918676",
"0.4885398",
"0.48765355",
"0.48724067",
"0.48577338",
"0.48516738",
"0.48516536",
"0.48497912",
"0.48443675",
"0.48114052",
"0.48043603",
"0.48043603",
"0.478639",
"0.4772415",
"0.47695416",
"0.47686028",
"0.47336242",
"0.4729339",
"0.4722514",
"0.47077453",
"0.47040185",
"0.4695208",
"0.46915796",
"0.46768138",
"0.4661235",
"0.463884",
"0.46353453",
"0.46186015",
"0.46083173",
"0.46038198",
"0.46033645",
"0.46029365",
"0.45996252",
"0.45914584",
"0.45732814",
"0.45718578",
"0.45713598",
"0.45651597",
"0.45558572",
"0.4554793",
"0.45526698",
"0.4546538",
"0.45392546",
"0.4526583",
"0.45253372",
"0.45230556",
"0.45215616",
"0.4520486",
"0.45098808",
"0.45098692",
"0.45097682",
"0.4509239",
"0.45075816",
"0.45066184",
"0.45032153",
"0.44967803"
] |
0.7374174
|
0
|
GET /spells, GET /
|
def spells
get_schools
get_classes
respond_to do |format|
format.json {
get_all_spells
render json: @spells.sort_by {|k, v| v['name']}.to_json
}
format.html {}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @spells = Spell.all\n end",
"def index\n\t\t@player_spells = PlayerSpell.all\n\tend",
"def spell\n fetch('harry_potter.spells')\n end",
"def index\n @class_spells = ClassSpell.all\n end",
"def index\n @prepared_spells = PreparedSpell.all\n end",
"def show\n respond_to do |format|\n format.html { @player = Player.find(params[:id]) }\n format.json { render json: Player.find(params[:id]).as_json(:include => [:items, :spells]) }\n end\n end",
"def spells\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def show\n render json: @spellbook\n end",
"def index\n @spelling_lists = SpellingList.all\n end",
"def spells()\n learnings = self.learnings()\n spells = learnings.map { |learning| learning.spell }\n return spells\n end",
"def sounds_list(params = {})\n get \"sounds\", params\n end",
"def show\n\t\tresults = Spellchecker.check(params[:id]).first # Spellchecker gem spec http://rubydoc.info/gems/spellchecker/0.1.5/frames \n\t\tresults.delete(:original) # original word is not part of the api spec\n\t\t\n\t\tif results[:correct]\n\t\t\trespond_with(results) # They got it right. Nothing more to be done.\n\t\t\treturn\n\t\tend\n\t\t\n\t\tunless @user = User.find_by_id(params[:user_id])\n\t\t\trespond_with(results) # No one is logged in. Return the results.\n\t\t\treturn\n\t\tend\n\t\t\n\t\tunless @custom_word = @user.custom_words.find_by_word(params[:id])\n\t\t\trespond_with(results) # This is a new word. Return the results.\n\t\t\treturn\n\t\tend\n\t\t\n\t\tif @custom_word.correct\n\t\t\trespond_with( {:correct => false} )\n\t\telse\n\t\t\trespond_with( {:correct => false, :suggestions => @custom_word.top_corrections.concat( results[:suggestions] ).uniq[0..2] })\n\t\tend\n\tend",
"def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end",
"def index\n respond_with(@words = Word.all)\n end",
"def initialize(name)\n @name = name\n @spells = []\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @player_spell.update(player_spell_params)\n\t\t\t\tformat.html { redirect_to [@player_spell.player, {anchor: 'spells'}], notice: 'Player spell was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @player_spell }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @player_spell.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def abilities\n get('/ability/')\n end",
"def summoner_spell\n fetch('games.league_of_legends.summoner_spell')\n end",
"def index\n @spell_progressions = SpellProgression.all\n end",
"def index\n @weapons = Weapon.all\n render :json => @weapons, :include => :special_rules\n \n end",
"def getSpellHash\n\t\t# Neue Hashes\n\t\t@allSpells = Hash.new\n\t\tspellQ = Hash.new\n\t\tspellW = Hash.new\n\t\tspellE = Hash.new\n\t\tspellR = Hash.new\n\n\t\t# Arrays welche gebraucht werden\n\t\t@sant = Array.new\n\t\tsantEffect = Array.new\n\t\tarrayEffects = Array.new\n\t\tarrayName = Array.new\n\t\tarrayCooldown = Array.new\n\t\tarrayCostType = Array.new\n\t\tarrayCostBurn = Array.new\n\t\tarrayImageSpellUrl = Array.new\n\t\tarrayRange = Array.new\n\t\tarrayResourcePlain = Array.new\n\t\tarrayResource = Array.new\n\n\t\tarraySkillScale = Array.new\n\t\t$allchamps.each do |champ|\n\n\n\n\t\t\t@spells = champ.spells\n\t\t\tif champ[:name] == self[:name]\n\n\n\t\t\t\t# Schlauft durch alle spells und speichert die informationen die wir brauchen in arrays\n\t\t\t\t@spells.each do |spell|\n\t\t\t\t\tputs spell\n\t\t\t\t\tspell.each do |key,value|\n\t\t\t\t\t\tif key == \"sanitizedTooltip\"\n\t\t\t\t\t\t\t@sant.push(value)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif key == \"name\"\n\t\t\t\t\t\t\tarrayName.push(value)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif key == \"cooldownBurn\"\n\t\t\t\t\t\t\tarrayCooldown.push(value)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif key == \"costType\"\n\t\t\t\t\t\t\tarrayCostType.push(value)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif key == \"costBurn\"\n\t\t\t\t\t\t\tarrayCostBurn.push(value)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif key == \"rangeBurn\"\n\t\t\t\t\t\t\tarrayRange.push(value)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif key == \"image\"\n\t\t\t\t\t\t\tvalue.each do |k,v|\n\t\t\t\t\t\t\t\tif k == \"full\"\n\t\t\t\t\t\t\t\t\t@img = v\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\turl = $apiurl + \"spell/\" + @img\n\t\t\t\t\t\t\tarrayImageSpellUrl.push(url)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif key == \"resource\"\n\t\t\t\t\t\t\tarrayResourcePlain.push(value)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# TEIL FUER DIE RESSOURCEN\n\n\t\t\t\tcostCount = 0\n\t\t\t\tarrayResourcePlain.each do |res|\n\t\t\t\t\t# Wenn der String ein { enthaelt so ist es kein normaler mana typ und man muss die kosten richtig machen\n\t\t\t\t\tif !res.include? 'cost' and !res.include? 'No Cost'\n\t\t\t\t\t\tinhalt = res.scan(/\\{(.*?)\\}/)[0].to_s\n\t\t\t\t\t\tinhalt.delete! \"{[]\"\n\t\t\t\t\t\tinhalt.delete!(' ')\n\t\t\t\t\t\tputs inhalt\n\t\t\t\t\t\t# macht aus \"e1\" -> e1\n\t\t\t\t\t\trichtigInhalt = inhalt[1] + inhalt[2]\n\t\t\t\t\t\tputs richtigInhalt\n\n\t\t\t\t\t\t\t@spells[costCount].each do |key,value|\n\t\t\t\t\t\t\t\tif key == \"effectBurn\"\n\t\t\t\t\t\t\t\t\t# Speichert den gesuchten wert abs\n\t\t\t\t\t\t\t\t\twert = value[inhalt[2].to_i]\n\t\t\t\t\t\t\t\t\tputs wert\n\t\t\t\t\t\t\t\t\tnewText = res.dup\n\t\t\t\t\t\t\t\t\tnewText.sub! \"#{richtigInhalt}\", \"#{wert}\"\n\t\t\t\t\t\t\t\t\tnewText.delete! \"{}\"\n\t\t\t\t\t\t\t\t\tarrayResource.push(newText)\n\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t# Wenn die kosten in dem key cost zu suchen sind\n\t\t\t\t\telsif res.include? 'cost'\n\t\t\t\t\t\t@spells[costCount].each do |key,value|\n\t\t\t\t\t\t\tif key == \"costBurn\"\n\t\t\t\t\t\t\t\t# Speichert den gesuchten wert abs\n\t\t\t\t\t\t\t\twert = value\n\t\t\t\t\t\t\t\tnewText = res.dup\n\t\t\t\t\t\t\t\tnewText.sub! \"{{ cost }}\", \"#{wert}\"\n\t\t\t\t\t\t\t\tarrayResource.push(newText)\n\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\n\n\t\t\t\t\telsif res.include? 'No Cost'\n\t\t\t\t\t\tarrayResource.push(res)\n\t\t\t\t\tend\n\n\t\t\t\tcostCount += 1\n\t\t\tend\n\n\t\t\t# Weil die API bei maokai ult als einziges ein e4 drin hat wird dies einzeln gelöst sollte man aber nochaml überdenken\n\t\t\tif champ[:name] == \"Maokai\"\n\t\t\t\tnewMao = arrayResource[3].dup\n\t\t\t\tnewMao.sub! \"{{ e4 }}\",\"30\"\n\t\t\t\tarrayResource[3] = newMao\n\t\t\tend\n\n\t\t\t\t# TEIL FUER DIE DESCRIPTION\n\n\t\t\t\t# nimmt alle teile mit {{ }} im string raus und spechert den inhalt in ein array -> [\"e1\",\"a1\",\"e5\"]\n\t\t\t\t@sant.each do |skill|\n\t\t\t\t\tsantEffect = []\n\t\t\t\t\tarrayBrackets = skill.scan(/\\{(.*?)\\}/)\n\n\t\t\t\t\tarrayBrackets.each do |ele|\n\n\t\t\t\t\t\twithoutBrackets = ele[0].delete! \"{}\"\n\t\t\t\t\t\t# löscht alle whitespaces\n\t\t\t\t\t\tsantEffect.push(withoutBrackets.strip)\n\n\t\t\t\t\tend\n\t\t\t\t\t# hat für alle abilities die richtigen effect und keys => [\"[\"e1\",\"a1\",\"e5\"]\",\"[\"e3\",\"e5\",\"a2\"]\".....]\n\t\t\t\t\tarrayEffects.push(santEffect)\n\t\t\t\tend\n\n\t\t\t\t#Array in dem die richtigen infos gespeichert wird\n\t\t\t\tarraySpellEffects = Array.new\n\n\t\t\t\tcount = 0\n\t\t\t\t@spells.each do |spell|\n\t\t\t\t\tarrayEffects[count].each do |effect|\n\t\t\t\t\t\t# Wenn es sich um ein effect handelt = \"e\" dann muss man in der tabelle \"effectBurn\" suchen\n\t\t\t\t\t\tif effect[0] == \"e\"\n\t\t\t\t\t\t\t# Schlauft durch alle spells des champs\n\t\t\t\t\t\t\tspell.each do |key,value|\n\t\t\t\t\t\t\t\tif key == \"effectBurn\"\n\t\t\t\t\t\t\t\t\t# Speichert den gesuchten wert abs\n\t\t\t\t\t\t\t\t\twert = value[effect[1].to_i]\n\t\t\t\t\t\t\t\t\tarraySpellEffects.push(wert)\n\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t# Wenn es sich um ein coeff handelt = \"a\" so muss man diesen coeff in der tabelle \"vars\" suchen\n\t\t\t\t\t\telsif effect[0] == \"a\"\n\t\t\t\t\t\t\tbool = false\n\t\t\t\t\t\t\t# Schlauft durch alle spells des champs\n\t\t\t\t\t\t\tspell.each do |key,value|\n\t\t\t\t\t\t\t\tif key == \"vars\"\n\n\t\t\t\t\t\t\t\t\tvalue.each do |vars|\n\t\t\t\t\t\t\t\t\t\tvars.each do |key, value|\n\t\t\t\t\t\t\t\t\t\t\t# wenn der Key \"key\" so muss überprüft werden ob dieser den gelichen value hat wie effect\n\t\t\t\t\t\t\t\t\t\t\tif key == \"key\"\n\t\t\t\t\t\t\t\t\t\t\t\tif value == effect\n\t\t\t\t\t\t\t\t\t\t\t\t\tbool = true\n\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t# Stimmt der key überein so kann dieser wert genommen werden\n\t\t\t\t\t\t\t\t\t\t\tif bool\n\t\t\t\t\t\t\t\t\t\t\t\tif key == \"coeff\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t@coeff = value\n\n\n\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t# Fügt den dmg typ der skalierung dem array hinzus\n\t\t\t\t\t\t\t\t\t\t\t\tif key == \"link\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t@dmgType = value\n\n\t\t\t\t\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\tarraySpellEffects.push(@coeff.to_s + \" \" + @dmgType.to_s)\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tcount += 1\n\t\t\t\tend\n\t\t\t\tputs arraySkillScale\n\n\t\t\t\t#Loop that replace the text with the correct values\n\t\t\t\tnewSkills = Array.new\n\t\t\t\tcount = 0\n\t\t\t\tarrayEffectCount = 0\n\t\t\t\tarrayScaleCount = 0\n\t\t @sant.each do |skill|\n\t\t\t\t\t# dup ist wichtig damit man den kopierten string bearbeitet und nicht den orignal den man von der api bekommt\n\t\t\t\t\tnewText = skill.dup\n\t\t\t\t\tarrayEffects[count].each do |effects|\n\t\t\t\t\t\tif skill.include?(effects)\n\t\t\t\t\t\t\t# Die f abfragen scheinen buggy zu sein bei der API\n\t\t\t\t\t\t\tif effects[0] != \"f\"\n\t\t\t\t\t\t\t\t\t# sub| erstellt einen neuen string aus dem vorherigen\n\t\t\t\t\t\t\t\t\t@text = newText.sub! \"#{effects}\", \"#{arraySpellEffects[arrayEffectCount]}\"\n\n\t\t\t\t\t\t\t\tarrayEffectCount += 1\n\t\t\t\t\t\t\t\tarrayScaleCount += 1\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t@text.delete! \"{}\"\n\t\t\t\t\t@text.delete! \"[]\"\n\t\t\t\t\tnewSkills.push(@text)\n\t\t\t\t\tcount +=1\n\n\t\t\t\tend\n\n\t\t\t\t#added den Inhalt der Array dem richtigen Hash zu =>\tarrayName arrayCooldown arrayCostType arrayCostBurn\n\t\t\t\tspellCount = 0\n\t\t\t\t4.times do\n\t\t\t\t\tif spellCount == 0\n\t\t\t\t\t\tspellQ[\"description\"] = newSkills[0]\n\t\t\t\t\t\tspellQ[\"name\"] = arrayName[0]\n\t\t\t\t\t\tspellQ[\"cooldown\"] = arrayCooldown[0]\n\t\t\t\t\t\tspellQ[\"costType\"] = arrayCostType[0]\n\t\t\t\t\t\tspellQ[\"costBurn\"] = arrayCostBurn[0]\n\t\t\t\t\t\tspellQ[\"image\"] = arrayImageSpellUrl[0]\n\t\t\t\t\t\tspellQ[\"range\"] = arrayRange[0]\n\t\t\t\t\t\tspellQ[\"ressource\"] = arrayResource[0]\n\t\t\t\t\telsif spellCount == 1\n\t\t\t\t\t\tspellW[\"description\"] = newSkills[1]\n\t\t\t\t\t\tspellW[\"name\"] = arrayName[1]\n\t\t\t\t\t\tspellW[\"cooldown\"] = arrayCooldown[1]\n\t\t\t\t\t\tspellW[\"costType\"] = arrayCostType[1]\n\t\t\t\t\t\tspellW[\"costBurn\"] = arrayCostBurn[1]\n\t\t\t\t\t\tspellW[\"image\"] = arrayImageSpellUrl[1]\n\t\t\t\t\t\tspellW[\"range\"] = arrayRange[1]\n\t\t\t\t\t\tspellW[\"ressource\"] = arrayResource[1]\n\t\t\t\t\telsif spellCount == 2\n\t\t\t\t\t\tspellE[\"description\"] = newSkills[2]\n\t\t\t\t\t\tspellE[\"name\"] = arrayName[2]\n\t\t\t\t\t\tspellE[\"cooldown\"] = arrayCooldown[2]\n\t\t\t\t\t\tspellE[\"costType\"] = arrayCostType[2]\n\t\t\t\t\t\tspellE[\"costBurn\"] = arrayCostBurn[2]\n\t\t\t\t\t\tspellE[\"image\"] = arrayImageSpellUrl[2]\n\t\t\t\t\t\tspellE[\"range\"] = arrayRange[2]\n\t\t\t\t\t\tspellE[\"ressource\"] = arrayResource[2]\n\t\t\t\t\telsif spellCount == 3\n\t\t\t\t\t\tspellR[\"description\"] = newSkills[3]\n\t\t\t\t\t\tspellR[\"name\"] = arrayName[3]\n\t\t\t\t\t\tspellR[\"cooldown\"] = arrayCooldown[3]\n\t\t\t\t\t\tspellR[\"costType\"] = arrayCostType[3]\n\t\t\t\t\t\tspellR[\"costBurn\"] = arrayCostBurn[3]\n\t\t\t\t\t\tspellR[\"image\"] = arrayImageSpellUrl[3]\n\t\t\t\t\t\tspellR[\"range\"] = arrayRange[3]\n\t\t\t\t\t\tspellR[\"ressource\"] = arrayResource[3]\n\t\t\t\t\tend\n\t\t\t\t\tspellCount += 1\n\t\t\t\tend\n\t\t\t\t# Adde alle Hashes dem Hash mit allen spells\n\n\t\t\t\t@allSpells[\"Q\"] = spellQ\n\t\t\t\t@allSpells[\"W\"] = spellW\n\t\t\t\t@allSpells[\"E\"] = spellE\n\t\t\t\t@allSpells[\"R\"] = spellR\n\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tputs @allSpells\n\t\t\treturn @allSpells\n\t\tend",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def index\n #@words = Word.all.order('created_at DESC').paginate(:page => params[:page])\n #@definitions = @words.each {|word| word.definitions.order(:cached_votes_up => :desc)}\n\n if params[:letter]\n @words = Word.all.order('created_at DESC').where(\"word like ?\", params[:letter] +\"%\" ).paginate(:page => params[:page])\n # creates this /words?letter=i\n elsif params[:term]\n @words = Word.where('word LIKE ?', \"%#{params[:term]}%\").paginate(:page => params[:page])\n else\n @words = Word.all.order('created_at DESC').paginate(:page => params[:page])\n end\n\n respond_to do |format|\n format.html # will render index.html.erb in case of a HTML request\n format.js # will render index.js.erb in case of an AJAX request\n end\n end",
"def index\n @twitch = Twitch.new({\n :client_id => @client_id,\n :secret_key => @secret_key,\n :redirect_uri => @redirect_uri,\n :scope => @scope\n })\n if params[:search]\n @casts = Cast.search(params[:search])\n @cast_query = @casts\n else\n @casts = Cast.all\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @sounds = Sound.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sounds }\n end\n end",
"def list\n dispensaries = Dispensary.find(:all, :conditions => [\"name like ?\", params[:term]+\"%\"])\n result = []\n \n for d in dispensaries\n result << d.name\n end\n \n render(:json => result)\n end",
"def index\n respond_with Sound.all\n end",
"def summoner_spell; end",
"def index\n @mypage = \"タレント一覧\"\n @talents = Talent.all\n end",
"def index\n @loot_types = LootType.all\n end",
"def summoner_spell_all(key_by_id = false, data_version = nil)\n summoner_spell_list = get(resource_path('summoner-spell'), @version, spellData: 'all', dataById: key_by_id, version: data_version)\n\n if key_by_id\n RiotGamesApi::LOL::Model::StaticData::SummonerSpellListDataById.new summoner_spell_list\n else\n RiotGamesApi::LOL::Model::StaticData::SummonerSpellList.new summoner_spell_list\n end\n end",
"def index\n @spelling_tests = SpellingTest.all\n end",
"def index\n \n if params.has_key?(:geo_treasure_id)\n @treasure_treasures = Treasure::Treasure.where(geo_treasure_id: params[:geo_treasure_id])\n logger.debug \"treasures #{@treasure_treasures.inspect}\"\n else\n raise ForbiddenError.new \"access forbidden\" unless admin? || staff? || developer?\n @treasure_treasures = Treasure::Treasure.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treasure_treasures }\n end\n end",
"def index\n @wards = Ward.all\n end",
"def destroy\n @spell.destroy\n respond_to do |format|\n format.html { redirect_to spells_url, notice: 'Spell was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@player = @player_spell.player\n\t\t@player_spell.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to [@player, {anchor: 'spells'}], notice: 'Player spell was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def index\n \n last_modified = nil\n\n if params.has_key?(:character_id) # request using character_id \n \n state = Tutorial::State.find_by_character_id(params[:character_id])\n raise NotFoundError.new('No quests found for character id.') if state.nil?\n raise ForbiddenError.new('Access forbidden.') if state.owner != current_character && !staff? && !admin?\n \n @tutorial_quests = if api_request? # send only the relevant quests (those, that have not been finished yet)\n state.quests.non_closed \n else # display all quests in backend\n state.quests.paginate(:page => params[:page], :per_page => 50) \n end\n last_modified = state.updated_at.utc # the state is touched on changed on the quests\n \n else # request all \n raise ForbiddenError.new('Access forbidden.') if !staff? && !admin? \n @tutorial_quests = Tutorial::Quest.paginate(:page => params[:page], :per_page => 50)\n end\n \n if stale?(:last_modified => last_modified, :etag => @tutorial_quests)\n respond_to do |format|\n format.html \n format.json { render json: @tutorial_quests }\n end\n end\n end",
"def index\n @castes = Caste.includes(:religion).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @castes }\n end\n end",
"def index\n champions = Champion.all\n render json: champions\n end",
"def set_spell\n @spell = Spell.find(params[:id])\n end",
"def index\n @quests = Quest.all\n\n unless params[\"search\"].nil?\n case params[\"search\"]\n when \"main\"\n @quests=Quest.where(quest_type: \"Main\")\n when \"item\"\n @quests=Quest.where(quest_type: \"Item\")\n when \"side\"\n @quests=Quest.where(quest_type: \"Side\")\n when \"cash\"\n @quests=Quest.where(quest_type: \"Cash\")\n end\n end\n end",
"def index\n # Uses will_paginate gem\n @words = Word\n .includes(\n definitions: [\n { related_definitions: :word },\n :places,\n :alt_spellings,\n :source_materials,\n :source_dates\n ]\n )\n .order(sort_order)\n .paginate(page: params[:page], per_page: 50)\n .load\n end",
"def index\n # scan from redis\n words = []\n REDIS.keys('w_*').reverse_each do |key|\n words.push(JSON.parse(REDIS.get(key))) \n end\n render json: words\n\n # scan from mongodb\n # @words = Word.all\n # render json: @words\n end",
"def index\n @quests = Quest.all\n end",
"def index\n @quests = Quest.all\n end",
"def create\n\t\t@player_spell = PlayerSpell.new(player_spell_params)\n\n\t\trespond_to do |format|\n\t\t\tif @player_spell.save\n\t\t\t\tformat.html { redirect_to [@player_spell.player, {anchor: 'spells'}], notice: 'Player spell was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @player_spell }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @player_spell.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end",
"def senses\n _response_word.fetch(\"senses\", [])\n end",
"def index\n @shooting_ranges = ShootingRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_ranges }\n end\n end",
"def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end",
"def sounds_get(sound_id)\n get \"sounds/#{sound_id}\"\n end",
"def spell; end",
"def show\n @word = Word.find(params[:id])\n\n #debug\n @texts = @word.texts\n ############################\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def listar()\n @client.get(Route.new([ROTA_DID]))\n end",
"def index\n @moods = Mood.all\n end",
"def index\n @moods = Mood.all\n end",
"def index\n @plugs = Plug.all\n authorize! :read, @plug\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plugs }\n format.xml # { render json: @plugs }\n end\n end",
"def index\n @appellations = Appellation.all\n end",
"def show\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_list }\n end\n end",
"def index\n\t\t@wars = War.all.order(\"id DESC\")\n\t\t@wars = @wars.where(\"guild1_id = ? OR guild2_id = ?\", params[:guild_id], params[:guild_id]) if params[:guild_id]\n\tend",
"def destroy\n @prepared_spell.destroy\n respond_to do |format|\n format.html { redirect_to prepared_spells_url, notice: 'Prepared spell was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @talks = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talks }\n end\n end",
"def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end",
"def heros\n get('/hero/')\n end",
"def list\n get('/')\n end",
"def index\n @nouns = Noun.all\n end",
"def update\n respond_to do |format|\n if @spell.update(spell_params)\n format.html { redirect_to @spell, notice: 'Spell was successfully updated.' }\n format.json { render :show, status: :ok, location: @spell }\n else\n format.html { render :edit }\n format.json { render json: @spell.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render :json => @weapon, :include => :special_rules\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def list_all_shards(args = {}) \n get(\"/shards.json/\", args)\nend",
"def set_player_spell\n\t\t@player_spell = PlayerSpell.find_by(player_id: params[:player_id], spell_id: params[:id])\n\tend",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def list\n @audios = Audio.all\n\n respond_to do |format|\n format.html\n format.json { render json: @audios }\n end\n end",
"def random_roberto_speech\n skip_authorization\n respond_to do |format|\n format.json do\n render json: { roberto_speech: \"#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}\" }\n end\n end\n end",
"def get\n perform_request(api_url(\"champion\"))[\"champions\"].map {|c| Champion.new(c)}\n end",
"def show\n set_glossary_locale(params[:locale]) if params[:locale]\n\n respond_to do |format|\n format.html {\n redirect_to glossary_terms_path(params[:id])\n }\n format.json {\n @glossary = Glossary.find(params[:id]).prepare_for_display\n render json: @glossary\n }\n end\n end",
"def index\n \t @responses = Response.all\n end",
"def index\n @fundamental_guilds = Fundamental::Guild.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_guilds }\n end\n end",
"def show\n @shooting = Shooting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shooting }\n end\n end",
"def show\n @talent = Talent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @talent }\n end\n end",
"def index\n @type_sounds = TypeSound.all\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def index\n do_authorize_class\n\n if params.include?(:audio_event_id)\n @audio_event = AudioEvent.find(params[:audio_event_id])\n authorize! :show, @audio_event\n query = @audio_event.tags\n else\n query = Tag.all\n end\n\n @tags, opts = Settings.api_response.response_advanced(\n api_filter_params,\n query,\n Tag,\n Tag.filter_settings\n )\n respond_index(opts)\n end",
"def index\n @the_loai_saches = TheLoaiSach.all\n end",
"def index\n # @songs = Song.find_by_artist_id params[:artist_id]\n @songs = Song.find_all_by_artist_id params[:artist_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end",
"def index\n @talk = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk }\n end\n end",
"def index\n\n if params[:tag]\n @definitions.tagged_with(params[:tag])\n elsif params[:letter]\n @definitions = Definition.starts_with(params[:letter])\n else\n @definitions = Definition.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end",
"def index\n @hands = Hand.all\n end",
"def index\n @weapons_types = WeaponsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weapons_types }\n end\n end",
"def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n end\n end"
] |
[
"0.7501938",
"0.71436214",
"0.70778805",
"0.6834009",
"0.6431804",
"0.6240029",
"0.5946355",
"0.5910445",
"0.5861392",
"0.5855386",
"0.56545186",
"0.5642606",
"0.5577761",
"0.55225134",
"0.5487532",
"0.546907",
"0.54669714",
"0.5465389",
"0.54424864",
"0.54284704",
"0.5420462",
"0.5418026",
"0.54086936",
"0.5403521",
"0.5401617",
"0.53975236",
"0.5394983",
"0.5372034",
"0.53712183",
"0.5364046",
"0.5363379",
"0.53573143",
"0.5354359",
"0.53485495",
"0.53346264",
"0.5330956",
"0.5329114",
"0.53238404",
"0.53144217",
"0.530496",
"0.5299527",
"0.528875",
"0.5286156",
"0.52860755",
"0.52846014",
"0.5270082",
"0.5270082",
"0.5269075",
"0.526186",
"0.52557844",
"0.52430654",
"0.5238344",
"0.52305883",
"0.5225518",
"0.52239436",
"0.521163",
"0.5209623",
"0.52035564",
"0.52035564",
"0.5188227",
"0.51857734",
"0.5175931",
"0.51696503",
"0.5169289",
"0.51655126",
"0.51654226",
"0.51560056",
"0.5152208",
"0.5151233",
"0.5146048",
"0.514348",
"0.51420224",
"0.51420224",
"0.51420224",
"0.51420224",
"0.5141471",
"0.5139843",
"0.5137578",
"0.51374125",
"0.5135321",
"0.5129235",
"0.5122234",
"0.5117793",
"0.51158136",
"0.5111027",
"0.5110472",
"0.5101087",
"0.5099056",
"0.50983447",
"0.50920856",
"0.5089124",
"0.5085063",
"0.5084247",
"0.5082627",
"0.50788844",
"0.507098",
"0.5070798",
"0.5068669",
"0.506097",
"0.50597835"
] |
0.76316035
|
0
|
update /etc/instancecontroller/logs.json for uploading presto logs to s3
|
def s3LogJsonUpdate(presto_log_dir)
println "presto log dir : #{presto_log_dir}"
logs_json_path = "/etc/instance-controller/logs.json"
println "Updating #{logs_json_path}"
json_obj=JSON.parse(File.read("#{logs_json_path}"));
sections = json_obj["logFileTypes"]
sections.each { |section|
if section['typeName'] == 'SYSTEM_LOG' then
user_log = section['logFilePatterns']
user_log << {
"fileGlob" => "#{presto_log_dir}/var/log/(.*)",
"s3Path" => "node/$instance-id/apps/presto/$0",
"delayPush" => "true"
}
break
end
}
new_json=JSON.pretty_generate(json_obj)
File.open('/tmp/logs.json','w') do |file_w|
file_w.write("#{new_json}")
end
sudo "mv /tmp/logs.json #{logs_json_path}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def s3LogJsonUpdate(kafka_log_dir)\n println \"kafka log dir : #{kafka_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n if section['typeName'] == 'SYSTEM_LOG' then\n user_log = section['logFilePatterns']\n user_log << {\n \"fileGlob\" => \"#{kafka_log_dir}/var/log/(.*)\",\n \"s3Path\" => \"node/$instance-id/apps/kafka/$0\",\n \"delayPush\" => \"true\"\n }\n break\n end\n }\n new_json=JSON.pretty_generate(json_obj)\n File.open('/tmp/logs.json','w') do |file_w|\n file_w.write(\"#{new_json}\")\n end\n sudo \"mv /tmp/logs.json #{logs_json_path}\"\nend",
"def send_logs_to_s3\n File.open(log_file) do |file|\n s3.put_object(\n bucket: log_bucket,\n key: instance_id,\n body: file\n )\n end\n end",
"def store_logs_in_s3_bucket\n # Set Client Resources for AWS\n Aws.config.update(region: \"us-gov-west-1\")\n s3client = Aws::S3::Client.new\n s3resource = Aws::S3::Resource.new(client: s3client)\n s3bucket = s3resource.bucket(\"data-remediation-output\")\n\n # Folder and File name\n file_name = \"contention-not-found-remediation-logs/cnf-remediation-log-#{Time.zone.now}\"\n\n # Store contents of logs array in a temporary file\n content = @logs.join(\"\\n\")\n temporary_file = Tempfile.new(\"cnf-log.txt\")\n filepath = temporary_file.path\n temporary_file.write(content)\n temporary_file.flush\n\n # Store File in S3 bucket\n s3bucket.object(file_name).upload_file(filepath, acl: \"private\", server_side_encryption: \"AES256\")\n\n # Delete Temporary File\n temporary_file.close!\n end",
"def log_to_s3(log_file, filename)\n S3Service.store_file(S3_BUCKET_NAME + \"/\" + filename + \"--#{Time.zone.now}.csv\", log_file)\n end",
"def aws_instance_S3_files_save\n time = Time.now.strftime(\"%y_%m_%d\")\n bucket = aws_call('aws_S3_bucket_get', name: Rails.configuration.x.aws['s3_bucket_name'])\n\n path = self.scenario.statistic.data_path_instance(self.name)\n\n log \"AWS: saving bash history from Instance '#{self.name}'\"\n File.open(self.scenario.statistic.data_instance_bash_histories_path(self.name), \"wb\") do |f|\n f.write(aws_S3_object_get_and_read(bucket, aws_S3_object_name('bash_history')) )\n end\n\n log \"AWS: saving exit status from Instance '#{self.name}'\"\n File.open(self.scenario.statistic.data_instance_exit_statuses_path(self.name), \"wb\") do |f|\n f.write(aws_S3_object_get_and_read(bucket, aws_S3_object_name('exit_status')) )\n end\n\n log \"AWS: saving script log from Instance '#{self.name}'\"\n File.open(self.scenario.statistic.data_instance_script_logs_path(self.name), \"wb\") do |f|\n f.write(aws_S3_object_get_and_read(bucket, aws_S3_object_name('script_log')) )\n end\n end",
"def update_log_aws_s3(opts = {})\n data, _status_code, _headers = update_log_aws_s3_with_http_info(opts)\n data\n end",
"def aws_instance_S3_files_save_no_log\n time = Time.now.strftime(\"%y_%m_%d\")\n bucket = aws_call('aws_S3_bucket_get', name: Rails.configuration.x.aws['s3_bucket_name'])\n\n path = self.scenario.statistic.data_path_instance(self.name)\n\n File.open(self.scenario.statistic.data_instance_bash_histories_path(self.name), \"wb\") do |f|\n f.write(aws_S3_object_get_and_read_no_log(bucket, aws_S3_object_name('bash_history')) )\n end\n\n File.open(self.scenario.statistic.data_instance_exit_statuses_path(self.name), \"wb\") do |f|\n f.write(aws_S3_object_get_and_read_no_log(bucket, aws_S3_object_name('exit_status')) )\n end\n\n File.open(self.scenario.statistic.data_instance_script_logs_path(self.name), \"wb\") do |f|\n f.write(aws_S3_object_get_and_read_no_log(bucket, aws_S3_object_name('script_log')) )\n end\n end",
"def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end",
"def update_log_aws_s3_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingS3Api.update_log_aws_s3 ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_s3_name = opts[:'logging_s3_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling LoggingS3Api.update_log_aws_s3\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingS3Api.update_log_aws_s3\"\n end\n # verify the required parameter 'logging_s3_name' is set\n if @api_client.config.client_side_validation && logging_s3_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_s3_name' when calling LoggingS3Api.update_log_aws_s3\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"classic\", \"loggly\", \"logplex\", \"blank\"]\n if @api_client.config.client_side_validation && opts[:'message_type'] && !allowable_values.include?(opts[:'message_type'])\n fail ArgumentError, \"invalid value for \\\"message_type\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"zstd\", \"snappy\", \"gzip\"]\n if @api_client.config.client_side_validation && opts[:'compression_codec'] && !allowable_values.include?(opts[:'compression_codec'])\n fail ArgumentError, \"invalid value for \\\"compression_codec\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/s3/{logging_s3_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_s3_name' + '}', CGI.escape(logging_s3_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['timestamp_format'] = opts[:'timestamp_format'] if !opts[:'timestamp_format'].nil?\n form_params['compression_codec'] = opts[:'compression_codec'] if !opts[:'compression_codec'].nil?\n form_params['period'] = opts[:'period'] if !opts[:'period'].nil?\n form_params['gzip_level'] = opts[:'gzip_level'] if !opts[:'gzip_level'].nil?\n form_params['access_key'] = opts[:'access_key'] if !opts[:'access_key'].nil?\n form_params['acl'] = opts[:'acl'] if !opts[:'acl'].nil?\n form_params['bucket_name'] = opts[:'bucket_name'] if !opts[:'bucket_name'].nil?\n form_params['domain'] = opts[:'domain'] if !opts[:'domain'].nil?\n form_params['iam_role'] = opts[:'iam_role'] if !opts[:'iam_role'].nil?\n form_params['path'] = opts[:'path'] if !opts[:'path'].nil?\n form_params['public_key'] = opts[:'public_key'] if !opts[:'public_key'].nil?\n form_params['redundancy'] = opts[:'redundancy'] if !opts[:'redundancy'].nil?\n form_params['secret_key'] = opts[:'secret_key'] if !opts[:'secret_key'].nil?\n form_params['server_side_encryption_kms_key_id'] = opts[:'server_side_encryption_kms_key_id'] if !opts[:'server_side_encryption_kms_key_id'].nil?\n form_params['server_side_encryption'] = opts[:'server_side_encryption'] if !opts[:'server_side_encryption'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingS3Response'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingS3Api.update_log_aws_s3\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingS3Api#update_log_aws_s3\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def upload_latest_copy\n upload_to_s3(report_files, prefix)\n end",
"def s3_upload( file_name, destination_name )\n #log(\"Uploading #{file_name} to S3 as #{destination_name} ...\")\n #load keys\n json = File.read(S3KEYS)\n ak = JSON.parse(json)\n aws_access_key_id = ak['aws_access_key_id'] \n aws_secret_access_key = ak['aws_secret_access_key']\n\n #establish S3 connection \n s3 = RightAws::S3.new(aws_access_key_id, aws_secret_access_key, {:logger =>Logger.new( File.open( LOG_FILE, 'a' ) )})\n bucket = s3.bucket(IOS_BUILDS_BUCKET)\n #upload file \n file = File.open( file_name )\n bucket.put( destination_name, file ) \nend",
"def update_logger_config(service_setup_data)\n driver = VaultDriver.from_secrets_file service_setup_data[:environment]\n service_name = service_setup_data['deployment']['service_name']\n logger = Syslogger.new(driver)\n if logger.check_record_exists(self)\n puts 'record already exists'\n return\n end\n result, error = logger.add_record_to_rsyslog(self)\n if result\n puts 'syslog updated!'\n else\n puts \"error #{error}\" unless error.nil?\n puts 'not updated'\n end\n end",
"def aws_instance_S3_files_create\n bucket = aws_call('aws_S3_bucket_get', name: Rails.configuration.x.aws['s3_bucket_name'])\n if not aws_call('aws_obj_exists?', obj: bucket)\n log \"AWS: creating S3 Bucket '#{Rails.configuration.x.aws['s3_bucket_name']}'\"\n bucekt = aws_call('aws_S3_bucket_create', name: Rails.configuration.x.aws['s3_bucket_name'])\n end\n\n aws_instance_S3_object_create(bucket, 'exit_status', :exit_status_page, :write)\n aws_instance_S3_object_create(bucket, 'script_log', :script_log_page, :write)\n aws_instance_S3_object_create(bucket, 'bash_history', :bash_history_page, :write)\n\n obj = aws_instance_S3_object_create(bucket, 'com', :com_page, :write)\n log \"AWS: writing to S3Object '#{obj.key}'\"\n aws_call('aws_S3_object_write', obj: obj, data: 'waiting')\n\n obj = aws_instance_S3_object_create(bucket, 'cookbook', :cookbook_url, :read)\n log \"AWS: writing to S3Object '#{obj.key}'\"\n aws_call('aws_S3_object_write', obj: obj, data: self.generate_cookbook)\n end",
"def aws_write_instances\n File.open( aws_instances_json, 'w' ) do |fout|\n aws_dump_instances( fout )\n end\n end",
"def save_version(fdir, hash)\n file_version = \"#{fdir}/version\"\n @s3.head_object bucket: ENV.fetch(\"AWS_BUCKET\"), key: file_version\n rescue Aws::S3::Errors::NotFound\n s3_write file_version, hash\n end",
"def s3_updatefile(filename, filedata)\n s3_deletefile filename\n #AWS::S3::S3Object.store filename, filedata, QBUCKET.to_s, :access => :public_read\n AWS::S3::S3Object.store filename, filedata, IMAGES_BUCKET.to_s, :access => :public_read\n end",
"def upload_to_s3\n log_action('Uploading file to AWS')\n return true if aws_call\n\n raise CsvUploadFailureException, I18n.t('csv.errors.base')\n rescue Aws::S3::Errors::ServiceError => e\n log_error e\n raise CsvUploadFailureException, I18n.t('csv.errors.base')\n end",
"def store_log(bodyJSON)\n sinceEpoch = (Time.now.to_f * 100000).to_i\n item = {\n LogID: bodyJSON[\"LogID\"],\n SinceEpoch: sinceEpoch,\n log: bodyJSON[\"message\"],\n DeviceSession: bodyJSON[\"DeviceSession\"],\n DeviceID: bodyJSON[\"DeviceID\"],\n TeamID: bodyJSON[\"TeamID\"],\n }\n params = {\n table_name: Visibility_DataStore::Visibility_DynamoDB::TABLE_SESSION_LOGS_OSIRIS,\n item: item\n }\n begin\n result = $dynamodb_WRITE_OSIRIS.put_item(params)\n puts 'Added log'\n rescue Aws::DynamoDB::Errors::ServiceError => error\n puts 'Unable to add session log:'\n puts error.message\n end\nend",
"def store(data)\n establish_s3_connection\n bucket = s3keys[\"bucket\"]\n ensure_bucket_exists(bucket)\n \n conn = AWS::S3.new\n obj = conn.buckets[bucket].objects[key]\n obj.write(data)\n end",
"def create_log_aws_s3_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingS3Api.create_log_aws_s3 ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling LoggingS3Api.create_log_aws_s3\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingS3Api.create_log_aws_s3\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"classic\", \"loggly\", \"logplex\", \"blank\"]\n if @api_client.config.client_side_validation && opts[:'message_type'] && !allowable_values.include?(opts[:'message_type'])\n fail ArgumentError, \"invalid value for \\\"message_type\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"zstd\", \"snappy\", \"gzip\"]\n if @api_client.config.client_side_validation && opts[:'compression_codec'] && !allowable_values.include?(opts[:'compression_codec'])\n fail ArgumentError, \"invalid value for \\\"compression_codec\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/s3'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['timestamp_format'] = opts[:'timestamp_format'] if !opts[:'timestamp_format'].nil?\n form_params['compression_codec'] = opts[:'compression_codec'] if !opts[:'compression_codec'].nil?\n form_params['period'] = opts[:'period'] if !opts[:'period'].nil?\n form_params['gzip_level'] = opts[:'gzip_level'] if !opts[:'gzip_level'].nil?\n form_params['access_key'] = opts[:'access_key'] if !opts[:'access_key'].nil?\n form_params['acl'] = opts[:'acl'] if !opts[:'acl'].nil?\n form_params['bucket_name'] = opts[:'bucket_name'] if !opts[:'bucket_name'].nil?\n form_params['domain'] = opts[:'domain'] if !opts[:'domain'].nil?\n form_params['iam_role'] = opts[:'iam_role'] if !opts[:'iam_role'].nil?\n form_params['path'] = opts[:'path'] if !opts[:'path'].nil?\n form_params['public_key'] = opts[:'public_key'] if !opts[:'public_key'].nil?\n form_params['redundancy'] = opts[:'redundancy'] if !opts[:'redundancy'].nil?\n form_params['secret_key'] = opts[:'secret_key'] if !opts[:'secret_key'].nil?\n form_params['server_side_encryption_kms_key_id'] = opts[:'server_side_encryption_kms_key_id'] if !opts[:'server_side_encryption_kms_key_id'].nil?\n form_params['server_side_encryption'] = opts[:'server_side_encryption'] if !opts[:'server_side_encryption'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingS3Response'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingS3Api.create_log_aws_s3\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingS3Api#create_log_aws_s3\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_file_on_s3(file, objects)\n file_path = s3_file_path(file)\n conn = RedmineS3::Connection.conn\n object = objects[file_path]\n\n # get the file modified time, which will stay nil if the file doesn't exist yet\n # we could check if the file exists, but this saves a head request\n s3_mtime = object.last_modified rescue nil \n\n # put it on s3 if the file has been updated or it doesn't exist on s3 yet\n if s3_mtime.nil? || s3_mtime < File.mtime(file)\n fileObj = File.open(file, 'r')\n RedmineS3::Connection.put(file_path, fileObj.read)\n fileObj.close\n\n puts \"Put file \" + File.basename(file)\n else\n puts File.basename(file) + ' is up-to-date on S3'\n end\n end",
"def process_bucket(bucketname,options: {},logger: Logger.new(LOGFILE))\n \n client = Elasticsearch::Client.new(host: options.elasticsearch, log: false)\n indexer = ElasticIndexer.new(client: client, autocommit: 500,logger: logger)\n \n logger.info(\"Scanning #{bucketname}\")\n Aws::S3::Bucket.new(bucketname).objects.each {|objectsummary|\n logger.info(\"got key #{objectsummary.key}\")\n ct_major = \"\"\n ct_minor = \"\"\n parts = /^(.*)\\/(.*)$/.match(objectsummary.object.content_type)\n if parts\n ct_major = parts[1]\n ct_minor = parts[2]\n else\n logger.warn(\"Unable to parse content type '#{objectsummary.object.content_type}'\")\n end\n \n xtn = \"\"\n parts = /\\.([^\\.]+)$/.match(objectsummary.key)\n if parts\n xtn = parts[1]\n end\n \n ap objectsummary.object.metadata\n \n indexer.add_record({\n bucket: bucketname,\n etag: objectsummary.etag,\n path: objectsummary.key,\n last_modified: Date.parse(objectsummary.last_modified.to_s).iso8601,\n owner: {\n display_name: objectsummary.owner.display_name,\n id: objectsummary.owner.id\n },\n size: objectsummary.size,\n content_type: {\n major: ct_major,\n minor: ct_minor,\n raw: objectsummary.object.content_type\n },\n storage_class: objectsummary.storage_class,\n content_encoding: objectsummary.object.content_encoding,\n content_disposition: objectsummary.object.content_disposition,\n extra_data: objectsummary.object.metadata,\n file_extension: xtn\n })\n }\n indexer.commit\nrescue Aws::S3::Errors::PermanentRedirect=>e\n logger.error(e.message)\nend",
"def quick_s3_upload\n end",
"def set_metadata\n s3_obj.metadata[\"filename\"] = file_name\n s3_obj.metadata[\"bindery-pid\"] = persistent_id\n end",
"def update_written(event)\n info \"Update file written to file system: #{File.join(Rails.root, event.payload[:path])} (size: #{event.payload[:size]})\"\n end",
"def write_log_to_kinesis(uuid, text)\n # this assumes that you have already configured your AWS SDK gem\n client = Aws::Kinesis::Client.new\n client.put_record(\n stream_name: $output_stream,\n data: text,\n partition_key: \"PartitionKey\"\n )\nend",
"def upload()\n obj = @mgr.s3res.bucket(@mgr[\"Bucket\"]).object(@s3key)\n @mgr.log(:info,\"Uploading cloudformation stack template #{@stackdef}:#{@filename} to s3://#{@mgr[\"Bucket\"]}/#{@s3key}\")\n template = @mgr.load_template(\"s3\", \"cfnput\")\n @mgr.symbol_keys(template)\n @mgr.resolve_vars(template, :api_template)\n params = template[:api_template]\n params[:body] = @raw\n obj.put(params)\n end",
"def upload(bucket, file); end",
"def lambda_handler(event:, context:)\n client = Aws::S3::Client.new\n from_bucket = ENV['FROM_BUCKET']\n to_bucket = ENV['TO_BUCKET']\n resp = ''\n\n event['Records'].each do |record|\n # key will be url encoded\n key=record['s3']['object']['key']\n\n # Don't process or delete top level folders\n next if is_top_level?(key)\n \n begin \n puts \"Copying #{CGI.unescape(key)} from #{from_bucket} to #{to_bucket}\"\n\n # copy_source needs url encoded\n # key needs to be unescaped or else your key will just have url_encoded\n # characters\n resp = client.copy_object({\n bucket: to_bucket,\n copy_source: \"#{from_bucket}/#{key}\",\n key: CGI.unescape(key)\n })\n puts resp.to_json \n resp = client.delete_object({\n bucket: from_bucket,\n key: CGI.unescape(key)\n })\n puts resp.to_json\n rescue Aws::S3::Errors::NoSuchKey => nsk\n return {statusCode: 404, body: error_json(nsk)}\n rescue => e\n return {statusCode: 500, body: error_json(e)}\n end\n end\n\n { statusCode: 200, body: resp.to_json }\nend",
"def call\n validate\n upload_to_s3\n renamed_filename\n end",
"def upload\n begin\n \n system_guid = params[:event_log_entries][:system_guid]\n raise \"Failed to parse GUID parameter for system\" if system_guid.nil?\n \n system = System.where(:guid => system_guid).first\n system = System.create({:guid => system_guid, :name => (\"System \" + system_guid)}) if system.nil?\n raise \"Failed to create system\" if system.nil?\n \n event_log_entries = params[:event_log_entries][:event_log_entry]\n event_log_entries.each do |entry|\n entry[:system_id] = system.id \n end\n \n rescue Exception => ex \n \n logger.error ex.message\n \n ensure\n\n respond_to do |format|\n if EventLogEntry.create(event_log_entries)\n format.html { render nothing: true, status: :ok }\n else\n format.html { render nothing: true, status: :unprocessable_entity }\n end\n end\n\n end\n \n end",
"def upload_to_s3(info, file_name)\n bucket_name = 'techops-tests'\n\n to_json_file(info, file_name)\n\n s3 = Aws::S3::Resource.new(\n region: 'ap-southeast-2',\n access_key_id: $options[:s3_key],\n secret_access_key: $options[:s3_secret]\n )\n\n file = File.basename file_name\n obj = s3.bucket(bucket_name).object(file)\n\n if obj.upload_file(file)\n puts \"Uploaded #{file} to bucket #{bucket_name}\"\n File.delete(file_name)\n else\n puts \"Could not upload #{file} to bucket #{bucket_name}!\"\n end\nend",
"def log(event)\n log_file.puts(event.to_json)\n end",
"def log_create_for(object)\n object.log(:log_image_created, name: log_name, touch: true)\n end",
"def upload_job_script(file_path, bucket_resource)\n File.open(file_path) do |file|\n bucket_resource.client.put_object({\n body: file,\n bucket: bucket_resource.name,\n key: file_path\n })\n end\n rescue Aws::S3::Errors::S3UploadFailedError => e\n @logger.error(\"S3 could not upload job script: \\n#{e.message}\")\n raise\n end",
"def send_cdn_logs\n authorize! :manage, CdnLog\n @log_data = JSON.load(params[:logdata])\n CdnLog.create(@log_data)\n respond_to do |format|\n format.json{ head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @sample_storage_log.update(sample_storage_log_params)\n format.html { redirect_to @sample_storage_log, notice: 'Sample storage log was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample_storage_log }\n else\n format.html { render :edit }\n format.json { render json: @sample_storage_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def touch_when_logging\n self.log_updated_at = Time.zone.now\n save\n end",
"def update!(**args)\n @log_file = args[:log_file] if args.key?(:log_file)\n @log_position = args[:log_position] if args.key?(:log_position)\n end",
"def set_upload_attributes\n Rails.logger.info \"I am rad\"\n puts \"111111111 set_upload_attributes 11111111\"\n tries ||= 3\n #direct_upload_url_data = DIRECT_UPLOAD_URL_FORMAT.match(direct_upload_url)\n s3 = AWS::S3.new\n direct_upload_head = s3.buckets[Rails.configuration.aws[:bucket]].objects[direct_upload_url].head\n \n self.file_name = direct_upload_data[:filename]\n self.file_type = direct_upload_head.content_type\n self.file_size = direct_upload_head.content_length\n self.upload_updated_at = direct_upload_head.last_modified\n rescue AWS::S3::Errors::NoSuchKey => e\n tries -= 1\n if tries > 0\n sleep(3)\n retry\n else\n false\n end\n end",
"def store_content\n if @content_changed\n @s3_object = pool.default_file_store.put(bucket, storage_location_id, @content)\n set_metadata\n end\n @content_changed=false\n end",
"def tag_and_upload(file, date = Date.current, s3_resource, bucketname,\n storage_class: DEFAULT_STORAGE_CLASS)\n date_tags = Backup.aws_date_tags(date)\n prefix = Backup.s3_backup_bucket_full_prefix(date)\n obj = s3_resource.bucket(bucketname).object(prefix + File.basename(file))\n obj.upload_file(file.path, { tagging: date_tags, storage_class: storage_class })\n end",
"def add_to(s3)\n s3_template = s3.template\n @instance_name = s3.name\n cloud_front_template = template\n s3.template.deep_merge(cloud_front_template)\n end",
"def aws_call\n s3_object = AMAZON_S3_CLIENT.bucket(bucket_name).object(renamed_filename)\n s3_object.upload_file(\n file,\n metadata: file_metadata,\n content_type: 'text/csv'\n )\n end",
"def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @json_payload = args[:json_payload] if args.key?(:json_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @severity = args[:severity] if args.key?(:severity)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @http_request = args[:http_request] if args.key?(:http_request)\n @labels = args[:labels] if args.key?(:labels)\n @operation = args[:operation] if args.key?(:operation)\n end",
"def list_log_aws_s3_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingS3Api.list_log_aws_s3 ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling LoggingS3Api.list_log_aws_s3\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingS3Api.list_log_aws_s3\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/s3'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingS3Response>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingS3Api.list_log_aws_s3\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingS3Api#list_log_aws_s3\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post_create\n response = self.class.post(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end",
"def s3_sync\n bucket, root = ENV['s3_backup_dir'].split('/')\n File.open(Backup.filepath, 'r') do |file|\n s3_client.put_object(bucket: bucket, key: root + Backup.filepath(\"\"), body: file)\n end\n end",
"def upload_file(source,bucket,key_prefix,source_prefix,item_lookup)\n source_prefix = $1 if not source_prefix and source =~ /^(\\.+\\/*)/\n if File.directory?(source)\n upload_files(Dir[\"#{source}/*\"],bucket,key_prefix,source_prefix,item_lookup)\n else\n key = \"#{key_prefix}#{source[(source_prefix || '').length..-1]}\"\n source_size = File.size(source)\n if (last_size = item_lookup[key]) and last_size == source_size\n puts \"SKIP #{source}\"\n else\n if last_size\n print \"UPDATE #{source} => s3://#{bucket.name}/#{key} (#{last_size} => #{source_size})\"\n else\n print \"ADD #{source} => s3://#{bucket.name}/#{key} (#{source_size})\"\n end\n start_time = Time.now\n File.open(source,'rb') do|file|\n bucket.object(key).put(body: file)\n end\n puts \"... #{(Time.now - start_time).to_i}\"\n end\n end\nend",
"def perform_multipart_upload\n s3o = S3Object.find_by(uri: @params[:s3_object_uri]) || S3Object.new\n s3o.uri = @params[:s3_object_uri]\n s3o.file = @params[:file]\n s3o.bucket = handle_bucket\n s3o.key = @params[:key]\n s3o.content_type = @params[:file].content_type\n s3o.size = File.size(s3o.file.path)\n s3o.md5 = Digest::MD5.file(s3o.file.path).hexdigest\n s3o.save!\n\n [:created, :xml, XmlAdapter.uploaded_object(\"#{@request.host}:#{@request.port}\", s3o)]\n end",
"def upload\n\t AWS.config(access_key_id: @access_key, secret_access_key: @access_secret)\n\t s3 = AWS::S3.new \n\t key = File.basename(@zipfile_name)\n\t s3.buckets[@bucket_name].objects[key].write(:file => @zipfile_name)\n\t puts \"Uploading file #{@zipfile_name} to bucket #{@bucket_name}.\"\n\t FileUtils.rm_rf @zipfile_name\n\t end",
"def delete_log_aws_s3_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingS3Api.delete_log_aws_s3 ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_s3_name = opts[:'logging_s3_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling LoggingS3Api.delete_log_aws_s3\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingS3Api.delete_log_aws_s3\"\n end\n # verify the required parameter 'logging_s3_name' is set\n if @api_client.config.client_side_validation && logging_s3_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_s3_name' when calling LoggingS3Api.delete_log_aws_s3\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/s3/{logging_s3_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_s3_name' + '}', CGI.escape(logging_s3_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingS3Api.delete_log_aws_s3\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingS3Api#delete_log_aws_s3\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def write(event)\n ls_event= data2logstash_event(event)\n \n sync do\n logstash_device.write(ls_event.to_json+\"\\n\")\n logstash_device.flush\n end\n self\n end",
"def s3_upload(item)\n filepath = item.zip_file_path\n s3_key = item.s3_path\n s3_path = \"s3://#{s3_bucket}/#{s3_key}\"\n message = \"Uploading: #{filepath} to #{s3_path}\".color(:green)\n message = \"NOOP: #{message}\" if @options[:noop]\n puts message\n return if @options[:noop]\n\n s3.put_object(\n body: IO.read(filepath),\n bucket: s3_bucket,\n key: s3_key,\n )\n end",
"def upload_file(s3client,plaintext_key,filename,bucket)\r\n begin\r\n filebody = File.new(filename)\r\n s3enc = Aws::S3::Encryption::Client.new(encryption_key: plaintext_key,\r\n client: s3client)\r\n res = s3enc.put_object(bucket: bucket,\r\n key: filename,\r\n body: filebody)\r\n rescue Aws::S3::Errors::ServiceError => e\r\n puts \"upload failed: #{e}\"\r\n end\r\nend",
"def settings\n Settings.app_state = params['app_state']\n Settings.reload\n Post.update_aws_s3\n end",
"def post_create_clone\n response = self.class.post(\"/service/#{$service_id}/version/#{$new_dev_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end",
"def old_flush!\n keys, filename = save_keys\n push_to_s3!(filename) if @save_to_s3\n delete!(keys)\n end",
"def update!(**args)\n @audit_logging_settings = args[:audit_logging_settings] if args.key?(:audit_logging_settings)\n @vpc_settings = args[:vpc_settings] if args.key?(:vpc_settings)\n end",
"def s3_write(key, value)\n @s3.put_object(bucket: ENV.fetch(\"AWS_BUCKET\"), key: key, body: value,\n content_type: \"text/plain; charset=utf-8\")\n end",
"def retrieve_log_files_from_s3\n s3_log_reader.retrieve_job_files(record_id)\n end",
"def pre_process_logger_file_upload\n @project = parent\n @data_templates = parent.managed_repository{Voeis::DataStream.all(:type => \"Sensor\")}\n @general_categories = Voeis::GeneralCategoryCV.all\n @sites = parent.managed_repository{Voeis::Site.all}\n end",
"def upload(&block)\n @source.files.each do |key, file|\n object = @target.files.create({\n :key => key,\n :body => file,\n :public => true,\n :cache_control => 'max-age=0' # Disable cache on S3 so that future sharts are visible if folks web browsers.\n })\n block.call file, object\n end\n end",
"def log_update\n (glossary_terms + observations).each do |object|\n object.log(:log_image_updated, name: log_name, touch: false)\n end\n end",
"def prelog\r\n create_file_outputter unless @file_outputter\r\n\r\n # Set up the remote logger here because we need the hostname and port to\r\n # have been loaded, and we'll have done a bit of logging before we load\r\n # those two (due to needing to load the project).\r\n if !@logstash_outputter && SAF.enable_remote_logging &&\r\n SAF.logstash_host && SAF.logstash_port then\r\n @logstash_outputter = log_stash_output = TCPOutputter.new(\r\n \"LogstashOutputter\",\r\n hostname: SAF.logstash_host,\r\n port: SAF.logstash_port)\r\n @logger.outputters << log_stash_output\r\n log_stash_output.formatter = JsonFormatter.new\r\n end\r\n end",
"def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend",
"def create_log_aws_s3(opts = {})\n data, _status_code, _headers = create_log_aws_s3_with_http_info(opts)\n data\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def save(key, value)\n s3_write key, value\n end",
"def log_to_file(filepath, object)\n #puts \"log_to_file #{filepath}\"\n final_path = File.join($boxes_logs_dir, filepath)\n pn = Pathname.new(final_path).cleanpath\n FileUtils.mkdir_p(pn.dirname)\n File.write(File.join(final_path), object)\nend",
"def get_log_aws_s3_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingS3Api.get_log_aws_s3 ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_s3_name = opts[:'logging_s3_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling LoggingS3Api.get_log_aws_s3\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingS3Api.get_log_aws_s3\"\n end\n # verify the required parameter 'logging_s3_name' is set\n if @api_client.config.client_side_validation && logging_s3_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_s3_name' when calling LoggingS3Api.get_log_aws_s3\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/s3/{logging_s3_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_s3_name' + '}', CGI.escape(logging_s3_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingS3Response'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingS3Api.get_log_aws_s3\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingS3Api#get_log_aws_s3\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def store(obj, key = SecureRandom.uuid, try = 1)\n s3_object(key).write(obj.to_json)\n rescue \n (try -= 1) > 0 ? retry : raise\n end",
"def publish!\n release_file = build_role 'release', release\n\n timestamp.replace(release_file)\n\n timestamp_file = build_role 'timestamp', timestamp\n\n bucket.create(release_file.path_with_hash, release_file.body)\n bucket.create(timestamp_file.path, timestamp_file.body)\n end",
"def after # load back file from S3 and process it\n handle_after(Folio::S3::CreateFileJob)\n end",
"def publish\n Milkrun.say \"Publishing changelog for #{variant} package with version_code #{version_code}\"\n\n build = {\n 'build' => version_code,\n 'changelog' => changelog,\n 'variant' => variant\n }\n body = (current_builds.select{|b| b[:build] != version_code} + [build]).to_yaml\n\n object = Milkrun.s3_client.put_object(body: body, bucket: Milkrun.bucket, key: 'builds.yaml')\n\n Milkrun.say \"Changelog published\"\n end",
"def upload_key(s3client,newkeyblob,filename,bucket)\r\n keyfile_name= filename+ \".key\"\r\n newkeyblob64 = Base64.encode64(newkeyblob)\r\n s3client.put_object({\r\n body: newkeyblob64,\r\n key: keyfile_name,\r\n bucket: bucket\r\n })\r\nend",
"def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end",
"def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end",
"def update!(**args)\n @bigquery_table_path = args[:bigquery_table_path] if args.key?(:bigquery_table_path)\n @log_source = args[:log_source] if args.key?(:log_source)\n @log_type = args[:log_type] if args.key?(:log_type)\n end",
"def create_change_log_entry\n @change_log = @backup.create_change_log_entry(params[:action])\n @change_log.save!\n end",
"def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @labels = args[:labels] if args.key?(:labels)\n @entries = args[:entries] if args.key?(:entries)\n end",
"def update!(**args)\n @destination = args[:destination] if args.key?(:destination)\n @logs_path = args[:logs_path] if args.key?(:logs_path)\n end"
] |
[
"0.81232107",
"0.7113302",
"0.66561186",
"0.64058024",
"0.63489264",
"0.6261095",
"0.61307114",
"0.6074673",
"0.59518933",
"0.5686657",
"0.56133616",
"0.556654",
"0.55525357",
"0.5549918",
"0.5539249",
"0.55168897",
"0.5476781",
"0.5461878",
"0.5405351",
"0.54021746",
"0.5399979",
"0.53929913",
"0.5366184",
"0.53632337",
"0.53529763",
"0.53257567",
"0.5322911",
"0.53217655",
"0.5299781",
"0.52994835",
"0.528266",
"0.52714115",
"0.5251592",
"0.52364093",
"0.52355134",
"0.523086",
"0.5228934",
"0.52251583",
"0.5208928",
"0.5205305",
"0.51723015",
"0.5171644",
"0.51687086",
"0.51604635",
"0.5153655",
"0.515089",
"0.51349604",
"0.51290536",
"0.510918",
"0.510683",
"0.51045394",
"0.5097057",
"0.5093279",
"0.50742596",
"0.5073033",
"0.50627255",
"0.50618553",
"0.50605416",
"0.50514746",
"0.5046382",
"0.50383294",
"0.5034427",
"0.50329715",
"0.502963",
"0.5019105",
"0.5018624",
"0.5016729",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.5011908",
"0.50116676",
"0.5000399",
"0.499868",
"0.49958113",
"0.49921843",
"0.49911985",
"0.4989653",
"0.4970814",
"0.4968444",
"0.4966185",
"0.4966185",
"0.49646696",
"0.4960202",
"0.495541",
"0.4952719"
] |
0.8267899
|
0
|
parses the configurable options given with the bootstrap action. All are optional
|
def parseOptions
configurable_options = {
:s3_path_to_presto_server_bin => "s3://support.elasticmapreduce/bootstrap-actions/presto/presto-server-0.78.tar.gz",
:s3_path_to_presto_cli => "s3://support.elasticmapreduce/bootstrap-actions/presto/presto-cli-0.78-executable.jar",
:hive_metastore_port => "9083"
}
opt_parser = OptionParser.new do |opt|
opt.banner = "Usage: install_presto [OPTIONS]"
opt.on("-s",'--s3-path-to-presto-server-bin [S3_PATH_TO_PRESTO_SERVER_BIN]',
"Ex : s3://path/to/bin/presto-server-[version_number].tar.gz") do |s3_path_to_presto_server_bin|
configurable_options[:s3_path_to_presto_server_bin] = s3_path_to_presto_server_bin
end
opt.on("-c",'--s3-path-to-presto-cli [S3_PATH_TO_PRESTO_CLI]',
"Ex : s3://path/to/bin/presto-cli-executible-[version_number].jar") do |s3_path_to_presto_cli|
configurable_options[:s3_path_to_presto_cli] = s3_path_to_presto_cli
end
opt.on("-m",'--s3-path-to-master-config [S3_PATH_TO_MASTER_CONFIG]',
"Ex : s3://path/to/config/dir/master.config )") do |s3_path_to_master_config|
configurable_options[:s3_path_to_master_config] = s3_path_to_master_config
end
opt.on("-w",'--s3-path-to-worker-config [S3_PATH_TO_WORKER_CONFIG]',
" EX : s3://path/to/config/dir/worker.config)") do |s3_path_to_worker_config|
configurable_options[:s3_path_to_worker_config] = s3_path_to_worker_config
end
opt.on("-p",'--hive-metastore-port [HIVE_METASTORE_PORT]',
" Defaults to 9083)") do |hive_metastore_port|
configurable_options[:hive_metastore_port] = hive_metastore_port
end
opt.on('-h', '--help', 'Display this message') do
puts opt
exit
end
end
opt_parser.parse!
return configurable_options;
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_options! #:nodoc:\n @options = { :recipes => [], :actions => [],\n :vars => {}, :pre_vars => {},\n :sysconf => default_sysconf, :dotfile => default_dotfile }\n\n if args.empty?\n warn \"Please specify at least one action to execute.\"\n warn option_parser\n exit\n end\n\n option_parser.parse!(args)\n\n coerce_variable_types!\n\n # if no verbosity has been specified, be verbose\n options[:verbose] = 3 if !options.has_key?(:verbose)\n\n look_for_default_recipe_file! if options[:default_config] || options[:recipes].empty?\n extract_environment_variables!\n\n options[:actions].concat(args)\n\n password = options.has_key?(:password)\n options[:password] = Proc.new { self.class.password_prompt }\n options[:password] = options[:password].call if password\n end",
"def generate_options(action, xml, extra_params={})\n opts = extra_params || {}\n\n if EC2[action][:args]\n EC2[action][:args].each {|k,v|\n str = ec2_value(xml, k, &v[:proc])\n if str\n tmp = opts\n last_key = nil\n v[:opt].split('/').each { |key|\n k = key.to_sym\n tmp = tmp[last_key] if last_key\n tmp[k] = {}\n last_key = k\n }\n tmp[last_key] = str\n end\n }\n end\n\n opts\n end",
"def bootstrap_options\n @bootstrap_options ||= begin\n opts = {}\n\n opts[:ssh_user] = config[:ssh_user] || 'root'\n opts[:ssh_password] = config[:ssh_password]\n if opts[:ssh_password].nil?\n opts[:identity_file] = config[:identity_file] || hazetug_identity\n end\n\n template = options[:opts][:bootstrap] || 'bootstrap.erb'\n validation = config[:chef_validation_key] || 'validation.pem'\n\n opts[:validation_key] = File.expand_path(validation)\n opts[:template_file] = File.expand_path(template)\n opts[:environment] = config[:chef_environment]\n opts[:tags] = config[:tags]\n opts[:host_key_verify] = config[:host_key_verify] || false\n opts[:chef_server_url] = config[:chef_server_url]\n opts\n end\n end",
"def configure_args\n @args = {}\n OptionParser.new do |opt|\n opt.on('-c', '--configure STRING', String) { |arg| push_arg_if_present( \"configure\", arg, \"boolean\") }\n opt.on('-d', '--deploy STRING', String) { |arg| push_arg_if_present( \"deploy\", arg, \"boolean\") }\n opt.on('-on', '--org_name STRING', String) { |arg| push_arg_if_present( \"org_name\", arg, \"string\") }\n opt.on('-od', '--org_desc STRING', String) { |arg| push_arg_if_present( \"org_desc\", arg, \"string\") }\n opt.on('-cd', '--contact_desc STRING', String) { |arg| push_arg_if_present( \"contact_desc\", arg, \"string\") }\n opt.on('-odo', '--org_domain STRING', String) { |arg| push_arg_if_present( \"org_domain\", arg, \"string\") }\n opt.on('-oe', '--org_email STRING', String) { |arg| push_arg_if_present( \"org_email\", arg, \"string\") }\n opt.on('-op', '--org_phone STRING', String) { |arg| push_arg_if_present( \"org_phone\", arg, \"string\") }\n opt.on('-of', '--org_facebook STRING', String) { |arg| push_arg_if_present( \"org_facebook\", arg, \"string\") }\n opt.on('-ot', '--org_twitter STRING', String) { |arg| push_arg_if_present( \"org_twitter\", arg, \"string\") }\n opt.on('-oi', '--org_instagram STRING', String) { |arg| push_arg_if_present( \"org_instagram\", arg, \"string\") }\n opt.on('-ow', '--org_website STRING', String) { |arg| push_arg_if_present( \"org_website\", arg, \"string\") }\n opt.on('-cp', '--color_primary STRING', String) { |arg| push_arg_if_present( \"color_primary\", arg, \"string\") }\n opt.on('-cs', '--color_secondary STRING', String) { |arg| push_arg_if_present( \"color_secondary\", arg, \"string\") }\n opt.on('-l', '--logo STRING', String) { |arg| push_arg_if_present( \"logo\", arg, \"string\") }\n opt.on('-lo', '--logo_option STRING', String) { |arg| push_arg_if_present( \"logo_option\", arg, \"string\") }\n opt.on('-su', '--smtp_username STRING', String) { |arg| push_arg_if_present( \"smtp_username\", arg, \"string\") }\n opt.on('-sp', '--smtp_password STRING', String) { |arg| push_arg_if_present( \"smtp_password\", arg, \"string\") }\n opt.on('-sa', '--smtp_address STRING', String) { |arg| push_arg_if_present( \"smtp_address\", arg, \"string\") }\n opt.on('-so', '--smtp_port STRING', String) { |arg| push_arg_if_present( \"smtp_port\", arg, \"integer\") }\n opt.on('-as', '--account_sid STRING', String) { |arg| push_arg_if_present( \"account_sid\", arg, \"string\") }\n opt.on('-at', '--auth_token STRING', String) { |arg| push_arg_if_present( \"auth_token\", arg, \"string\") }\n opt.on('-ae', '--admin_email STRING', String) { |arg| push_arg_if_present( \"admin_email\", arg, \"string\") }\n opt.on('-ap', '--admin_password STRING', String) { |arg| push_arg_if_present( \"admin_password\", arg, \"string\") }\n opt.on('-af', '--admin_first_name STRING', String) { |arg| push_arg_if_present( \"admin_first_name\", arg, \"string\") }\n opt.on('-al', '--admin_last_name STRING', String) { |arg| push_arg_if_present( \"admin_last_name\", arg, \"string\") }\n opt.on('-hc', '--heroku_command STRING', String) { |arg| push_arg_if_present( \"heroku_command\", arg, \"string\") }\n opt.on('-ha', '--heroku_app_name STRING', String) { |arg| push_arg_if_present( \"heroku_app_name\", arg, \"string\") }\n opt.on('-sn', '--form_name STRING', String) { |arg| push_arg_if_present( \"form_name\", arg, \"string\") }\n opt.on('-f', '--faq STRING', String) { |arg| push_arg_if_present( \"faq\", arg, \"yml\") }\n opt.on('-s', '--form STRING', String) { |arg| push_arg_if_present( \"form\", arg, \"yml\") }\n end.parse!\nend",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def parse_options; end",
"def parse_options; end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def config(action, *args); end",
"def configure_settings(bootstrap_options)\r\n config = {\r\n environment: bootstrap_options['environment'],\r\n chef_extension_root: @chef_extension_root,\r\n user_client_rb: @client_rb,\r\n log_location: @azure_plugin_log_location,\r\n secret: @secret,\r\n first_boot_attributes: @first_boot_attributes\r\n }\r\n\r\n config[:chef_node_name] = bootstrap_options['chef_node_name'] if bootstrap_options['chef_node_name']\r\n config[:chef_server_url] = bootstrap_options['chef_server_url'] if bootstrap_options['chef_server_url']\r\n config[:validation_client_name] = bootstrap_options['validation_client_name'] if bootstrap_options['validation_client_name']\r\n config[:node_verify_api_cert] = bootstrap_options['node_verify_api_cert'] if bootstrap_options['node_verify_api_cert']\r\n config[:node_ssl_verify_mode] = bootstrap_options['node_ssl_verify_mode'] if bootstrap_options['node_ssl_verify_mode']\r\n\r\n config\r\n end",
"def opt_parse # rubocop:disable Metrics/AbcSize\n case @options[:action]\n when 'create'\n build_looper('instances')\n when 'list'\n formatter(list)\n when 'delete'\n puts delete\n when 'get_ip'\n BmcAuthenticate.new(@options)\n attrcheck = { 'instance' => @options[:inst] }\n @validate.validate(@options, attrcheck)\n inst_details = AttrFinder.new(@instanceparameters)\n inst_details.options = @options\n inst_details.validate = @validate\n inst_ocid = inst_details.instance\n ips = list_instance_ip(@options[:compartment], inst_ocid)\n puts 'The private IP is ' + ips.at(0) + ' the public ip is ' + ips.at(1)\n when 'InstanceConsoleHistory'\n chist = InstanceConsoleHistory.new\n chist.options = @options\n chist.validate = @validate\n formatter(chist.list) \n else\n 'you have entered an incorrect value, correct values are get_ip, create, list, list_image, delete'\n end \n end",
"def extractable_options?; end",
"def parse_options\n @options = {\n :environment => 'production',\n :config_path => ENV['CLOUD_CROWD_CONFIG'] || '.',\n :daemonize => false\n }\n @option_parser = OptionParser.new do |opts|\n opts.on('-c', '--config PATH', 'path to configuration directory') do |conf_path|\n @options[:config_path] = conf_path\n end\n opts.on('-p', '--port PORT', 'port number for server (central or node)') do |port_num|\n @options[:port] = port_num\n end\n opts.on('-e', '--environment ENV', 'server environment (defaults to production)') do |env|\n @options[:environment] = env\n end\n opts.on('-d', '--daemonize', 'run as a background daemon') do |daemonize|\n @options[:daemonize] = daemonize\n end\n opts.on('--days NUM_DAYS', 'grace period before cleanup (7 by default)') do |days|\n @options[:days] = days.to_i if days.match(/\\A\\d+\\Z/)\n end\n opts.on_tail('-v', '--version', 'show version') do\n require \"#{CC_ROOT}/lib/cloud-crowd\"\n puts \"CloudCrowd version #{VERSION}\"\n exit\n end\n end\n @option_parser.banner = BANNER\n @option_parser.parse!(ARGV)\n end",
"def extract_custom_settings!(options)\n @heading = options.key?(:heading) ? options.delete(:heading) : default_heading\n @sortable_column = options.delete(:sortable)\n @sortable_start = options.delete(:sortable_start) || 0\n @new_record = options.key?(:new_record) ? options.delete(:new_record) : true\n @destroy_option = options.delete(:allow_destroy)\n options\n end",
"def get_options; end",
"def initialize options_to_parse_by_name = {},\n option_default_values = {},\n stop_on_unknown = false,\n disable_required_check = false\n @stop_on_unknown = stop_on_unknown\n @disable_required_check = disable_required_check\n\n options = options_to_parse_by_name.values\n super( options )\n\n # Add defaults\n option_default_values.each do |option_name, value|\n @assigns[ option_name.to_s ] = value\n\n @non_assigned_required.delete \\\n options_to_parse_by_name[ option_name ]\n end\n\n @shorts = {}\n @switches = {}\n @extra = []\n\n options.each do |option|\n @switches[option.switch_name] = option\n\n option.aliases.each do |short|\n name = short.to_s.sub(/^(?!\\-)/, \"-\")\n @shorts[name] ||= option.switch_name\n end\n end\n end",
"def parse_options()\n\n options = {}\n\n ARGV.each_index do |index|\n case $*[index]\n when '-m' then options[:auto_connect] = false\n when '-v' then options[:verbose] = true\n when '-q' then options[:verbose] = false\n when '-t' then options[:log_truncate] = true\n when '-r' then options[:log_response] = false\n else\n ::Twiga.say_warn \"unknown option: #{arg}\"\n end # case\n\n $*.delete_at(index) # remove from command line\n\n end # do each cmd line arg\n \n return Kinokero::Cloudprint::DEFAULT_OPTIONS.merge(options)\n\n end",
"def options() end",
"def option_parser #:nodoc:\n @option_parser ||= OptionParser.new do |opts|\n opts.banner = \"Usage: #{File.basename($0)} [options] action ...\"\n\n opts.on(\"-d\", \"--debug\",\n \"Prompts before each remote command execution.\"\n ) { |value| options[:debug] = true }\n\n opts.on(\"-e\", \"--explain TASK\",\n \"Displays help (if available) for the task.\"\n ) { |value| options[:explain] = value }\n\n opts.on(\"-F\", \"--default-config\",\n \"Always use default config, even with -f.\"\n ) { options[:default_config] = true }\n\n opts.on(\"-f\", \"--file FILE\",\n \"A recipe file to load. May be given more than once.\"\n ) { |value| options[:recipes] << value }\n\n opts.on(\"-H\", \"--long-help\", \"Explain these options and environment variables.\") do\n long_help\n exit\n end\n\n opts.on(\"-h\", \"--help\", \"Display this help message.\") do\n puts opts\n exit\n end\n\n opts.on(\"-n\", \"--dry-run\",\n \"Prints out commands without running them.\"\n ) { |value| options[:dry_run] = true }\n\n opts.on(\"-p\", \"--password\",\n \"Immediately prompt for the password.\"\n ) { options[:password] = nil }\n\n opts.on(\"-q\", \"--quiet\",\n \"Make the output as quiet as possible.\"\n ) { options[:verbose] = 0 }\n\n opts.on(\"-S\", \"--set-before NAME=VALUE\",\n \"Set a variable before the recipes are loaded.\"\n ) do |pair|\n name, value = pair.split(/=/, 2)\n options[:pre_vars][name.to_sym] = value\n end\n\n opts.on(\"-s\", \"--set NAME=VALUE\",\n \"Set a variable after the recipes are loaded.\"\n ) do |pair|\n name, value = pair.split(/=/, 2)\n options[:vars][name.to_sym] = value\n end\n\n opts.on(\"-T\", \"--tasks [PATTERN]\",\n \"List all tasks (matching optional PATTERN) in the loaded recipe files.\"\n ) do |value|\n options[:tasks] = if value\n value\n else\n true\n end\n options[:verbose] ||= 0\n end\n\n opts.on(\"-t\", \"--tool\",\n \"Abbreviates the output of -T for tool integration.\"\n ) { options[:tool] = true }\n\n opts.on(\"-V\", \"--version\",\n \"Display the Capistrano version, and exit.\"\n ) do\n require 'capistrano/version'\n puts \"Capistrano v#{Capistrano::Version::STRING}\"\n exit\n end\n\n opts.on(\"-v\", \"--verbose\",\n \"Be more verbose. May be given more than once.\"\n ) do\n options[:verbose] ||= 0\n options[:verbose] += 1\n end\n\n opts.on(\"-X\", \"--skip-system-config\",\n \"Don't load the system config file (capistrano.conf)\"\n ) { options.delete(:sysconf) }\n\n opts.on(\"-x\", \"--skip-user-config\",\n \"Don't load the user config file (.caprc)\"\n ) { options.delete(:dotfile) }\n end\n end",
"def prep_opts( params )\n need_to_split = %w(exclude_cookies exclude_vectors exclude include)\n\n cparams = {}\n params.each_pair {\n |name, value|\n\n next if %w(_csrf modules plugins).include?( name ) || ( value.is_a?( String ) && value.empty?)\n\n value = true if value == 'on'\n\n if name == 'cookiejar' && value[:tempfile]\n cparams['cookies'] = {}\n cparams['cookie_string'] = ''\n Arachni::Element::Cookie.from_file( '', value[:tempfile] ).each do |c|\n cparams['cookies'][c.name] = c.value\n cparams['cookie_string'] += c.to_s + ';'\n end\n elsif name == 'extend_paths' && !value.is_a?( Array ) && value[:tempfile]\n cparams['extend_paths'] = Arachni::Options.instance.paths_from_file( value[:tempfile] )\n elsif name == 'restrict_paths' && !value.is_a?( Array ) && value[:tempfile]\n cparams['restrict_paths'] = Arachni::Options.instance.paths_from_file( value[:tempfile] )\n elsif need_to_split.include?( name ) && value.is_a?( String )\n cparams[name] = value.split( \"\\r\\n\" )\n\n elsif name == 'redundant' && value.is_a?( String )\n cparams[name] = {}\n value.split( \"\\r\\n\" ).each {\n |rule|\n regexp, counter = rule.split( ':', 2 )\n cparams[name][regexp] = counter\n }\n elsif name == 'custom_headers' && value.is_a?( String )\n cparams[name] = {}\n value.split( \"\\r\\n\" ).each {\n |line|\n header, val = line.to_s.split( /=/, 2 )\n cparams[name][header] = val\n }\n else\n cparams[name] = to_i( value )\n end\n }\n\n if !cparams['audit_links'] && !cparams['audit_forms'] &&\n !cparams['audit_cookies'] && !cparams['audit_headers']\n\n cparams['audit_links'] = true\n cparams['audit_forms'] = true\n cparams['audit_cookies'] = true\n end\n\n return cparams\n end",
"def options\n self.read_attribute(:options).split(\"\\n\") unless self.read_attribute(:options).nil?\n end",
"def common_options(opts); end",
"def configuration_from_options(options); end",
"def setup_options\n parser = OptionParser.new do |o|\n o.banner = 'Usage: bundle exec qpush-server [options]'\n\n o.on('-c', '--config PATH', 'Load PATH for config file') do |arg|\n load(arg)\n Server.log.info(\"* Server config: #{arg}\")\n end\n\n o.on('-h', '--help', 'Prints this help') { puts o && exit }\n end\n parser.parse!(@argv)\n end",
"def process_options\n if @options.machine_names == nil\n load_machine_list\n end\n end",
"def opts\n @opts ||= OptionParser.new do |opts|\n opts.program_name = File.basename($PROGRAM_NAME)\n opts.banner = \"Usage: #{opts.program_name}\"\n\n opts.separator ''\n opts.separator 'Actions:'\n\n names = @actions.map(&:name)\n padding = names.map(&:size).max\n @actions.each do |action|\n opts.separator \" #{action.name.ljust(padding)} #{action.description}\\n\"\n end\n\n opts.separator ''\n opts.separator 'Tasks:'\n\n @processor_class.tasks.each do |task_name|\n opts.separator \" #{task_name}\"\n end\n\n opts.separator ''\n opts.separator 'Specific options:'\n opts.on('-a', '--action ACTION', names, 'Select an action to run (you may give this switch multiple times)', \" (#{names.join(', ')})\") do |v|\n options.actions << v\n end\n opts.on('-t', '--task TASK', @processor_class.tasks, 'Select a scraping task to run (you may give this switch multiple times)', \" (#{@processor_class.tasks.join(', ')})\") do |v|\n options.tasks << v\n end\n opts.on('-o', '--output_dir PATH', 'The directory or Redis address (e.g. redis://localhost:6379/0) in which to dump JSON documents') do |v|\n options.output_dir = v\n end\n opts.on('--pipelined', 'Dump JSON documents all at once') do |v|\n options.pipelined = v\n end\n opts.on('-c', '--cache_dir PATH', 'The directory or Memcached address (e.g. memcached://localhost:11211) in which to cache HTTP requests') do |v|\n options.cache_dir = v\n end\n opts.on('--no-cache', 'Disable HTTP request caching') do |v|\n options.cache_dir = nil\n end\n opts.on('-e', '--expires_in SECONDS', \"The cache's expiration time in seconds\") do |v|\n options.expires_in = v\n end\n opts.on('--value_max_bytes BYTES', \"The maximum Memcached item size\") do |v|\n options.value_max_bytes = v\n end\n opts.on('--memcached_username USERNAME', \"The Memcached username\") do |v|\n options.memcached_username = v\n end\n opts.on('--memcached_password USERNAME', \"The Memcached password\") do |v|\n options.memcached_password = v\n end\n opts.on('-d', '--database_url', 'The database URL (e.g. mongodb://USER:PASSWORD@localhost:27017/pupa or postgres://USER:PASSWORD@localhost:5432/pupa') do |v|\n options.database_url = v\n end\n opts.on('--[no-]validate', 'Validate JSON documents') do |v|\n options.validate = v\n end\n opts.on('-v', '--verbose', 'Show all messages') do\n options.level = 'DEBUG'\n end\n opts.on('-q', '--quiet', 'Show only warning and error messages') do\n options.level = 'WARN'\n end\n opts.on('-s', '--silent', 'Show no messages') do\n options.level = 'UNKNOWN'\n end\n opts.on('-n', '--dry-run', 'Show the plan without running any actions') do\n options.dry_run = true\n end\n\n opts.separator ''\n opts.separator 'Common options:'\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n exit\n end\n opts.on_tail('-v', '--version', 'Show version') do\n puts Pupa::VERSION\n exit\n end\n end\n end",
"def create_application_options\n option_separator\n option_separator 'Application specific options:'\n end",
"def configure_and_run(params = [])\n config_file = Configuration::DEFAULT_CONFIG_FILE_NAME\n tmp_config = Configuration.new\n action_wizard = false\n\n parser = OptionParser.new do |opts|\n opts.banner = if ENV['OCRA_EXECUTABLE']\n \"Usage: #{ENV['OCRA_EXECUTABLE'].gsub(\"#{Dir.pwd}/\".gsub('/', '\\\\'), '')} [options]\"\n else\n \"Usage: #{Gem.ruby} #{$PROGRAM_NAME} [options]\"\n end\n\n opts.on('-c', '--config CONFIG_FILE_NAME', 'Specify custom configuration file,'\\\n \" instead of #{Configuration::DEFAULT_CONFIG_FILE_NAME}.\") do |file_name|\n config_file = file_name\n end\n\n opts.on('-r', '--register FILE', 'Register a custom plugin, e.g. your own Datasource implementation') do |plugin|\n require plugin\n end\n\n opts.on('-d', '--debug LEVEL', 'Specify detail level: FATAL, ERROR, WARN, INFO, DEBUG.') do |level|\n tmp_config.set_param('grafana-reporter:debug-level', level)\n end\n\n opts.on('-o', '--output FILE', 'Output filename if only a single file is rendered') do |file|\n tmp_config.set_param('to_file', file)\n end\n\n opts.on('-s', '--set VARIABLE,VALUE', Array, 'Set a variable value, which will be passed to the '\\\n 'rendering') do |list|\n raise ParameterValueError, list.length unless list.length == 2\n\n tmp_config.set_param(\"default-document-attributes:#{list[0]}\", list[1])\n end\n\n opts.on('--ssl-cert FILE', 'Manually specify a SSL cert file for HTTPS connection to grafana. Only '\\\n 'needed if not working properly otherwise.') do |file|\n if File.file?(file)\n tmp_config.set_param('grafana-reporter:ssl-cert', file)\n else\n config.logger.warn(\"SSL certificate file #{file} does not exist. Setting will be ignored.\")\n end\n end\n\n opts.on('--test GRAFANA_INSTANCE', 'test current configuration against given GRAFANA_INSTANCE') do |instance|\n tmp_config.set_param('grafana-reporter:run-mode', 'test')\n tmp_config.set_param('grafana-reporter:test-instance', instance)\n end\n\n opts.on('-t', '--template TEMPLATE', 'Render a single ASCIIDOC template to PDF and exit') do |template|\n tmp_config.set_param('grafana-reporter:run-mode', 'single-render')\n tmp_config.set_param('default-document-attributes:var-template', template)\n end\n\n opts.on('-w', '--wizard', 'Configuration wizard to prepare environment for the reporter.') do\n action_wizard = true\n end\n\n opts.on('-v', '--version', 'Version information') do\n puts GRAFANA_REPORTER_VERSION.join('.')\n return -1\n end\n\n opts.on('-h', '--help', 'Show this message') do\n puts opts\n return -1\n end\n end\n\n begin\n parser.parse!(params)\n return ConsoleConfigurationWizard.new.start_wizard(config_file, tmp_config) if action_wizard\n rescue ApplicationError => e\n puts e.message\n return -1\n end\n\n # abort if config file does not exist\n unless File.file?(config_file)\n puts \"Config file '#{config_file}' does not exist. Consider calling the configuration wizard\"\\\n ' with option \\'-w\\' or use \\'-h\\' to see help message. Aborting.'\n return -1\n end\n\n # merge command line configuration with read config file\n @config.load_config_from_file(config_file)\n @config.merge!(tmp_config)\n\n run\n end",
"def config\n if @url.blank? && @items.empty?\n options = human_name\n else\n options = @options.merge(:text => human_name)\n options.merge!(:menu => @items.collect(&:config)) if @items.size > 0\n options.merge!(:handler => \"function(){ Backend.app.load('#{url}') }\".to_l) if !@url.blank?\n end\n options\n end",
"def extractable_options?; true end",
"def configure_with_args(args)\n args.select { |k,v| DEFAULT_CONFIGURATION_OPTIONS.keys.include?(k) }.each do |key,val|\n instance_variable_set \"@#{key.to_s}\", val\n end\n end",
"def configure_with_args(args)\n args.select { |k,v| DEFAULT_CONFIGURATION_OPTIONS.keys.include?(k) }.each do |key,val|\n instance_variable_set \"@#{key.to_s}\", val\n end\n end",
"def options; [] end",
"def parsed_options\n config\n end",
"def post_option_parser(configuration)\n # we could test or manipulate input values here\n if ARGV.length >= 1\n configuration[:command] = ARGV.shift \n end\n\n raise \"Action must be say_goodbye or get_towel\" unless [\"say_goodbye\", \"get_towel\"].include?(configuration[:command])\n end",
"def parse_options(args)\n @options = OpenStruct.new\n @options.emacs = !args.delete('--emacs').nil?\n @options.wrap = !args.delete('--wrap').nil?\n @options.inner = !args.delete('--inner').nil?\n @options.jruby = !args.delete('--jruby').nil?\n @options.nojruby = !args.delete('--nojruby').nil?\n @options.action = args[0] || nil\n @options.path = args[1] || File.basename(Dir.pwd + '.rb')\n @options.args = args[2..-1] || []\n end",
"def parse\n set_default_options\n lookup_and_execute_require_option(args)\n parse_options\n set_contents_template_from_args unless args.empty?\n check_mandatory! if options.check_mandatory_arguments\n options\n end",
"def gather_options\n @_options\n end",
"def yardopts\n IO.read(options_file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def options(opt); end",
"def configure options\n options.map do |key, value|\n types = {String => 'string', Fixnum => 'int', TrueClass => 'bool',\n FalseClass => 'bool', Float => 'float', Array => 'list --list-type=string'}\n type = types[value.class]\n raise 'Invalid type for configure' unless type\n value = value.to_json if value.is_a?(Array)\n value = %(\"#{value}\") if type == 'string'\n check = \"gconftool-2 --get \\\"#{key}\\\" | grep #{value} #{echo_result}\"\n Command.new(\"gconftool-2 --set \\\"#{key}\\\" --type #{type} #{value}\", check)\n end\n end",
"def options(opt); end",
"def load_command_line_options\n cmd_line_options.each do |key, value|\n ::Webby.site.__send__(\"#{key}=\", value)\n end\n end",
"def search_opts(keys)\n val = Rake.application.options.send(keys[0].downcase.to_sym)\n return parse_opt(val) if !val.nil?\n #\n keys.each do |k|\n val = ENV[k.upcase]\n return parse_opt(val) if !val.nil?\n end\n #\n return nil if !@yaml\n keys.each do |k|\n val = @yaml[k.upcase]\n return val if !val.nil?\n end\n nil\n end",
"def search_opts(keys)\n val = Rake.application.options.send(keys[0].downcase.to_sym)\n return parse_opt(val) if !val.nil?\n #\n keys.each do |k|\n val = ENV[k.upcase]\n return parse_opt(val) if !val.nil?\n end\n #\n return nil if !@yaml\n keys.each do |k|\n val = @yaml[k.upcase]\n return val if !val.nil?\n end\n nil\n end",
"def parse_options(argv=ARGV)\n argv = argv.dup\n argv = guess_and_switchify_arguments(argv)\n @opt_parser = OptionParser.new do |opts| \n # Set the banner\n opts.banner = banner \n \n # Create new options\n options_arguments.each do |opt_key, opt_val| \n opt_args = build_option_arguments(opt_val)\n \n opt_method = case opt_val[:on]\n when :on\n :on\n when :tail\n :on_tail\n when :head\n :on_head\n else\n raise ArgumentError, \"You must pass :on, :tail, or :head to :on\"\n end\n\n parse_block = \\\n Proc.new() do |*c|\n if c.empty? || c == [nil]\n c = true\n config[opt_key] = (opt_val[:proc] && opt_val[:proc].call(c)) || c\n else\n c = c.first\n config[opt_key] = (opt_val[:proc] && opt_val[:proc].call(c)) || c\n end\n puts filter_options_summary(opts.to_s) if opt_val[:show_options]\n exit opt_val[:exit] if opt_val[:exit]\n end\n\n # opts.send(:on, *[opt_method,*opt_args, parse_block])\n opt_args.unshift opt_method\n opt_args << parse_block\n opts.send(*opt_args)\n end\n end\n\n @opt_parser.summary_indent = @summary_indent if @summary_indent\n @opt_parser.summary_width = @summary_width if @summary_width\n\n @opt_parser.parse!(argv)\n @filtered_argv = argv\n\n # Deal with any required values\n fail = nil\n options_arguments.each do |opt_key, opt_value|\n next unless config[opt_key]\n # next if config[opt_key] == opt_value[:default]\n\n reqargs = []\n case opt_value[:requires]\n when nil\n when Proc\n begin\n result = opt_value[:requires].call(config)\n rescue \n reqargs << $!.message\n end\n reqargs << result if result.class == String\n when Array,Symbol\n required_opts = [opt_value[:requires]].flatten\n required_opts.each do |required_opt|\n reqargs << required_opt.to_sym unless config[required_opt.to_sym]\n end\n\n reqargs.map! do |opt|\n arg = (options_arguments[opt][:long_strip] || options_arguments[opt][:short_strip]).dup\n arg.gsub!(/^-+/,\"\") if arguments.keys.include?(opt)\n arg\n end\n end\n unless reqargs.empty?\n fail = true\n opt = (opt_value[:long_strip] || opt_value[:short_strip]).dup\n opt.gsub!(/^-+/,\"\") if arguments.keys.include?(opt_key)\n puts \"You must supply #{reqargs.join(\", \")} with #{opt}!\"\n end\n\n end\n if fail\n puts filter_options_summary(@opt_parser.to_s)\n exit 2\n end\n\n argv\n end",
"def parse_opts\n if parse_argv\n apply_options\n true\n end\n end",
"def create_standard_options\n option_separator\n option_separator 'Standard options:'\n option_config_name\n option_logging\n end",
"def options(opt)\n end",
"def _process_options(options); end",
"def _process_options(options); end",
"def options\n params[:siringa_args]\n end",
"def options_for(action)\n action = action == :new_action ? [action] : \"#{action}\".split('_').map(&:to_sym)\n options = self.class.send(action.first)\n options = options.send(action.last == :fails ? :fails : :success) if ResourceController::FAILABLE_ACTIONS.include? action.first\n \n options\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def option_parser options\n CooCoo::OptionParser.new do |o|\n o.banner = \"The CIFAR data set\"\n \n o.on('--images-path PATH') do |path|\n options.images_paths << path\n end\n\n o.on('--labels-path PATH') do |path|\n options.labels_path = path\n end\n\n o.on('--translations INTEGER') do |n|\n options.translations = n.to_i\n end\n\n o.on('--translation-amount DEGREE') do |n|\n options.translation_amount = n.to_i\n end\n\n o.on('--rotations INTEGER') do |n|\n options.rotations = n.to_i\n end\n\n o.on('--rotation-amount DEGREE') do |n|\n options.rotation_amount = n.to_i\n end\n end\n end",
"def process_options(_options)\n if (command.default_to_help and _options.empty?) or _options[:help]\n usage\n exit(0)\n end\n self.class.options.each do |name,descriptor|\n short, required, default, type = descriptor.values_at(:short,:required,:default,:type)\n _options[name] ||= (_options[short]||default)\n _options.delete(short)\n if required and not _options[name]\n error(\"Missing required option --#{name}\")\n end\n end\n # TODO: add type conversion\n return _options\n end",
"def options(*args, &block); end",
"def init_options( opts )\n options = default_options.merge( opts ) \n @environment = options[:environment]\n @perf_threshold = options[:perf_threshold]\n @moleable = options[:moleable]\n @app_name = options[:app_name]\n @user_key = options[:user_key]\n @store = options[:store]\n @excluded_paths = options[:excluded_paths]\n end",
"def optParse\n OptionParser.new do |o|\n o.on('-v', 'Be more verbose.') { |i|\n self[:verbose] += 1\n }\n o.on('-V', '--version', 'Show version & exit.') { |i|\n puts Meta::VERSION\n exit EX_OK\n }\n o.on('--config NAME',\n \"Set a config name or file\",\n \"(default is #{@conf[:config_name]}).\") {|arg|\n @conf[:config_name] = arg\n }\n o.on('--config-dirs', 'Show possible config locations.') {\n mark = false\n @conf[:config_dirs].each { |idx|\n f = Pathname(idx) + @conf[:config_name]\n if File.file?(f) && !mark\n puts \"* #{f}\"\n mark = true\n else\n puts \" #{f}\"\n end\n }\n exit EX_OK\n }\n\n yield o if block_given?\n o.banner = @conf[:banner]\n\n env = nil\n env = ENV[@conf[:config_env]].shellsplit if ENV.key?(@conf[:config_env])\n\n begin\n [env, ARGV].each { |i| o.parse!(i) if i }\n rescue\n CliUtils.errx EX_USAGE, $!.to_s\n end\n end\n end",
"def extract_options!\n option_parser.order!(args)\n end",
"def configs_cascade\n [\n @opts, \n @opts_config, \n @env_config, \n @additional_config, \n @local_config, \n @global_config, \n @defaults\n ]\n end",
"def options\n config.options\n end",
"def parse_ansible!\n logger.debug \"Parsing Ansible options...\",\n argv: @argv.dup\n \n @ansible = @role.default_ansible_options.clone\n \n reg_exs = [\n /\\A\\-\\-ANSIBLE[\\-\\_]/,\n /\\A\\-\\-\\-/,\n ]\n \n @argv.reject! {|shellword|\n if re = reg_exs.find {|re| re =~ shellword}\n name = shellword.sub re, ''\n \n value = true\n \n if name.include? '='\n name, value = name.split('=', 2)\n end\n \n @ansible[name] = value\n \n true\n end\n }\n \n nil\n end",
"def config\n options = @options.merge(:text => human_name)\n options.merge!(:menu => @menus.collect(&:config)) if @menus.size > 0\n options.merge!(:handler => \"function(){ Backend.app.load('#{url_for(@url.merge(:only_path => true))}') }\".to_l) if @url\n options\n end",
"def parse_options()\n options = { :threshold => 50,\n :verbose => false,\n :remotes => false,\n :status => false}\n options[:remotes] = ARGV[0] == 'remotes'\n options[:status] = ARGV[0] == 'status'\n\n\n optparse = OptionParser.new do|opts|\n opts.banner = $banner\n opts.on( '-t N', '--threshold VAL', Integer, \"If a remote has <= theshold dirs, they will be listed. -1 to print all. Default #{options[:threshold]}\" ) do |value|\n options[:threshold] = value\n end\n opts.on('-v', '--verbose', 'Verbose output') do |v|\n $verbose = v\n end\n opts.on( '-h', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n optparse.parse!\n\n if(!options[:remotes] and !options[:status])\n raise OptionParser::MissingArgument.new('Must specify an action: remotes, unclean')\n end\n\n return options\nrescue OptionParser::MissingArgument\n puts optparse\n raise\nend",
"def parse(args = nil)\n\t\t\t\targs ||= {}\n\t\t\t\t# Create options\n\t\t\t\tnoat = [:bool, :action]\n\t\t\t\tsopts = @options.each_value.collect { |option| [option[:long], option[:short], noat.include?(option[:type]) ? GetoptLong::NO_ARGUMENT : GetoptLong::REQUIRED_ARGUMENT] }\n\n\t\t\t\topts = GetoptLong.new(*sopts)\n\t\t\t\topts.quiet = true\n\n\t\t\t\t# Parse option\n\t\t\t\tbegin\n\t\t\t\t\topts.each do |given, arg|\n\t\t\t\t\t\toptname = @options_map[given]\n\t\t\t\t\t\toption = @options[optname]\n\t\t\t\t\t\tvalue = nil\n\n\t\t\t\t\t\t# VALIDATE ARGUMENT DUE TO CASE\n\t\t\t\t\t\tcase option[:type]\n\t\t\t\t\t\t\twhen :string then\n\t\t\t\t\t\t\t\tvalue = arg\n\t\t\t\t\t\t\twhen :int then\n\t\t\t\t\t\t\t\tif arg.strip =~ /^(-?)(\\d+)$/ then\n\t\t\t\t\t\t\t\t\tvalue = arg.to_i(10)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@console.fatal(msg: \"Argument of option \\\"#{given}\\\" must be an integer.\", dots: false)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\twhen :float then\n\t\t\t\t\t\t\t\tif arg.strip =~ /^(-?)(\\d*)(\\.(\\d+))?$/ && arg.strip() != \".\" then\n\t\t\t\t\t\t\t\t\tvalue = arg.to_f\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@console.fatal(msg: \"Argument of option \\\"#{given}\\\" must be a float.\", dots: false)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\twhen :choice then\n\t\t\t\t\t\t\t\tif @options[optname].choices.find_index { |choice| arg =~ choice } then\n\t\t\t\t\t\t\t\t\tvalue = arg\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@console.fatal(msg: \"Invalid argument (invalid choice) for option \\\"#{given}\\\".\", dots: false)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\twhen :list then\n\t\t\t\t\t\t\t\tvalue = arg.split(\",\")\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tvalue = true\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t@options[optname][:value] = value\n\t\t\t\t\tend\n\t\t\t\trescue StandardError => exception\n\t\t\t\t\tif exception.message =~ /.+-- (.+)$/ then\n\t\t\t\t\t\tgiven = $1\n\n\t\t\t\t\t\tif exception.is_a?(GetoptLong::InvalidOption) then\n\t\t\t\t\t\t\t@console.fatal(msg: \"Unknown option \\\"#{given}\\\".\", dots: false) if !args[:ignore_unknown]\n\t\t\t\t\t\telsif exception.is_a?(GetoptLong::MissingArgument) then\n\t\t\t\t\t\t\t@console.fatal(msg: \"Option \\\"-#{given}\\\" requires an argument.\", dots: false)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t@console.fatal(\"Unexpected error: #{exc.message}.\")\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# SET OTHER ARGUMENTS\n\t\t\t\t@args = ARGV\n\n\t\t\t\t# CHECK IF HELP WAS REQUESTED\n\t\t\t\tif self.provided?(\"help\") && !args[:ignore_help] then\n\t\t\t\t\tself.print_help\n\t\t\t\t\texit(0)\n\t\t\t\tend\n\n\t\t\t\t# NOW CHECK IF SOME REQUIRED OPTION WAS NOT SPECIFIED OR IF WE HAVE TO EXECUTE AN ACTION\n\t\t\t\t@inserted[:name].each do |key|\n\t\t\t\t\toption = @options[key]\n\n\t\t\t\t\tif option[:required] == true && option[:value] == nil then\n\t\t\t\t\t\t@console.fatal(msg: \"Required option \\\"#{option[:name]}\\\" not specified.\", dots: false)\n\t\t\t\t\telsif option[:value] == true && option[:type] == :action then\n\t\t\t\t\t\toption.action.call\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def process_options\n\t\t@options[:verbose] = false if @options[:quiet]\n\t\t@options[:getword] = false if @options[:random]\n\t\t@options[:add] = false if @options[:random] or @options[:getword]\n\tend",
"def specific_machine_options(component, _count = nil)\n return [] unless @node['provisioning'][component]\n options = []\n if @node['provisioning'][component]['flavor']\n options << {\n bootstrap_options: {\n instance_type: @node['provisioning'][component]['flavor']\n }\n }\n end\n # if @node['provisioning'][component]['security_group_ids']\n if Server::Helpers::Component.security_group_ids(component)\n options << {\n bootstrap_options: {\n security_group_ids: Server::Helpers::Component.security_group_ids(component)\n }\n }\n end\n if @node['provisioning'][component]['image_id']\n options << { image_id: @node['provisioning'][component]['image_id'] }\n end\n if @node['provisioning'][component]['aws_tags']\n options << { aws_tags: @node['provisioning'][component]['aws_tags'] }\n end\n # Specify more specific machine_options to add\n options\n end",
"def setup_options\n @parser.banner = BANNER\n\n @parser.on('-V', '--version', 'display version and exit') { show_version }\n @parser.on('-h', '--help', 'display help and exit') { show_help }\n @parser.on('-f', '--files=[file1.txt file2.txt ...]', Array, 'text files to read') { |o| @options.files = o }\n @parser.on('-n', '--number=NUM', Integer, 'number of results to show [default = 100]') do |n|\n @options.number = n\n end\n @parser.on('-v', '--verbose', 'verbose output') { @options.verbose = true }\n end",
"def parse_options=(_arg0); end",
"def parse_options=(_arg0); end",
"def bootstrap_config\n knife.add_variable_to_bootstrap_context(:@hazetug, config)\n\n @bootstrap_option_list.each do |opt|\n knife.config[opt] = bootstrap_options[opt]\n end\n\n @chef_option_list.each do |opt|\n Chef::Config[opt] = bootstrap_options[opt]\n end\n\n # Check ssh identity\n cred = [\n hazetug_identity, bootstrap_options[:identity_file],\n bootstrap_options[:ssh_password]\n ]\n\n if cred.all?(&:nil?)\n msg = \"No identity (inc. ssh_password) found. Check ssh_password,\" <<\n \" identity_file options or #{config[:compute_name]}_ssh_keys \" <<\n \"hazetug parameter.\"\n\n raise Hazetug::Exception, msg\n end\n end",
"def default_action(action_config)\n if option('help') && action_config.help?\n :help\n elsif option('version') && action_config.version?\n :version\n end\n end",
"def process(action, *args)\n action, options = action if action.is_a?(Array)\n @_action_options = options || {}\n super\n end",
"def option_parser\n OptionParser.new do |opts|\n opts.banner = \"Usage: generate [options]\"\n\n opts.on('--host-env-file=PATH', \"path to host app's entry file\") do |o|\n options[:builder][:args_for_introspector][:rails_environment_file] = o\n end\n\n opts.on('-o RELATIVE_DIR', '--output-dir=RELATIVE_DIR',\n 'specifies directory which to output if relevant') do |o|\n options[:sink][:options][:write_path] = o\n end\n\n opts.on('--base-presenter-class=CLASS', \"which class to look up presenters on\") do |o|\n options[:builder][:args_for_introspector][:base_presenter_class] = o\n end\n\n opts.on('--base-controller-class=CLASS', \"which class to look up controllers on\") do |o|\n options[:builder][:args_for_introspector][:base_controller_class] = o\n end\n\n opts.on('--base-application-class=CLASS', \"which class to look up routes on\") do |o|\n options[:builder][:args_for_introspector][:base_application_class] = o\n end\n\n opts.on('--controller-matches=MATCH',\n 'a case-sensitive regexp used to winnow the list of '\\\n 'controllers. It is matched against the constant, not '\\\n 'underscored name of the controller. Specifying multiple '\\\n 'performs a logical AND between Regexen.') do |o|\n # Trim slashes on passed MATCH.\n matcher = Regexp.new(o.gsub(/(\\A\\/)|(\\/\\z)/, ''), 'i')\n options[:builder][:args_for_atlas][:controller_matches].push(matcher)\n end\n\n opts.on('--markdown', 'use markdown format') do |o|\n options[:sink][:options][:format] = :markdown\n end\n\n opts.on('-m', '--multifile-presenters-and-controllers',\n 'dumps presenters and controllers to separate files (default)') do |o|\n if options[:sink][:options][:format] == :oas_v2\n raise NotImplementedError.new(\"Multi File support for Open API Specification is not supported yet\")\n else\n options[:sink][:method] = Brainstem::ApiDocs::Sinks::ControllerPresenterMultifileSink.method(:new)\n end\n end\n\n opts.on('--output-extension=EXTENSION', 'extension that should be used for output files') do |extension|\n options[:sink][:options][:output_extension] = extension\n end\n\n opts.on('--include-internal', 'Generate docs for all `internal!` flagged presenters/controllers') do |_|\n options[:builder][:args_for_atlas][:include_internal] = true\n end\n\n #########################################################\n # #\n # Open API Specification generation specific commands: #\n # #\n #########################################################\n\n # Future proofing for different Open API Specification versions.\n opts.on('--open-api-specification=VERSION',\n 'dumps an Open API Specification for presenters and controllers in a single file') do |oas_version|\n case oas_version.to_i\n when 2\n options[:sink][:options][:format] = :oas_v2\n else\n raise NotImplementedError.new(\n \"Please specify the version of Open API Specification to be generated e.g. --open-api-specification=2\"\n )\n end\n options[:sink][:method] = Brainstem::ApiDocs::Sinks::OpenApiSpecificationSink.method(:new)\n end\n\n opts.on('--api-version=API_VERSION',\n 'sets the version of the generated documentation') do |api_version|\n options[:sink][:options][:api_version] = api_version\n end\n\n opts.on('--ignore-tagging',\n 'does not add the tag definitions in the Open API Specification') do |api_version|\n options[:sink][:options][:ignore_tagging] = true\n end\n\n opts.on('--oas-filename-pattern=PATTERN',\n 'defines the naming pattern of the Open API Specification file') do |pattern|\n options[:sink][:options][:oas_filename_pattern] = pattern\n end\n end\n end",
"def parse_options_and_selects!\n\n #field :field_value, :type => Object, :default => nil\n #field :select_options, :type => Array, :default => nil\n\n if params[:option].present?\n params[:file_metadata_schema][:field_value] = params[:option]\n end\n\n if params[:value].present?\n values = Array.new\n params[:value].each_with_index do |v,i|\n values << Hash[:value => v[1], :selected => is_selected?(i)]\n end\n params[:file_metadata_schema][:select_options] = values\n end\n \n end",
"def parse_command_line &block\n data = {}\n\n OptionParser.new do |opts|\n opts.banner = \"Usage: #{File.basename($0)} [options]\"\n\n opts.on(\"-c CONFIG\", \"--conf CONFIG\", \"YAML config file\") do |config|\n data[\"config\"] = config\n end\n\n opts.on(\"-p PARAMS\", \"--params PARAMS\", \"Additional default options - key: value as JSON string, override values from config file\") do |params|\n data[\"params\"] = JSON.parse(params)\n end\n\n # process custom args, if given\n block.call(opts) if block_given?\n\n opts.on_tail('-h', '--help', 'display this help and exit') do\n puts opts\n exit\n# return nil\n end\n\n# begin\n opts.parse(ARGV)\n# rescue OptionParser::InvalidOption\n# # do nothing\n# end\n\n end\n\n @args = data\n end",
"def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend",
"def parse_yardopts_options(*args); end",
"def initialize_before_opts\n end",
"def parse_options\n program_name = File.basename($0)\n\n Choice.options do\n header \"Nagios Herald - Spread the word\"\n header \"\"\n\n option :config_file do\n short \"-c\"\n long \"--config-file\"\n desc \"Specify an alternate location for the config file.\"\n default File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'etc', 'config.yml'))\n end\n\n option :debug do\n short \"-d\"\n long \"--debug\"\n desc \"BE VERBOSE! B-E V-E-R-B-O-S-E!\"\n end\n\n option :env do\n short \"-e\"\n long \"--env-file\"\n desc \"Path to a file containing environment variables to use for testing/debugging (i.e. nagios_vars).\"\n end\n\n option :message_dir do\n short \"-M\"\n long \"--message-dir\"\n desc \"Message class directory\"\n default nil\n end\n\n option :formatter_name do\n short \"-f\"\n long \"--formatter\"\n desc \"Formatter name\"\n default nil\n end\n\n option :formatter_dir do\n short \"-F\"\n long \"--formatter-dir\"\n desc \"Formatter directory\"\n default nil\n end\n\n option :helper_dir do\n short \"-H\"\n long \"--helper-dir\"\n desc \"Helper directory\"\n default nil\n end\n\n option :logfile do\n short \"-l\"\n long \"--logfile\"\n desc \"Logfile location\"\n desc \"Can be a file name or STDOUT (i.e. -l /tmp/output.log or -l STDOUT)\"\n desc \"[DEFAULT] Uses the value of 'logfile' in the config or STDOUT if not defined.\"\n default nil\n end\n\n option :message_type, :required => true do\n short \"-m\"\n long \"--message-type\"\n desc \"[REQUIRED] Type of message to deliver (i.e. email, IRC, pager)\"\n end\n\n option :no_send do\n short \"-N\"\n long \"--no-send\"\n desc \"Output content to screen but do not send it\"\n end\n\n option :notification_type do\n short \"-n\"\n long \"--notification-type\"\n desc \"NAGIOS_NOTIFICATION_TYPE to report - defaults to the nagios env variable.\"\n desc \"Valid options: PROBLEM, FLAPPINGSTART, RECOVERY, FLAPPINGSTOP, ACKNOWLEDGEMENT\"\n end\n\n option :pager_mode do\n short \"-p\"\n long \"--pager\"\n desc \"Enable pager mode\"\n end\n\n option :recipients do\n short \"-r\"\n long \"--recipient\"\n desc \"A recipient's email address. Specify multiple recipients with multiple '-r' arguments.\"\n desc \"If not specified, recipients are looked up in the ENV['NAGIOS_CONTACTEMAIL'] environment variable.\"\n end\n\n option :trace do\n short \"-t\"\n long \"--trace\"\n desc \"Show a full traceback on error\"\n default false\n end\n\n option :nagios_url do\n short \"-u\"\n long \"--nagios-cgi-url\"\n desc \"Nagios CGI url (used for acknowledgement links)\"\n end\n\n option :replyto, :required => true do\n short \"-y\"\n long \"--reply-to\"\n desc \"[REQUIRED] Reply-to email address (i.e. nagios@example.com) used for acknowledgement replies.\"\n end\n\n footer \"\"\n footer \"EXAMPLES\"\n footer \"--------\"\n footer \"#{program_name} -r ops@example.com --env-file=test/env_files/nagios_vars -y nagios@example.com --formatter=check_disk\"\n footer \"\"\n end\n\n return Choice.choices\n\n end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options\n @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }\n end",
"def initialize argv\n @argv = argv.dup\n @options = {}\n while @argv[0] =~ /^-/\n option, value = @argv.shift.split(/[=:]/, 2)\n csv = (value =~ /,/ ? value.split(',') : Array(value))\n modes = csv.inject({}){|h,s| k, v = s.split(/=/, 2); h[k] = v || true; h }\n @options[option.sub(/^-*/,'')] = modes\n end\n end"
] |
[
"0.63154054",
"0.62293816",
"0.6156556",
"0.6120439",
"0.60153794",
"0.59768057",
"0.59768057",
"0.59768057",
"0.595287",
"0.595287",
"0.59414697",
"0.59384495",
"0.59039927",
"0.58953375",
"0.584661",
"0.57980955",
"0.5793433",
"0.5727997",
"0.57268226",
"0.56894016",
"0.5675293",
"0.5674505",
"0.5672594",
"0.5590506",
"0.5583399",
"0.5576193",
"0.5575995",
"0.5561884",
"0.55584407",
"0.5556638",
"0.55482787",
"0.55420566",
"0.55378646",
"0.553781",
"0.553781",
"0.5516043",
"0.5507897",
"0.55054694",
"0.55008197",
"0.5484146",
"0.5472076",
"0.545592",
"0.54437065",
"0.5443409",
"0.5441468",
"0.5415215",
"0.54066736",
"0.54066736",
"0.540366",
"0.5403319",
"0.53895587",
"0.5368016",
"0.5342004",
"0.5342004",
"0.5337865",
"0.5337516",
"0.53341657",
"0.53341657",
"0.5323871",
"0.5313141",
"0.53094035",
"0.5307028",
"0.53065073",
"0.5291451",
"0.528866",
"0.52853537",
"0.5284272",
"0.5280098",
"0.5266384",
"0.52653503",
"0.52635044",
"0.52544653",
"0.52541935",
"0.5248522",
"0.5248522",
"0.52454686",
"0.52420133",
"0.52413505",
"0.5237487",
"0.5229996",
"0.5229407",
"0.5225852",
"0.5224602",
"0.52110916",
"0.5209748",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.5200033",
"0.51983607",
"0.51961094"
] |
0.5874498
|
14
|
write /etc/init.d/prestolauncher & /etc/servicenanny/presto.conf for servicenanny to monitor
|
def writePrestoFilesForServiceNanny
println "Making /etc/init.d/presto-launcher"
File.open('/tmp/presto-launcher', 'w') do |f|
f.write(<<EOF
/home/hadoop/presto-server/bin/launcher $@
EOF
)
end
sudo "mv /tmp/presto-launcher /etc/init.d/presto-launcher && chmod a+x /etc/init.d/presto-launcher"
println "Making /etc/service-nanny/presto.conf"
File.open('/tmp/presto.conf', 'w') do |f|
f.write(<<EOF
[
{
"name": "run-presto-server",
"type": "file",
"file": "#{$presto_run_dir}/run-presto-server",
"pattern": "1"
},
{
"name": "presto-server",
"type": "process",
"start": "/etc/init.d/presto-launcher start",
"stop": "/etc/init.d/presto-launcher stop",
"pid-file": "#{$presto_run_dir}/presto-server.pid",
"pattern": "presto-server",
"depends": ["run-presto-server"]
}
]
EOF
)
end
sudo "mv /tmp/presto.conf /etc/service-nanny/presto.conf"
sudo "echo '1' >/tmp/run-presto-server"
sudo "mv /tmp/run-presto-server /mnt/var/run/presto/run-presto-server"
sudo "chmod +x /etc/service-nanny/presto.conf"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start_server(type, date)\n Shell.execute \"start #{upstart_script_filename(type, date).gsub(/^#{script_directory}\\//, '').gsub(/\\.conf$/, '')}\"\n end",
"def configureStartup\n `chkconfig --add nagios`\n `chkconfig --level 35 nagios on`\n `chkconfig --add httpd`\n `chkconfig --level 35 httpd on`\n `iptables -I INPUT 1 -s #{@ips[0]}/#{@mask} -p tcp -m tcp --dport 80 -j ACCEPT`\n `iptables -I INPUT 1 -s #{@ips[0]}/#{@mask} -p udp -m udp --dport 80 -j ACCEPT`\n `service iptables save`\n `service iptables restart`\n end",
"def start\n configure\n run\n end",
"def startup\n log \"#{name} is starting\"\n trap(\"INT\") { shutdown_soon }\n end",
"def app_services_create\n # SEE http://off-the-stack.moorman.nu/posts/5-user-services-with-runit/ for info on scripts\n c = Capistrano::BaseHelper.get_capistrano_instance\n c.run(\"#{c.sudo} mkdir -p '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path)}'\")\n \n commands = []\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root /etc/sv/#{c.fetch(:user)}\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root /etc/sv/#{Capistrano::BaseHelper.user_app_env_path}\"\n c.run(commands.join(\" && \"))\n Capistrano::BaseHelper.generate_and_upload_config( Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_local_run), Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_remote_run), true )\n Capistrano::BaseHelper.generate_and_upload_config( Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_local_finish), Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_remote_finish), true )\n\n commands = []\n commands << \"#{c.sudo} chmod u+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"run\")}'\"\n commands << \"#{c.sudo} chmod u+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"finish\")}'\"\n commands << \"#{c.sudo} chmod g+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"run\")}'\"\n commands << \"#{c.sudo} chmod g+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"finish\")}'\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"run\")}'\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"finish\")}'\"\n c.run(commands.join(\" && \"))\n\n Capistrano::RunitBase.app_services_create_log_service\n end",
"def start(launcher)\n @launcher = launcher\n\n # Log relevant ENV in debug\n @launcher.events.debug \"systemd: NOTIFY_SOCKET=#{ENV[\"NOTIFY_SOCKET\"].inspect}\"\n @launcher.events.debug \"systemd: WATCHDOG_PID=#{ENV[\"WATCHDOG_PID\"].inspect}\"\n @launcher.events.debug \"systemd: WATCHDOG_USEC=#{ENV[\"WATCHDOG_USEC\"].inspect}\"\n\n # Only install hooks if systemd is present, the systemd is booted by\n # systemd, and systemd has asked us to notify it of events.\n @systemd = Systemd.new\n if @systemd.present? && @systemd.booted? && @systemd.notify?\n @launcher.events.debug \"systemd: detected running inside systemd, registering hooks\"\n register_hooks\n else\n @launcher.events.debug \"systemd: not running within systemd, doing nothing\"\n end\n end",
"def save_configuration_files(server)\n puts \"Saving config files\"\n probe(server, 'mkdir -p /root/start_stop_backup')\n probe(server, 'cp /etc/postfix/main.cf /root/start_stop_backup/.')\n probe(server, 'cp /etc/syslog-ng/syslog-ng.conf /root/start_stop_backup/.')\n end",
"def integrate_with_systemd; end",
"def start\n parse_options\n\n if @daemon\n require \"facets/daemonize\"\n\n daemonize()\n\n # Save a process sentinel file.\n FileUtils.touch(File.join(\".temp\",\"d#{Process.pid}.pid\"))\n end\n setup_drb()\n end",
"def write_conf\n template(new_resource.config_path) do\n source 'rsyncd.conf.erb'\n cookbook 'rsync'\n owner 'root'\n group 'root'\n mode '0640'\n variables(\n globals: global_modules,\n modules: rsync_modules\n )\n notifies :restart, \"service[#{node['rsyncd']['service']}]\", :delayed\n end\n\n service node['rsyncd']['service'] do\n action :nothing\n end\nend",
"def start_instance()\n system(\"sh wso2wsas-SNAPSHOT/bin/wso2server.sh\")\nend",
"def apply_config!\n if self.connect then\n @ssh_connection.exec!(\"/usr/etc/rc.d/rc.softrestart\") or raise\n #@ssh_connection.exec!(\"ubntconf -c /tmp/system.cfg\") or raise\n #@ssh_connection.exec!(\"cfgmtd -p /etc/\") or raise\n #@ssh_connection.exec!(\"reboot\") or raise\n end\n end",
"def enable(service_conf_filename)\n c = Capistrano::BaseHelper.get_capistrano_instance\n c.run(\"[ -h #{File.join(c.fetch(:monit_enabled_path), service_conf_filename)} ] || ln -sf #{File.join(c.fetch(:monit_available_path), service_conf_filename)} #{File.join(c.fetch(:monit_enabled_path), service_conf_filename)}\")\n end",
"def startup_hook; end",
"def startup\nend",
"def autostart; end",
"def app_services_create_log_service\n c = Capistrano::BaseHelper.get_capistrano_instance\n commands = []\n commands << \"#{c.sudo} mkdir -p #{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\")}\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root #{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\")}\"\n commands << \"#{c.sudo} mkdir -p '#{File.join(\"/var\", \"log\", \"service\", Capistrano::BaseHelper.user_app_env_path, \"runit\")}'\"\n commands << \"#{c.sudo} chown -R #{c.fetch(:runit_log_user)}:#{c.fetch(:runit_log_group)} '#{File.join(\"/var\", \"log\", \"service\", Capistrano::BaseHelper.user_app_env_path, \"runit\")}'\"\n\n c.run(commands.join(\" && \"))\n Capistrano::BaseHelper.generate_and_upload_config( c.fetch(:runit_local_log_run), c.fetch(:runit_remote_log_run), true )\n commands = []\n commands << \"#{c.sudo} chmod u+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n commands << \"#{c.sudo} chmod g+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n c.run(commands.join(\" && \")) \n end",
"def start\n return unless agent_should_start?\n\n log_startup\n check_config_and_start_agent\n log_version_and_pid\n\n events.subscribe(:initial_configuration_complete) do\n log_ignore_url_regexes\n end\n end",
"def config_master_from_scratch(server)\n behavior(:create_stripe, server)\n object_behavior(server, :spot_check_command, \"service mysqld start\")\n#TODO the service name depends on the OS\n# server.spot_check_command(\"service mysql start\")\n behavior(:run_query, \"create database mynewtest\", server)\n behavior(:set_master_dns, server)\n # This sleep is to wait for DNS to settle - must sleep\n sleep 120\n behavior(:run_script, \"backup\", server)\n end",
"def start_stop_script(attributes)\n [:user, :cwd, :name, :pidfile, :daemon].each do |key|\n raise \"#{key} not set\" if !attributes.has_key?(key)\n end\n\n template \"/etc/init.d/#{attributes[:name]}\" do\n source \"start_stop_script.erb\"\n cookbook \"base\"\n variables(attributes)\n mode \"755\"\n end\nend",
"def start\n execute_prlctl('start', @uuid)\n end",
"def setup\n unless Hearthstone.config_path.file_exists?\n content = File.read(Hearthstone.new_config_path)\n dir = File.dirname(Hearthstone.config_path)\n\n NSFileManager.defaultManager.createDirectoryAtPath(dir, withIntermediateDirectories: true, attributes: nil, error: nil)\n File.open(Hearthstone.config_path, 'w') { |file| file.write(content) }\n\n if is_hearthstone_running?\n NSAlert.alert('Alert'._,\n :buttons => ['OK'._],\n :informative => 'You must restart Hearthstone for logs to be used'._)\n\n end\n end\n end",
"def start\n register_signal_handlers\n startup\n spawn_processes\n watch_for_output\n sleep 0.1\n wait_for_shutdown_or_child_termination\n shutdown\n exit(@exitstatus) if @exitstatus\n end",
"def iyyov_install_init!\n rput( 'etc/init.d/iyyov', :user => 'root' )\n\n # Add to init.d\n dist_install_init_service( 'iyyov' )\n end",
"def start_monit\n pidfile = \"/var/run/lock/#{app['shortname']}/puma.pid\"\n context.execute \"monit start #{adapter}_#{app['shortname']}\" do\n retries 3\n creates pidfile\n end\n end",
"def restart_service\n service 'consul-haproxy' do\n action :restart\n end\nend",
"def startup\n return self unless not running?\n\n begin\n create_pid_file\n trap_signals\n run\n rescue Exception => e\n # if something is caught here, then we can only log it. at this point we are in an\n # unknown state and can only delete our pid file and #exit!. Attempting to call\n # our #term method could cause other problems here.\n Emissary.logger.error \"Server '#{$0}': #{e.class.name}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n ensure\n delete_pid_file\n shutdown! :hard\n end\n \n return self\n end",
"def cmd_twitt_start\n\t\t\t\tprint_status \"Starting to monitor sessions to Twitt\"\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\t@twitt_client = Twitter.configure do |config|\n\t\t\t\t\t\tconfig.consumer_key = @consumer_key\n\t\t\t\t\t\tconfig.consumer_secret = @consumer_secret\n\t\t\t\t\t\tconfig.oauth_token = @oauth_token\n\t\t\t\t\t\tconfig.oauth_token_secret = @oauth_token_secret\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"Twitter Plugin Started, Monitoring Sessions\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set Twitter settings.\")\n\t\t\t\tend\n\t\t\tend",
"def startup\n end",
"def startup\n end",
"def startup\n end",
"def initd_file(svc, pidfile, initd_location, status)\n <<INITD\n#!/bin/bash\n# #{svc} daemon\n# chkconfig: 2345 20 80\n# description: #{svc} daemon\n\nDESC=\"#{svc} daemon\"\nPIDFILE=#{pidfile}\nSCRIPTNAME=#{initd_location}\n\ncase \"$1\" in\nstart)\n PID=`/usr/bin/#{svc} 120 > /dev/null 2>&1 & echo $!`\n if [ -z $PID ]; then\n echo \"Failed to start\"\n else\n echo $PID > $PIDFILE\n echo \"Started\"\n fi\n;;\n\n#{if status then \"status)\" else \"status-ignored)\" end}\n if [ -f $PIDFILE ]; then\n PID=`cat $PIDFILE`\n if [ -z \"`ps axf | grep ${PID} | grep -v grep `\" ]; then\n printf \"Process dead but pidfile exists\"\n exit 2\n else\n echo \"Running\"\n fi\n else\n echo \"Service not running\"\n exit 3\n fi\n;;\n\nstop)\n PID=`cat $PIDFILE`\n if [ -f $PIDFILE ]; then\n kill -TERM $PID\n rm -f $PIDFILE\n else\n echo \"pidfile not found\"\n fi\n;;\n\nrestart)\n $0 stop\n $0 start\n;;\n\n*)\n echo \"Usage: $0 (start|stop|restart)\"\n exit 1\nesac\n\nexit 0\nINITD\n end",
"def start\n if File.file?(trait[:pidfile])\n pid = File.read(trait[:pidfile], 20).strip\n abort(\"thoth already running? (pid=#{pid})\")\n end\n\n puts \"Starting thoth.\"\n\n fork do\n Process.setsid\n exit if fork\n\n File.open(trait[:pidfile], 'w') {|file| file << Process.pid}\n at_exit {FileUtils.rm(trait[:pidfile]) if File.exist?(trait[:pidfile])}\n\n Dir.chdir(HOME_DIR)\n File.umask(0000)\n\n STDIN.reopen('/dev/null')\n STDOUT.reopen('/dev/null', 'a')\n STDERR.reopen(STDOUT)\n\n run\n end\n end",
"def install\n sbin.install \"sbin/docker.hyperkit.tuntap.sh\"\n sbin.install \"sbin/docker_tap_install.sh\"\n sbin.install \"sbin/docker_tap_up.sh\"\n sbin.install \"sbin/docker_tap_up_routes.sh\"\n\n bin.install \"sbin/docker_tap_uninstall.sh\"\n\n on_start_dir = etc/\"docker-lifecycle-listener.d/on_start\"\n begin\n on_start_dir.install_symlink opt_sbin/\"docker_tap_install.sh\"\n on_start_dir.install_symlink opt_sbin/\"docker_tap_up.sh\"\n on_start_dir.install_symlink opt_sbin/\"docker_tap_up_routes.sh\"\n rescue\n puts <<~EOS\n Unable to link into #{on_start_dir}; you must do this manually:\n sudo ln -sf #{opt_sbin}/docker_tap_* #{on_start_dir}/\n EOS\n end\n end",
"def enable_service\n super\n sleep 1 until ::FileTest.pipe?(\"#{service_resource.service_dir}/#{service_resource.service_name}/supervise/ok\")\n if service_resource.log\n sleep 1 until ::FileTest.pipe?(\"#{service_resource.service_dir}/#{service_resource.service_name}/log/supervise/ok\")\n end\n end",
"def install\n\t\tbin.install \"cpu-sentinel\"\n\t\tconfigdir.install \"procs.conf\"\n\tend",
"def start(launcher)\n @launcher = launcher\n\n @statsd = PumaStatsd.new\n if @statsd.enabled?\n @launcher.events.debug \"statsd: enabled (host: #{@statsd.host})\"\n register_hooks\n else\n @launcher.events.debug \"statsd: not enabled (no statsd client configured)\"\n end\n end",
"def write_server_status(pid)\n File.open(\"#{ENV['TM_PROJECT_DIRECTORY']}/config/.event_server\", 'w') {|f| f.write(\"pid: #{pid}\") }\n end",
"def start(filename)\n return false unless conf_load(filename)==true\n kernel_module_start\n bridge_start\n `#{@mkdir} #{PIDDIR}` unless File.exist?(PIDDIR)\n \n #net nic\n macaddress=\",macaddr=\"+@conf[\"macaddress\"] if @conf.include?(\"macaddress\")\n model=\",model=\"+@conf[\"model\"] if @conf.include?(\"model\")\n vlan=\"\" # TODO remove this line, use the line below\n #vlan=\",vlan=\"+@conf[\"vlan\"] if @conf.include?(\"vlan\")\n #nic=\"-net nic\"+@conf[\"nic\"]+macaddress.to_s+vlan.to_s #if @conf.include?(\"nic\")\n nic=\"-net nic\"+macaddress.to_s+model.to_s+vlan.to_s\n \n #net tap\n ifname=\",ifname=\"+@conf[\"ifname\"] if @conf.include?(\"ifname\")\n script=\",script=\"+@conf[\"script\"]if @conf.include?(\"script\")\n tap=\"-net \"+@conf[\"tap\"]+ifname.to_s+script.to_s+vlan.to_s if @conf.include?(\"tap\")\n \n hda=\"-hda \"+@conf[\"hda\"]\n hdb=\"-hdb \"+@conf[\"hdb\"] if @conf.include?(\"hdb\")\n hdc=\"-hdc \"+@conf[\"hdc\"] if @conf.include?(\"hdc\")\n hdd=\"-hdd \"+@conf[\"hdd\"] if @conf.include?(\"hdd\")\n boot=\"-boot \"+@conf[\"boot\"]\n cdrom=\"-cdrom \"+@conf[\"cdrom\"] if @conf.include?(\"cdrom\")\n cpus=\"-smp \"+@conf[\"cpus\"] if @conf.include?(\"cpus\")\n vnc_port=\" -vnc :\"+@conf[\"id\"] if @conf.include?(\"id\") && @conf[\"display\"]==\"vnc\"\n keyboard=\"-k \"+@conf[\"keyboard\"] if @conf.include?(\"keyboard\")\n soundhw=\"-soundhw \"+@conf[\"soundhw\"] if @conf.include?(\"soundhw\")\n daemonize=\"-daemonize\" if @conf.include?(\"daemonize\") && (@conf[\"daemonize\"]==\"true\" || @conf[\"daemonize\"].to_i==1)\n #later other usb devices can be added, the -usb activate the usb driver\n if @conf[\"display\"]!=\"sdl\"\n usb=\"-usb \"\n usbdevice=\"-usbdevice \"+@conf[\"mouse\"]\n end\n pidfile = \"-pidfile #{get_pidfile(filename)}\"\n mem = \"-m \" + @conf[\"mem\"] if @conf.include?(\"mem\")\n noacpi = \"-no-acpi\" if @conf.include?(\"noacpi\") && @conf[\"noacpi\"] =~ /no/i\n nographic = \"-nographic\" if @conf.include?(\"graphic\") && @conf[\"graphic\"] =~ /no/i\n monitor = \"-monitor telnet:127.0.0.1:#{@conf[\"monitor_port\"]},server,nowait\" if @conf[\"monitor_redirect\"]!=\"false\" && @conf.include?(\"monitor_port\")\n #puts vnc_port\n #exit\n \n command=\"#{@qemu} #{mem} #{hda} #{hdb} #{hdc} #{hdd} #{cdrom} #{boot} #{nic} #{tap} #{cpus} #{vnc_port} #{daemonize} #{keyboard} #{soundhw} #{usb} #{usbdevice} #{pidfile} #{monitor} #{noacpi} #{nographic}\"\n puts command if @verbose\n # Starts KVM\n `#{command}`\n # Was system call successful?\n #http://ruby-doc.org/core/classes/Kernel.html#M005971\n if $?.success?\n # TODO: check this\n # Running after hooks (system commands)\n `#{@conf[\"after_hooks\"]}`\n\n # Sets cpulimit on KVM instance if required by config\n set_cpulimit(filename, @conf[\"cpulimit\"]) if @conf.include?(\"cpulimit\") && @conf[\"cpulimit\"].to_f > 0\n end\n end",
"def setPuppetConf()\n confHash = {} # Our hash of puppet.conf keys and values\n \n # Set the confHash equal to all your puppet.conf settings\n confHash = {\"server\" => $server, \"certname\" => $mac_uid, \"pluginsync\" => \"true\", \"factpath\" => \"$vardir/lib/facter\"}\n \n # Output values to the puppet.conf file\n File.open(\"/etc/puppet/puppet.conf\", 'w') {|f| \n f.write(\"[main]\\n\")\n confHash.each{|key,value| f.write(key + \" = \" + value + \"\\n\")}\n }\nend",
"def start_music_service\n execute_system_cmd('/etc/init.d/music_daemon start')\n end",
"def create_monit_config\n # Scope closureeeeeee.\n _options = options\n _pid_file = pid_file\n _parent = service_resource.parent\n _script_path = script_path\n monit_config new_resource.service_name do\n if _options['monit_template']\n # If we have a template override, allow specifying a cookbook via\n # \"cookbook:template\".\n parts = _options['monit_template'].split(/:/, 2)\n if parts.length == 2\n source parts[1]\n cookbook parts[0]\n else\n source parts.first\n cookbook new_resource.cookbook_name.to_s\n end\n else\n source 'monit_service.conf.erb'\n cookbook 'poise-monit'\n end\n parent _parent\n variables service_resource: new_resource, options: _options, pid_file: _pid_file, script_path: _script_path\n # Don't trigger a restart if the template doesn't already exist, this\n # prevents restarting on the run that first creates the service.\n restart_on_update = _options.fetch('restart_on_update', new_resource.restart_on_update)\n if restart_on_update && ::File.exist?(path) # Path here is accessing MonitConfig::Resource#path.\n mode = restart_on_update.to_s == 'immediately' ? :immediately : :delayed\n notifies :restart, new_resource, mode\n end\n end\n end",
"def startup_script\n <<~EOS\n #!/bin/sh\n PID=#{var}/spool/exim/exim-daemon.pid\n case \"$1\" in\n start)\n echo \"starting exim mail transfer agent\"\n #{bin}/exim -bd -q30m\n ;;\n restart)\n echo \"restarting exim mail transfer agent\"\n /bin/kill -15 `/bin/cat $PID` && sleep 1 && #{bin}/exim -bd -q30m\n ;;\n stop)\n echo \"stopping exim mail transfer agent\"\n /bin/kill -15 `/bin/cat $PID`\n ;;\n *)\n echo \"Usage: #{bin}/exim_ctl {start|stop|restart}\"\n exit 1\n ;;\n esac\n EOS\n end",
"def configure_tpm2_0_tools(hirs_host)\n install_package(hirs_host,'tpm2-abrmd')\n install_package(hirs_host,'tpm2-tools')\n config_abrmd_for_tpm2sim_on(hirs_host)\n on hirs_host, 'systemctl start tpm2-abrmd.service'\n end",
"def service name, operation, role\n run \"#{sudo} /etc/init.d/#{name} #{operation}\", :role => role\nend",
"def _start_monitor(analyzer_id, port)\n $logger.debug \"_START MONITOR\"\n opts={\n :ARGV => ['restart',analyzer_id.to_s,port.to_s],\n :multiple => true,\n :monitor => true,\n :backtrace => true,\n :mode => :exec,\n :log_output => File.join(File.dirname(__FILE__) ,'../../log/monitor.out')\n }\n script = File.join(File.dirname(__FILE__),\"monitor.rb\")\n #Child process execs\n #ObjectSpace.each_object(IO) {|io| io.close rescue nil }\n app = Daemons.run(script ,opts)\n $logger.debug \"------------------------------------------->\"\n $logger.debug app.inspect()\n $logger.debug \"<-------------------------------------------\"\n #parent process continues\n end",
"def start\n handle_old_pid_file\n start_control_loop\n end",
"def start!\n Scarlet.root = File.expand_path File.dirname(__FILE__)\n Scarlet.config.merge! YAML.load_file(\"#{Scarlet.root}/config.yml\").symbolize_keys\n # create servers\n Scarlet.config.servers.each do |name, cfg|\n cfg[:server_name] = name\n @@servers[name] = Server.new cfg\n end\n # for safety delete the servers list after it gets loaded\n Scarlet.config.delete :servers\n # connect servers\n @@servers.values.each do |server|\n server.connection = EventMachine::connect(server.config.address, server.config.port, Connection, server)\n end\n Scarlet.load_commands\n end",
"def configure_vs_pxe_client(client_name,client_mac,service_name)\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_boot_file = \"boot.cfg.01\"+tftp_pxe_file\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n test_file = $tftp_dir+\"/\"+tftp_pxe_file\n if !File.exists?(test_file)\n pxelinux_file = service_name+\"/usr/share/syslinux/pxelinux.0\"\n message = \"Creating:\\tPXE boot file for \"+client_name+\" with MAC address \"+client_mac\n command = \"cd #{$tftp_dir} ; ln -s #{pxelinux_file} #{tftp_pxe_file}\"\n execute_command(message,command)\n end\n pxe_cfg_dir = $tftp_dir+\"/pxelinux.cfg\"\n pxe_cfg_file = client_mac.gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n ks_url = \"http://\"+$default_host+\"/\"+service_name+\"/\"+client_name+\".cfg\"\n mboot_file = \"/\"+service_name+\"/mboot.c32\"\n if $verbose_mode == 1\n puts \"Creating:\\tMenu config file \"+pxe_cfg_file\n end\n file = File.open(pxe_cfg_file,\"w\")\n if $serial_mode == 1\n file.write(\"serial 0 115200\\n\")\n end\n file.write(\"DEFAULT ESX\\n\")\n file.write(\"LABEL ESX\\n\")\n file.write(\"KERNEL #{mboot_file}\\n\")\n if $text_mode == 1\n if $serial_mode == 1\n file.write(\"APPEND -c #{tftp_boot_file} text gdbPort=none logPort=none tty2Port=com1 ks=#{ks_url} +++\\n\")\n else\n file.write(\"APPEND -c #{tftp_boot_file} text ks=#{ks_url} +++\\n\")\n end\n else\n file.write(\"APPEND -c #{tftp_boot_file} ks=#{ks_url} +++\\n\")\n end\n file.write(\"IPAPPEND 1\\n\")\n file.close\n if $verbose_mode == 1\n puts \"Created:\\tPXE menu file \"+pxe_cfg_file+\":\"\n system(\"cat #{pxe_cfg_file}\")\n end\n tftp_boot_file=$tftp_dir+\"/\"+tftp_boot_file\n esx_boot_file=$tftp_dir+\"/\"+service_name+\"/boot.cfg\"\n if $verbose_mode == 1\n puts \"Creating:\\tBoot config file \"+tftp_boot_file\n end\n copy=[]\n file=IO.readlines(esx_boot_file)\n file.each do |line|\n line=line.gsub(/\\//,\"\")\n if $text_mode == 1\n if line.match(/^kernelopt/)\n if !line.match(/text/)\n line = line.chomp+\" text\\n\"\n end\n end\n end\n if $serial_mode == 1\n if line.match(/^kernelopt/)\n if !line.match(/nofb/)\n line = line.chomp+\" nofb com1_baud=115200 com1_Port=0x3f8 tty2Port=com1 gdbPort=none logPort=none\\n\"\n end\n end\n end\n if line.match(/^title/)\n copy.push(line)\n copy.push(\"prefix=#{service_name}\\n\")\n else\n copy.push(line)\n end\n end\n File.open(tftp_boot_file,\"w\") {|file_data| file_data.puts copy}\n if $verbose_mode == 1\n puts \"Created:\\tBoot config file \"+tftp_boot_file+\":\"\n system(\"cat #{tftp_boot_file}\")\n end\n return\nend",
"def configure_chef\n ChefConfig.logger = ChefCLI::Log\n # Setting the config isn't enough, we need to ensure the logger is initialized\n # or automatic initialization will still go to stdout\n Chef::Log.init(ChefCLI::Log)\n Chef::Log.level = ChefCLI::Log.level\n end",
"def start_puppet_service_and_wait_for_puppet_run(host)\n statedir = on(host, puppet('config', 'print', 'statedir')).stdout.chomp\n # Get modification time of last_run_report\n mtime_cmd = \"File.stat(\\\"#{statedir}/last_run_report.yaml\\\").mtime.to_i\"\n last_run_time = on(host, \"env PATH=\\\"#{host['privatebindir']}:${PATH}\\\" ruby -e 'puts #{mtime_cmd}'\").stdout.chomp\n step \"(Agent) Enable agent's puppet service to perform the agent upgrade from puppet service\" do\n on(host, puppet('resource', 'service', 'puppet', 'ensure=running'))\n end\n # wait for Puppet to have finished, i.e. retry until last_run_report modification time has changed\n step '(Agent) waiting for puppet run to complete...' do\n retry_on(host, \"env PATH=\\\"#{host['privatebindir']}:${PATH}\\\" ruby -e 'exit #{mtime_cmd} > #{last_run_time}'\", { max_retries: 1000, retry_interval: 2 })\n end\n\n step '(Agent) waiting for puppet to exit...' do\n retry_on(host, \"cat #{statedir}/agent_catalog_run.lock\", { desired_exit_codes: [1, 2] })\n end\n end",
"def create_service\n # Check signals here to be nice and abort early if possible.\n check_signals!\n # Enable automatically creates the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n owner 'root'\n group 'root'\n mode '700'\n end\n end",
"def druby_weblog_explain; \"Start the DRuby daemon for weblogs in your config.\"; end",
"def make_console_accessible(name)\n File.open(File.join(KVM_MOUNT_POINT, name, 'etc', 'init', 'ttys0.conf'), 'w') do |file|\n file.puts \"start on stopped rc RUNLEVEL=[2345]\"\n file.puts \"stop on runlevel [!2345]\"\n file.puts\n file.puts \"respawn\"\n file.puts \"exec /sbin/getty -L 38400 ttyS0 vt102\"\n end\nend",
"def configure_chef\n ChefConfig.logger = ChefRun::Log\n # Setting the config isn't enough, we need to ensure the logger is initialized\n # or automatic initialization will still go to stdout\n Chef::Log.init(ChefRun::Log)\n Chef::Log.level = ChefRun::Log.level\n end",
"def configure(params = {})\n felix_server = self.instance\n felix_server.reset_process!\n felix_server.quiet = params[:quiet].nil? ? true : params[:quiet]\n if defined?(Rails.root)\n base_path = Rails.root\n elsif defined?(APP_ROOT)\n base_path = APP_ROOT\n else\n raise \"You must set either Rails.root, APP_ROOT or pass :felix_home as a parameter so I know where felix is\" unless params[:felix_home]\n end\n felix_server.felix_home = params[:felix_home] || File.expand_path(File.join(base_path, 'felix'))\n ENV['FELIX_HOME'] = felix_server.felix_home\n felix_server.port = params[:felix_port] || 8080\n felix_server.startup_wait = params[:startup_wait] || 60\n felix_server.java_opts = params[:java_opts] || []\n return felix_server\n end",
"def start_manager\n if !Invoker::CONFIG.processes || Invoker::CONFIG.processes.empty?\n raise Invoker::Errors::InvalidConfig.new(\"No processes configured in config file\")\n end\n install_interrupt_handler()\n unix_server_thread = Thread.new { Invoker::CommandListener::Server.new() }\n thread_group.add(unix_server_thread)\n run_power_server()\n Invoker::CONFIG.processes.each { |process_info| add_command(process_info) }\n at_exit { kill_workers }\n start_event_loop()\n end",
"def start()\n %x( zkServer.sh --config \"#{@configDir}\" start )\n if $?.exitstatus != 0\n raise RuntimeError, \"CloudRDBMS node #{@address} failed to start zk server\"\n end\n end",
"def startup\n end",
"def start(appName)\n @put.normal \"Starting thin for #{appName}\"\n command = @system.execute( \"#{@thinPath} start -C /etc/thin/#{appName}.yml\" )\n if command.success?\n @put.confirm\n else\n @put.error \"Could not start Thin\"\n exit\n end\n end",
"def startup_script\n return <<-END\n#!/bin/sh\nPID=#{var}/spool/exim/exim-daemon.pid\ncase \"$1\" in\nstart)\n echo \"starting exim mail transfer agent\"\n #{bin}/exim -bd -q30m\n ;;\nrestart)\n echo \"restarting exim mail transfer agent\"\n /bin/kill -15 `/bin/cat $PID` && sleep 1 && #{bin}/exim -bd -q30m\n ;;\nstop)\n echo \"stopping exim mail transfer agent\"\n /bin/kill -15 `/bin/cat $PID`\n ;;\n*)\n echo \"Usage: #{bin}/exim_ctl {start|stop|restart}\"\n exit 1\n ;;\nesac\nEND\n end",
"def start\n raise \"ferret_server not configured for #{RAILS_ENV}\" unless (@cfg.uri rescue nil)\n platform_daemon { run_drb_service }\n end",
"def create_file\n\n #open the file and put new values in\n Chef::Log.debug \"DEBUG: Creating file #{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf!\"\n ::File.open(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf\", \"w\") do |f|\n\n f.puts \"[#{ @new_resource.pool_name }]\"\n\n f.puts \";###### Base Pool Configuration\"\n f.puts \"user = #{ @new_resource.pool_user }\"\n f.puts \"group = #{ @new_resource.pool_group }\"\n if !@current_resource.use_sockets\n f.puts \"listen = #{ @new_resource.listen_address }:#{ @new_resource.listen_port }\"\n else\n f.puts \"listen = #{ @new_resource.listen_socket }\"\n end\n\n @current_resource.listen_allowed_clients != nil ? (f.puts \"listen.allowed_clients = #{ @new_resource.listen_allowed_clients }\") : nil\n @current_resource.listen_owner != nil ? (f.puts \"listen.owner = #{ @new_resource.listen_owner }\") : nil\n @current_resource.listen_group != nil ? (f.puts \"listen.group = #{ @new_resource.listen_group }\") : nil\n @current_resource.listen_mode != nil ? (f.puts \"listen.mode = #{ @new_resource.listen_mode }\") : nil\n @current_resource.listen_backlog != nil ? (f.puts \"listen.backlog = #{ @new_resource.listen_backlog }\") : nil\n\n f.puts \";###### PM Configuration\"\n @current_resource.pm != nil ? (f.puts \"pm = #{ @new_resource.pm }\") : nil\n @current_resource.pm_max_children != nil ? (f.puts \"pm.max_children = #{ @new_resource.pm_max_children }\") : nil\n @current_resource.pm_start_servers != nil ? (f.puts \"pm.start_servers = #{ @new_resource.pm_start_servers }\") : nil\n @current_resource.pm_min_spare_servers != nil ? (f.puts \"pm.min_spare_servers = #{ @new_resource.pm_min_spare_servers }\") : nil\n @current_resource.pm_max_spare_servers != nil ? (f.puts \"pm.max_spare_servers = #{ @new_resource.pm_max_spare_servers }\") : nil\n @current_resource.pm_process_idle_timeout != nil && !node[:platform_version].include?(\"10.04\") ? (f.puts \"pm.process_idle_timeout = #{ @new_resource.pm_process_idle_timeout }\") : nil\n @current_resource.pm_max_requests != nil ? (f.puts \"pm.max_requests = #{ @new_resource.pm_max_requests }\") : nil\n @current_resource.pm_status_path != nil ? (f.puts \"pm.status_path = #{ @new_resource.pm_status_path }\") : nil\n\n f.puts \";###### Ping Status\"\n @current_resource.ping_path != nil ? (f.puts \"ping.path = #{ @new_resource.ping_path }\") : nil\n @current_resource.ping_response != nil ? (f.puts \"ping.response = #{ @new_resource.ping_response }\") : nil\n\n f.puts \";###### Logging\"\n @current_resource.access_format != nil && !node[:platform_version].include?(\"10.04\") ? (f.puts \"access.format = #{ @new_resource.access_format }\".gsub! '\\\\', '') : nil\n @current_resource.request_slowlog_timeout != nil ? (f.puts \"request_slowlog_timeout = #{ @new_resource.request_slowlog_timeout }\") : nil\n @current_resource.request_terminate_timeout != nil ? (f.puts \"request_terminate_timeout = #{ @new_resource.request_terminate_timeout }\") : nil\n @current_resource.access_log != nil ? (f.puts \"access.log = #{ @new_resource.access_log }\") : nil\n @current_resource.slow_log != nil ? (f.puts \"slowlog = #{ @new_resource.slow_log }\") : nil\n\n f.puts \";###### Misc\"\n @current_resource.chdir != nil ? (f.puts \"chdir = #{ @new_resource.chdir }\") : nil\n @current_resource.chroot != nil ? (f.puts \"chroot = #{ @new_resource.chroot }\") : nil\n @current_resource.catch_workers_output != nil ? (f.puts \"catch_workers_output = #{ @new_resource.catch_workers_output }\") : nil\n @current_resource.security_limit_extensions != nil && !node[:platform_version].include?(\"10.04\") ? (f.puts \"security.limit_extensions = #{ @new_resource.security_limit_extensions }\") : nil\n @current_resource.rlimit_files != nil ? (f.puts \"rlimit_files = #{ @new_resource.rlimit_files }\") : nil\n @current_resource.rlimit_core != nil ? (f.puts \"rlimit_core = #{ @new_resource.rlimit_core }\") : nil\n\n f.puts \";##### PHP INI Values\"\n if !@new_resource.php_ini_values.nil?\n @new_resource.php_ini_values.each do | k, v |\n f.puts \"php_value[#{ k }] = #{ v }\"\n end\n end\n\n f.puts \";##### PHP INI Flags\"\n if !@new_resource.php_ini_flags.nil?\n @new_resource.php_ini_flags.each do | k, v |\n f.puts \"php_flag[#{ k }] = #{ v }\"\n end\n end\n\n f.puts \";##### PHP INI Admin Values\"\n if !@new_resource.php_ini_admin_values.nil?\n @new_resource.php_ini_admin_values.each do | k, v |\n f.puts \"php_admin_value[#{ k }] = #{ v }\"\n end\n end\n\n f.puts \";##### PHP INI Admin Flags\"\n if !@new_resource.php_ini_admin_flags.nil?\n @new_resource.php_ini_admin_flags.each do | k, v |\n f.puts \"php_admin_flag[#{ k }] = #{ v }\"\n end\n end\n\n f.puts \";##### ENV Variables\"\n if !@new_resource.env_variables.nil?\n @new_resource.env_variables.each do | k, v |\n f.puts \"env[#{ k }] = #{ v }\"\n end\n end\n\n end\n\nend",
"def process_config\n input = File.open(\"lib/templates/config_template.sh\",\"r\")\n config = input.read\n input.close()\n output = File.new(@bigframe_home + \"/conf/config.sh\", \"w\") \n if output\n output.syswrite(config %[@hadoop_home, @tpchds_local])\n end\n output.close()\n end",
"def start\n puts \"=> Padrino/#{Padrino.version} has taken the stage #{Padrino.env} at http://#{options[:Host]}:#{options[:Port]}\"\n [:INT, :TERM].each { |sig| trap(sig) { exit } }\n super do |server|\n server.threaded = true if server.respond_to?(:threaded=)\n end\n ensure\n puts \"<= Padrino leaves the gun, takes the cannoli\" unless options[:daemonize]\n end",
"def save_configuration_files(server)\n puts \"Saving config files\"\n object_behavior(server, :spot_check_command, 'mkdir -p /root/start_stop_backup')\n object_behavior(server, :spot_check_command, 'cp /etc/postfix/main.cf /root/start_stop_backup/.')\n object_behavior(server, :spot_check_command, 'cp /etc/syslog-ng/syslog-ng.conf /root/start_stop_backup/.')\n end",
"def ensure_running\n agent_status = `service logicmonitor-agent status`\n if agent_status.include?(\"not running\")\n puts \"LogicMonitor collector isn't running\"\n puts `service logicmonitor-agent start`\n else\n puts \"LogicMonitor collector is running\"\n end\n\n watchdog_status = `service logicmonitor-watchdog status`\n if watchdog_status.include?(\"not running\")\n puts \"LogicMonitor watchdog isn't running\"\n puts `service logicmonitor-watchdog start`\n end\nend",
"def start\n @config[:start]\n end",
"def start\n create_machine :config_id => self.setting, :cluster_number => 1\n end",
"def create\n @conf[:sandboxes].each do |v|\n create_sandbox(v)\n add_dispatching(v)\n end\n start_monit\n save_conf CONF_FILE\n end",
"def start\n system(\"ruby #{DAEMON} &\")\n end",
"def start_config_cmd(config)\n log_append = File.exist?(config['db_config_logpath']) ? '--logappend' : ''\n\n [\"cd #{DB_BIN_PATH}\",\n \"./mongod --configsvr --bind_ip #{config['host'] || LOCAL_IP} --port #{config['db_config_port']} \" +\n \"--dbpath #{config['db_config_dbpath']} --logpath #{config['db_config_logpath']} \" +\n \"--fork #{log_append}\"\n ].join(';')\nend",
"def sidekiq_setup\n Sidekiq.configure_server do |config|\n config.server_middleware do |chain|\n chain.add SidekiqPrometheus::JobMetrics\n end\n\n if periodic_metrics_enabled?\n config.on(:startup) { SidekiqPrometheus::PeriodicMetrics.reporter.start }\n config.on(:shutdown) { SidekiqPrometheus::PeriodicMetrics.reporter.stop }\n end\n\n config.on(:startup) { SidekiqPrometheus.metrics_server }\n config.on(:shutdown) { SidekiqPrometheus.metrics_server.kill }\n end\n end",
"def configure_and_run(params = [])\n config_file = Configuration::DEFAULT_CONFIG_FILE_NAME\n tmp_config = Configuration.new\n action_wizard = false\n\n parser = OptionParser.new do |opts|\n opts.banner = if ENV['OCRA_EXECUTABLE']\n \"Usage: #{ENV['OCRA_EXECUTABLE'].gsub(\"#{Dir.pwd}/\".gsub('/', '\\\\'), '')} [options]\"\n else\n \"Usage: #{Gem.ruby} #{$PROGRAM_NAME} [options]\"\n end\n\n opts.on('-c', '--config CONFIG_FILE_NAME', 'Specify custom configuration file,'\\\n \" instead of #{Configuration::DEFAULT_CONFIG_FILE_NAME}.\") do |file_name|\n config_file = file_name\n end\n\n opts.on('-r', '--register FILE', 'Register a custom plugin, e.g. your own Datasource implementation') do |plugin|\n require plugin\n end\n\n opts.on('-d', '--debug LEVEL', 'Specify detail level: FATAL, ERROR, WARN, INFO, DEBUG.') do |level|\n tmp_config.set_param('grafana-reporter:debug-level', level)\n end\n\n opts.on('-o', '--output FILE', 'Output filename if only a single file is rendered') do |file|\n tmp_config.set_param('to_file', file)\n end\n\n opts.on('-s', '--set VARIABLE,VALUE', Array, 'Set a variable value, which will be passed to the '\\\n 'rendering') do |list|\n raise ParameterValueError, list.length unless list.length == 2\n\n tmp_config.set_param(\"default-document-attributes:#{list[0]}\", list[1])\n end\n\n opts.on('--ssl-cert FILE', 'Manually specify a SSL cert file for HTTPS connection to grafana. Only '\\\n 'needed if not working properly otherwise.') do |file|\n if File.file?(file)\n tmp_config.set_param('grafana-reporter:ssl-cert', file)\n else\n config.logger.warn(\"SSL certificate file #{file} does not exist. Setting will be ignored.\")\n end\n end\n\n opts.on('--test GRAFANA_INSTANCE', 'test current configuration against given GRAFANA_INSTANCE') do |instance|\n tmp_config.set_param('grafana-reporter:run-mode', 'test')\n tmp_config.set_param('grafana-reporter:test-instance', instance)\n end\n\n opts.on('-t', '--template TEMPLATE', 'Render a single ASCIIDOC template to PDF and exit') do |template|\n tmp_config.set_param('grafana-reporter:run-mode', 'single-render')\n tmp_config.set_param('default-document-attributes:var-template', template)\n end\n\n opts.on('-w', '--wizard', 'Configuration wizard to prepare environment for the reporter.') do\n action_wizard = true\n end\n\n opts.on('-v', '--version', 'Version information') do\n puts GRAFANA_REPORTER_VERSION.join('.')\n return -1\n end\n\n opts.on('-h', '--help', 'Show this message') do\n puts opts\n return -1\n end\n end\n\n begin\n parser.parse!(params)\n return ConsoleConfigurationWizard.new.start_wizard(config_file, tmp_config) if action_wizard\n rescue ApplicationError => e\n puts e.message\n return -1\n end\n\n # abort if config file does not exist\n unless File.file?(config_file)\n puts \"Config file '#{config_file}' does not exist. Consider calling the configuration wizard\"\\\n ' with option \\'-w\\' or use \\'-h\\' to see help message. Aborting.'\n return -1\n end\n\n # merge command line configuration with read config file\n @config.load_config_from_file(config_file)\n @config.merge!(tmp_config)\n\n run\n end",
"def default_ctl_listen\n socket_name = if service_name == 'supervisor'\n 'supervisor.sock'\n else\n \"supervisor-#{service_name}.sock\"\n end\n # File.join is largely symbolic, this can't run on Windows anyway.\n ::File.join('', 'tmp', socket_name)\n end",
"def startup!\n @started = true\n really_try(:did_start_up) if respond_to?(:did_start_up)\n\n if config['nickserv_password']\n privmsg(\"identify #{config['nickserv_password']}\", \"nickserv\")\n # Wait 10 seconds for nickserv to get back to us.\n Thread.new do\n sleep(10)\n finalize_startup\n end\n else\n finalize_startup\n end\n end",
"def configure\n @environment = facts.fetch(\"chef_environment\"){\"development\"}.downcase\n @fqdn = facts.fetch(\"fqdn\"){\"\"}\n @app_names = facts.fetch(\"trebuchet\"){[]}\n end",
"def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/sh ./#{SETUP_ENV_SCRIPT}\"\n end",
"def start\n logger.debug \"Starting felix with these values: \"\n logger.debug \"felix_home: #{@felix_home}\"\n logger.debug \"felix_command: #{felix_command.join(' ')}\"\n \n # Check to see if we can start.\n # 1. If there is a pid, check to see if it is really running\n # 2. Check to see if anything is blocking the port we want to use \n if pid\n if Felixwrapper.is_pid_running?(pid)\n raise(\"Server is already running with PID #{pid}\")\n else\n logger.warn \"Removing stale PID file at #{pid_path}\"\n File.delete(pid_path)\n end\n end\n\n if Felixwrapper.is_port_in_use?(self.port)\n raise(\"Port #{self.port} is already in use.\")\n end\n\n Dir.chdir(@felix_home) do\n process.start\n end\n FileUtils.makedirs(pid_dir) unless File.directory?(pid_dir)\n begin\n f = File.new(pid_path, \"w\")\n rescue Errno::ENOENT, Errno::EACCES\n f = File.new(File.join(@base_path,'tmp',pid_file),\"w\")\n end\n f.puts \"#{process.pid}\"\n f.close\n logger.debug \"Wrote pid file to #{pid_path} with value #{process.pid}\"\n startup_wait!\n end",
"def script_directory\n '/etc/init'\n end",
"def install_crontab\n # create a working crontab file\n f = File.open(CRONTAB, 'w')\n f.write \"MAIL='keburgett@gmail.com'\\n\"\n # for each sprinkle, write a crontab entry for OPEN and CLOSE times.\n Sprinkle.all.each do |s|\n [AppConstants::OPEN, AppConstants::CLOSE].each do |action|\n crontab_line = \"#{s.to_crontab(action)} sh #{valve_actuator_path} #{s.valve.to_crontab(action)} #{host_with_port}\\n\" \n f.write crontab_line\n # #logger.info crontab_line\n end\n end\n f.close\n system(\"crontab #{CRONTAB}\")\n end",
"def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/bash ./#{SETUP_ENV_SCRIPT}\"\n end",
"def ssh_service_restart\n exec(Beaker::Command.new(\"stopsrc -g ssh\"))\n exec(Beaker::Command.new(\"startsrc -g ssh\"))\n end",
"def ensure_start\n start\n sv_command('start') if supervised?\n end",
"def services\n if dockerized?\n puts \"Running inside of a docker container\"\n puts \"No systemd support, skipping service activation\"\n return\n end\n\n # portusctl runs as root and creates this file for the 1st time, so\n # we must fix its permissions\n FileUtils.chown_R(\"root\", \"www\", \"/srv/Portus/log/production.log\")\n FileUtils.chmod_R(0o664, \"/srv/Portus/log/production.log\")\n\n services = [\n [\"portus_crono\", false],\n [\"apache2\", true]\n ]\n services << [\"mysql\", false] if database_local?\n services << [\"registry\", true] if @options[\"local-registry\"]\n services.each do |service|\n Runner.activate_service(service[0], service[1])\n end\n end",
"def default_config_options\n ini_data = {\n supervisord: config,\n supervisorctl: {},\n 'rpcinterface:supervisor' => {'supervisor.rpcinterface_factory' => 'supervisor.rpcinterface:make_main_rpcinterface'},\n 'include' => {files: ::File.join(confd_path, '*.conf') },\n }\n # Are we using unix or inet?\n if ctl_is_inet?\n # Either numeric or IP/port, means inet.\n ini_data[:inet_http_server] = {port: ctl_listen}\n ini_data[:inet_http_server][:password] = ctl_password if ctl_password\n ini_data[:inet_http_server][:username] = ctl_username if ctl_username\n ini_data[:supervisorctl][:serverurl] = \"http://#{@ctl_bind_host}:#{@ctl_bind_port}\"\n else\n # Otherwise, Unix sockets.\n ini_data[:unix_http_server] = {file: ctl_listen}\n ini_data[:unix_http_server][:password] = ctl_password if ctl_password\n ini_data[:unix_http_server][:username] = ctl_username if ctl_username\n # Maybe deal with chmod somehow? Defaults are safe I think.\n if owner\n chown = owner.dup\n if group\n chown << ':'\n chown << group\n end\n ini_data[:unix_http_server][:chown] = chown\n end\n ini_data[:supervisorctl][:serverurl] = \"unix://#{ctl_listen}\"\n end\n ini_data[:supervisorctl][:password] = ctl_password if ctl_password\n ini_data[:supervisorctl][:username] = ctl_username if ctl_username\n {ini: ini_data}\n end",
"def daemonize\n\n # ensure pid file and log file are writable if provided\n pid_path = options[:pid_path] ? writable_file(options[:pid_path]) : nil\n log_path = options[:log_path] ? writable_file(options[:log_path]) : nil\n\n unless fork\n Process.setsid\n exit if fork\n File.umask 0000\n Dir.chdir \"/\"\n\n # save pid file\n File.open(pid_path, 'w') { |f| f.write Process.pid } if pid_path\n\n # redirect our io\n setup_logging(log_path)\n\n # trap and ignore SIGHUP\n Signal.trap('HUP') {}\n\n # trap reopen our log files on SIGUSR1\n Signal.trap('USR1') { setup_logging(log_path) }\n\n return true\n end\n\n Process.waitpid\n unless wait_until { daemon_running? }\n raise ServiceError, \"failed to start #{name} service\"\n end\n end",
"def start\n system(\"start-stop-daemon --start --chdir #{path} --chuid #{user} --exec #{daemon}\")\n end",
"def setup\n @logger.info \"initializing the supervisor\"\n end",
"def start\n server.synchronize do\n fail 'server is already running' if started?\n fail 'provide server address' if cfg.address.nil?\n\n FileUtils.mkdir_p(server.runsv_dir)\n run = File.join(server.runsv_dir, 'run')\n\n ErbTemplate.render_to('runsv', {\n name: server.name,\n address: cfg.address,\n netif: cfg.netif,\n }, run)\n\n File.chmod(0755, run)\n File.symlink(server.runsv_dir, service_link)\n end\n end",
"def start_command\n \"./bin/catalina.sh run\"\n end",
"def notify_startable_storm_services\n notify_startable_services(:storm, storm_services)\n end",
"def start_monitor(analyzer_id, port)\n if Sticky_ID != -1 && Regions.find(Analyzers.find(analyzer_id).region_id).server_id != Sticky_ID\n $logger.debug \"This analyzer is not on this server.\"\n return\n end\n $logger.debug \"START MONITOR\"\n $loggers[analyzer_id].debug \"START MONITOR\" if $is_debug\n analyzer = Analyzers.find(analyzer_id)\n opts={\n :ARGV => ['start', analyzer_id.to_s, port.to_s]\n }\n script = File.join(File.dirname(__FILE__), \"monitor.rb\")\n child_process = Kernel.fork()\n if (child_process.nil?)\n # In Child process\n @sock.close if (!@sock.nil?)\n @server.close if (!@server.nil?)\n stdfname = File.join(File.dirname(__FILE__), \"../../log/monitorstd_#{analyzer_id}\")\n stdin = open '/dev/null', 'r'\n outio = stdfname+\".out\"\n errio = stdfname+\".err\"\n if $is_debug\n outio += \".dug\"\n errio += \".dug\"\n end\n\n stdout = open outio, 'a'\n stderr = open errio, 'a'\n $0 = sprintf(\"%s_%s_%s\", $0, analyzer.ip, port)\n #STDIN.close\n #STDIN.reopen stdin\n STDOUT.reopen stdout\n STDERR.reopen stderr\n #STDIN.open('/dev/null')\n #STDOUT.open(stdfname,'a')\n #STDERR.open(stdfname,'a')\n Kernel.exec(script, analyzer_id.to_s, port.to_s, $is_debug.to_s)\n exit\n end\n #parent process continues\n Process.detach(child_process)\n $logger.debug \"Monitor Forked\"\n end",
"def before_exec_command\n end",
"def install_crontab\n # create a working crontab file\n # log \"Building crontab\\n\"\n f = File.open(CRONTAB, 'w')\n f.write \"MAIL='keburgett@gmail.com'\\n\"\n # for each sprinkle, write a crontab entry for OPEN and CLOSE times.\n p = Porter.first.localhost_with_port # provides host:port combination\n Sprinkle.all.each do |s|\n [OPEN, CLOSE].each do |action|\n crontab_line = \"#{s.to_crontab(action)} sh #{valve_actuator_path} #{s.valve.to_crontab(action)} #{p} #{s.id}\\n\" \n f.write crontab_line\n # log \"#{crontab_line}\\n\"\n end\n end\n f.close\n system(\"crontab #{CRONTAB}\")\n end",
"def start\n puts \"Starting clusters...\"\n for app in @apps\n if @env == :deployment\n #need to check if application has a pid file so we don't start\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n raise \"pid file already exists for #{pid_file}\" if File.exist?(pid_file)\n cmd = \"rackup #{@config} -p #{app[:port]} -E #{@env.to_s} -s #{@server} -o #{app[:ip]} #{@daemonize} -P #{pid_file}\" \n puts \"=> #{cmd}\"\n system(cmd)\n else\n cmd = \"rackup #{@config} -p #{app[:port]} -E #{@env.to_s} -s #{@server} -o #{app[:ip]}\" \n puts \"=> #{cmd}\"\n system(cmd)\n break\n end\n end\n puts \"Did they start?\"\n system(\"ps -aux | grep rackup\")\nend",
"def _start_monitor(analyzer_id, port)\n $logger.debug \"_START MONITOR\"\n opts={\n :ARGV => ['restart', analyzer_id.to_s, port.to_s],\n :multiple => true,\n :monitor => true,\n :backtrace => true,\n :mode => :exec,\n :log_output => File.join(File.dirname(__FILE__), '../../log/monitor.out'+($is_debug ? \".dug\" :\"\"))\n }\n script = File.join(File.dirname(__FILE__), \"monitor.rb\")\n #Child process execs\n #ObjectSpace.each_object(IO) {|io| io.close rescue nil }\n app = Daemons.run(script, opts)\n $logger.debug \"------------------------------------------->\"\n $logger.debug app.inspect()\n $logger.debug \"<-------------------------------------------\"\n #parent process continues\n end",
"def hot_restart\n fork do\n # Let the new server know where to find the file descriptor server\n ENV[FILE_DESCRIPTOR_SERVER_VAR] = file_descriptor_server.socket_path\n\n Dir.chdir(ENV['APP_ROOT']) if ENV['APP_ROOT']\n ENV.delete('BUNDLE_GEMFILE') # Ensure a fresh bundle is used\n\n exec(\"bundle exec #{server_configuration.start_command}\")\n end\n end",
"def event_startup()\n require 'md5'\n\n # Generate a random AES session key first thing\n @connection.comm.keyring.rekey!\n\n # This is where we load the user's public and private key from the env.yml\n # configuration file. If it's not there, we spawn a helpful creation tool.\n # This tool MUST return public key, private key, and user-name.\n unless @var[:our_name] and @var[:pub_rsa] and @var[:prv_rsa]\n @var[:our_name], @var[:pub_rsa], @var[:prv_rsa] = keygen_tool()\n if @var[:our_name] and @var[:prv_rsa].to_s =~ /[0-9a-f]+:[0-9a-f]+/ and\n @var[:pub_rsa].to_s =~ /[0-9a-f]+:[0-9a-f]+/\n _save_env\n else\n add_error(\"YOU HAVE NO KEYS! TOOL MUST BE CALLED.\")\n Kernel.exit(0)\n end\n end\n @connection.comm.initialize_address_book(@var[:pub_rsa], @var[:prv_rsa],\n @var[:our_name])\n\n _network_init\n\n # Startup the timer thread\n Thread.new do\n loop do\n sleep 15\n dispatch :timer\n end\n end\n\n # Auto-connect?\n local_connect('') if @var[:auto_connect]\nend",
"def configHost\n unless File.open('nagios.cfg').read() =~ /hosts.cfg/ && File.open('nagios.cfg').read() =~ /services.cfg/\n\tcfg = File.read('nagios.cfg')\n\tcfg = cfg.gsub(/templates.cfg/, \"templates.cfg\\ncfg_file=/usr/local/nagios/etc/hosts.cfg\\ncfg_file=/usr/local/nagios/etc/services.cfg\")\n\tFile.open('nagios.cfg', 'w') { |file| file.puts cfg }\n end\n File.open('hosts.cfg', 'a+') { |file|\n\tfile.puts \"define host{\\nname\\t\\t\\tlinux-box\\nuse\\t\\t\\tgeneric-host\\ncheck_period\\t\\t24x7\\ncheck_interval\\t\\t5\\nretry_interval\\t\\t1\\nmax_check_attempts\\t10\\ncheck_command\\t\\tcheck-host-alive\\nnotification_period\\t24x7\\nnotification_interval\\t30\\nnotification_options\\td,r\\ncontact_groups\\t\\tadmins\\nregister\\t\\t\\t0\\n}\\n\" unless File.open('hosts.cfg').read() =~ /name\\t\\t\\tlinux-box/\n\t@names.length.times do |x|\n\t file.puts \"define host{\\nuse\\t\\t\\tlinux-box\\nhost_name\\t\\t#{@names[x]}\\nalias\\t\\t\\t#{@names[x]}\\naddress\\t\\t\\t#{@ips[x]}\\n}\\n\\n\"\n\tend\n }\n File.open('services.cfg', 'a') { |file| \n @names.length.times do |x|\n file.puts \"define service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCPU Load\\n\\tcheck_command\\t\\tcheck_nrpe!check_load\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tTotal Processes\\n\\tcheck_command\\t\\tcheck_nrpe!check_total_procs\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCurrent Users\\n\\tcheck_command\\t\\tcheck_nrpe!check_users\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tSSH\\n\\tcheck_command\\t\\tcheck_ssh\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tPING\\n\\tcheck_command\\t\\tcheck_ping!100.0,20%!500.0,60%\\n}\\n\\n\" \n end\n }\n end"
] |
[
"0.5744976",
"0.5652129",
"0.5627625",
"0.55946445",
"0.555321",
"0.5506026",
"0.5491714",
"0.5488017",
"0.5487081",
"0.54798007",
"0.547484",
"0.54664207",
"0.54534304",
"0.54130334",
"0.5410498",
"0.5402819",
"0.5366143",
"0.5358174",
"0.53487986",
"0.53475213",
"0.5308171",
"0.52882624",
"0.52852005",
"0.52746123",
"0.52699685",
"0.52642274",
"0.5263656",
"0.52597135",
"0.524834",
"0.524834",
"0.524834",
"0.5248229",
"0.52467465",
"0.524571",
"0.5243534",
"0.5240555",
"0.52254456",
"0.5223796",
"0.5221682",
"0.52215016",
"0.52213705",
"0.5216023",
"0.5212668",
"0.52053607",
"0.519617",
"0.51932585",
"0.51925606",
"0.5188884",
"0.51785",
"0.5178312",
"0.5175674",
"0.5172712",
"0.5170704",
"0.5170597",
"0.51629317",
"0.51366115",
"0.51246035",
"0.5118122",
"0.5108578",
"0.51068646",
"0.5099593",
"0.5099091",
"0.50905824",
"0.5090454",
"0.50889325",
"0.50848603",
"0.50819063",
"0.50704205",
"0.50645936",
"0.5060021",
"0.50562817",
"0.5055873",
"0.505561",
"0.50498104",
"0.50481445",
"0.5046339",
"0.50460577",
"0.5044773",
"0.5042772",
"0.5040975",
"0.5038409",
"0.50331604",
"0.50307935",
"0.5022156",
"0.5021927",
"0.50194675",
"0.50175965",
"0.5015846",
"0.50151443",
"0.5013365",
"0.5012546",
"0.50097305",
"0.50077575",
"0.5007623",
"0.5007489",
"0.5003755",
"0.49913454",
"0.4987953",
"0.4986459",
"0.49864304"
] |
0.7807695
|
0
|
The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is repeated exactly k times. Note: k is guaranteed to be a positive integer. For s = "4[ab]", the output should be decodeString(s) = "abababab" For s = "2[b3[a]]", the output should be decodeString(s) = "baaabaaa" Note: this solution only works with 2 levels of nested square brackets
|
def replace_encoded(str, regex)
str.scan(regex).each do |x|
str = str.sub("#{x[0]}[#{x[1]}]", x[1] * x[0].to_i)
end
str
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def decodeString(s)\n 1 while s.gsub!(/(\\d+)\\[([a-z]*)\\]/) { $2 * $1.to_i }\n s\nend",
"def decode(str)\n result = \"\"\n str.chars.each_with_index do |el, idx|\n if idx % 2 == 0\n key = str[idx + 1].to_i\n key.times do\n result += el\n end\n end\n end\n result\nend",
"def encode_repeating(my_string)\n puts my_string\n\n if my_string == \"\" || my_string == nil || my_string.length == 0\n return my_string\n end\n\n\n new_arr = []\n hash = {}\n i = 0\n while i < my_string.length\n\n char = my_string[i]\n print char\n\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n\n i += 1\n\n end\n\n puts hash\n\n\n hash.each do |k, v|\n if v <= 2\n v.times do\n new_arr << k\n end\n elsif v > 2\n new_arr << k\n new_arr << v\n end\n end\n\n puts new_arr\n puts new_arr.join\n\n my_string = new_arr.join\n return my_string\n # raise NotImplementedError\nend",
"def decode(e)\n current = e[0]\n if current != \"1\" or current != \"0\"\n return \"Could not decode, malformed encoded input\"\n end\n\n final = []\n\n e[1..e.length].split(\"\").each do |r|\n r.to_i.times { final.push current } \n current = (current == \"0\") ? \"1\" : \"0\"\n end\n final.join\nend",
"def run_encode(text)\n text.scan(/(.)(\\1*)/).reduce([]) {|arr,match| arr << [ match[1].length + 1, match[0] ]}\nend",
"def encode_repeating(my_string)\n # return if nil or empty\n return if (my_string == nil || my_string.length == 0)\n\n entering_index = 0 # this is where characters will get replaced\n examining_index = 0 # this is where the current character is getting examined and counted\n length = my_string.length\n while examining_index < length # all n characters will be examined\n temp = my_string[examining_index] # current character\n count = 1 # current character count\n while my_string[examining_index+1] == temp && examining_index < length\n examining_index += 1 # increment index\n count += 1 # increment current character count\n end\n # update at entering_index on seeing the subsequent character changing\n if count > 2 # enter the current character followed by it's count\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n my_string[entering_index] = count.to_s\n entering_index += 1\n elsif count == 2 # enter the current character twice\n count.times do\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n end\n else # count == 1, enter the current character once\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n end\n examining_index += 1 # move to next character\n end\n\n # delete trailing characters in the string.\n count = length - entering_index\n count.times do # worst case: delete n-2 number of characters\n my_string.slice! entering_index # trim the string\n end\n return\nend",
"def encode_repeating(my_string)\n return nil if my_string.nil?\n return my_string if my_string.length <= 1\n\n i = 0\n j = 0\n k = 0\n while j <= i && i < my_string.length\n k = i\n if my_string[i] != my_string[i + 1]\n my_string[j] = my_string[i]\n\n else\n counter = 1\n while my_string[i] == my_string[i + 1]\n i += 1\n counter += 1\n end\n\n if counter == 2\n my_string[j] = my_string[k]\n my_string[j + 1] = my_string[k]\n else\n my_string[j] = my_string[k]\n my_string[j + 1] = counter.to_s\n end\n j += 1\n end\n j += 1\n i += 1\n end\n\n my_string[j...my_string.length] = \"\"\n return my_string\nend",
"def num_decodings(s)\n return 0 if !s || s == '0'\n return 1 if s.size == 1\n dp = [0] * (s.size + 1)\n dp[0] = 1\n dp[1] = s[0] == '0' ? 0 : 1\n\n for i in 2..s.size do \n char = s[i - 1].to_i\n chars = s[(i - 2)..(i - 1)].to_i\n\n if char >= 1 && char <= 9\n dp[i] += dp[i - 1]\n end\n\n if chars >= 10 && chars <= 26\n dp[i] += dp[i - 2]\n end\n end\n\n dp.last\nend",
"def encode_repeating(my_string)\r\n i = 0\r\n j = 0\r\n letter = my_string[i]\r\n while i < my_string.length\r\n j += 1 while my_string[j + 1] == letter\r\n if j - i >= 2\r\n my_string[(i + 1)..j] = (j - i + 1).to_s\r\n end\r\n additional = 0\r\n additional = 1 if j > i\r\n i += 1 + additional\r\n j = i\r\n letter = my_string[i]\r\n end\r\n return my_string\r\nend",
"def decode(s)\n i = 0\n base = ALPHABET.length\n s.each_char { |c| i = i * base + ALPHABET.index(c) }\n i\n end",
"def encode_repeating(my_string)\n\n return nil if my_string.nil?\n\n start = 0\n\n until my_string[start].nil?\n\n count = 1\n\n while my_string[start + count] == my_string[start]\n count += 1\n end\n\n if count < 3\n start += count\n else\n my_string[start + 1] = count.to_s\n my_string.slice!(start + 2, count - 2)\n start += 2\n end\n\n end\n\n return my_string\n\nend",
"def reverse_str(s, k)\n new_str = \"\"\n current_start_idx = 0\n \n s.each_char.with_index do |char, idx|\n if ((idx + 1) % (2 * k)) == 0\n new_str << s[current_start_idx..current_start_idx + k - 1].reverse\n new_str << s[current_start_idx + k..idx]\n current_start_idx = idx + 1\n end\n end\n new_str << s[current_start_idx..current_start_idx + k - 1].reverse\n remaining_chars = s[current_start_idx + k ..-1]\n new_str << remaining_chars if remaining_chars\n new_str\nend",
"def encode_repeating(my_string)\n return my_string if !my_string || my_string.length < 2\n current, check_next = 0, 1\n until current == my_string.length\n check_next += 1 while my_string[current] == my_string[check_next]\n repeats = check_next - current\n if repeats > 2\n my_string[current + 1] = repeats.to_s\n check_next -= my_string.slice!((current + repeats.to_s.length + 1)...check_next).length\n end\n current = check_next\n end\n return my_string\nend",
"def decode1(str)\n num = 0\n i = 0\n while i < str.length\n pow = BASE ** (str.length - i -1)\n num += KEYS.index(str[i]) * pow\n i += 1\n end\n return num\nend",
"def character_replacement(s, k)\n window_start = 0\n window_end = 0\n\n freq = Hash.new(0)\n freq[s[0]] += 1\n\n max_window_size = 0\n\n while window_end < s.length\n window_size = window_end - window_start + 1\n max_window_size = [max_window_size, window_size].max\n\n max_char, max_char_count = freq.max_by{|k,v| v}\n number_of_switches_required = window_size - max_char_count\n if number_of_switches_required < k\n window_end += 1\n freq[s[window_end]] += 1\n next\n end\n\n if number_of_switches_required == k\n window_end += 1\n freq[s[window_end]] += 1\n unless s[window_end] == max_char\n freq[s[window_start]] -= 1\n window_start += 1\n end\n else\n window_end += 1\n freq[s[window_end]] += 1\n\n freq[s[window_start]] -= 1\n window_start += 1\n end\n end\n\n max_window_size\nend",
"def hashing_decode(s)\n \n i = 0\n base = ALPHABET.length\n s.each_char { |c| i = i * base + ALPHABET.index(c) }\n i\n end",
"def decode6(str)\n num = 0\n i = 0\n while i < str.length\n num += KEYS_HASH[str[i]] * (BASE ** (str.length - 1 - i))\n i += 1\n end\n return num\nend",
"def decode(str)\n decoded_word = str.chars\n p decoded_word\n new_string = []\n\n decoded_word.each do |char|\n\n if char.match(/\\d/)\n if char.to_i.zero?\n decoded_word.shift\n else\n decoded_word.shift(char.to_i + 1) # problem child skip 1st index\n end\n p \"h: \", decoded_word\n else\n new_string << char\n next\n end\n end\n p \"end: \", new_string\nend",
"def decode5(str)\n num = 0\n i = 0\n str.each_char do |char|\n pow = BASE ** (str.length - i -1)\n num += KEYS_HASH[char] * pow\n i += 1\n end\n return num\nend",
"def decode s\n i = 0\n s.each_char { |c| i = i * @base + @sequence.index(c) }\n i\n end",
"def decode(encoded)\n encoded.map { |n, e| e.nil? ? n : [e] * n }.flatten\nend",
"def pseudoIsomorphicSubstrings(s)\n\n size = 1 # this show the current size of the set i\n graph = { 0 => {} } # representation of the set sequences\n sizes = []\n\n s_chars = s.chars\n \n s.size.times do |pi| # Si' : Prefix i\n if pi == 0\n sizes << size\n next \n end\n\n substrings = [s_chars[0..pi]]\n\n while !substrings.empty? do\n sub = substrings.pop\n\n sequence = to_sequence(sub) # X\n\n # for every sequence, N-1 must exists and we only check if we can add the last bit\n pos = graph\n sequence[0..-2].each do |bit|\n pos = pos[bit]\n end\n \n next unless pos[sequence.last].nil?\n\n pos[sequence.last] = {}\n size += 1\n\n substrings << sub[1..-1] \n end\n\n sizes << size\n end\n\n sizes\nend",
"def decode(xcimal_str, keys=DEFAULT)\n # check input\n raise \"input should be a string\" unless xcimal_str.is_a? String\n base = keys.length\n return xcimal_str\n .chars\n .reverse\n .each_with_index\n .map{|v, index| keys.index(v) * (base ** index)}\n .reduce{|v, sum| sum = sum + v}\n end",
"def decode(bit_string)\r\n\t\tstr = \"\"\r\n\t\tresult = \"\"\r\n\t\tnode = @tree\r\n\r\n\t\tbit_string.each_char do |ch|\r\n\t\t\tstr += ch\r\n\t\t\tif(ch.to_i == 0 and node.left != nil)\r\n\t\t\t\tnode = node.left\r\n\t\t\t\tif(node.left == nil and node.right == nil)\r\n\t\t\t\t\tresult += @table.key(str)\r\n\t\t\t\t\tstr = \"\"\r\n\t\t\t\t\tnode = @tree\r\n\t\t\t\tend\r\n\t\t\telsif(ch.to_i == 1 and node.right != nil)\r\n\t\t\t\tnode = node.right\r\n\t\t\t\tif(node.left == nil and node.right == nil)\r\n\t\t\t\t\tresult += @table.key(str)\r\n\t\t\t\t\tstr = \"\"\r\n\t\t\t\t\tnode = @tree\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tresult += @table.key(str)\r\n\t\t\t\tstr = \"\"\r\n\t\t\t\tnode = @tree\r\n\t\t\tend\r\n\t\tend\r\n\t\tresult\r\n\tend",
"def encode_repeating(my_string)\n raise NotImplementedError\nend",
"def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend",
"def decode3(str)\n num = 0\n str.each_char.with_index do |char, i|\n pow = BASE ** (str.length - i -1)\n num += KEYS.index(char) * pow\n end\n return num\nend",
"def count_possible_decodings(message)\n return 1 if message.nil? || message.empty? || message.length == 1\n\n possibilities = 0\n num_chars = 1\n loop do\n chars = message[0...num_chars]\n\n # Not enough characters for a bigger slice, or we have a leading zero\n break if chars.length != num_chars\n\n # Can't possibly be an encoded character\n break if chars.to_i > $max_encoded_value\n\n possibilities += count_possible_decodings(message[num_chars..-1])\n num_chars += 1\n end\n\n possibilities\nend",
"def encode(bv)\n code = []\n last = bv[0]\n code.push last\n count = 0\n\n bv.split(\"\").each do |c|\n if c != last \n code.push count\n count = 1 \n else \n count += 1\n end\n last = c\n end\n code.push count\n code.join\nend",
"def num_decodings(s)\n i1, i2 = 1\n count = 0\n (1..s.size).each do |i|\n# s[i-1, 1] i- 1 is position & 1 is how many ele's you want \n count = s[i-1,1] != '0' ? i1 : 0 # if previous was not 0 set to i1\n count += i2 if s[i - 2, 2].between?('10', '26') && i > 1\n i2 = i1\n i1 = count\n end\n count\nend",
"def nested(s)\n return false if s.length.odd?\n return false if s =~ /[^\\[\\]\\(\\)\\{\\}]/\n\n pairs = { '{' => '}', '[' => ']', '(' => ')' }\n\n stack = []\n s.chars do |bracket|\n if expectation = pairs[bracket]\n stack << expectation\n else\n return false unless stack.pop == bracket\n end\n end\n stack.empty?\nend",
"def encode_repeating(my_string)\r\n puts \"NOT IMPLEMENTED\"\r\nend",
"def expand_brackets(string)\n curlies = string.count('{')\n squares = string.count('[')\n\n squares.times do\n string = expand_square(string)\n end\n\n curlies.times do\n string = expand_curly(string)\n end\n\n # Remove duplicates left by my sloppy coding\n if string.respond_to?(:uniq)\n string.uniq.sort\n else\n string\n end\n\n end",
"def run_decode(char_counts)\n char_counts\n .map{|char, count| char * count}\n .join\nend",
"def solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\nend",
"def decode_b(str)\n str.gsub!(/=\\?ISO-2022-JP\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/=\\?SHIFT_JIS\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/\\n/, ' ') \n str.gsub!(/\\0/, '')\n str\n end",
"def multiple_brackets(str)\n return '1' unless str =~ /\\(|\\)|\\[|\\]/\n bracket_count = 0\n if str =~ /\\(|\\)/\n counter = 0\n str.each_char do |char|\n if char == '('\n counter += 1\n bracket_count += 1\n elsif char == ')'\n counter -= 1\n end\n return '0' if counter.negative?\n end\n return '0' unless counter == 0\n end\n if str =~ /\\[|\\]/\n counter = 0\n str.each_char do |char|\n if char == '['\n counter += 1\n bracket_count += 1\n elsif char == ']'\n counter -= 1\n end\n return '0' if counter.negative?\n end\n return '0' unless counter == 0\n end\n \"1 #{bracket_count}\"\nend",
"def decode4(str)\n num = 0\n str.each_char.with_index do |char, i|\n pow = BASE ** (str.length - i -1)\n num += KEYS_HASH[char] * pow\n end\n return num\nend",
"def decode_str\n index_of_last_digit = @index + self[@index..self.length - 1].index(':')\n length_of_string = self[(@index)..(@index + index_of_last_digit - 1)].to_i\n\n # The string itself starts 1 past the index of the last digit (because of the colon)\n # and ends 2 more than the length of the string past the index.\n string = self[(index_of_last_digit + 1)..(index_of_last_digit + length_of_string)]\n\n # Increment index by the length of the string plus the length of the digits.\n @index += index_of_last_digit - @index + length_of_string\n string\n end",
"def decode(str)\n num = 0\n i = 0\n len = str.length - 1\n while i < str.length\n pow = BASE ** (len - i)\n num += KEYS_HASH[str[i]] * pow\n i += 1\n end\n return num\nend",
"def mark_IV_decoder(first_wheel_index,second_wheel_index,encoded_message)\n input_array = encoded_message.split(//)\n wheel_three_index=[0]\n output_array=[]\n for i in 0...input_array.length\n output_char = mark_I_encoder(-2 *Integer(wheel_three_index[i]),input_array[i]).to_s\n output_array.push mark_II_encoder(-first_wheel_index,-second_wheel_index,output_char).to_s\n wheel_three_index[i+1]=$keyboard.index(output_array[i])\n end\n mark_IV_decoded_message = output_array.join\n return mark_IV_decoded_message\nend",
"def encode_repeating(my_string)\r\n return my_string if my_string.length < 3\r\n\r\n engaged = false\r\n counter = 3\r\n n = 0\r\n\r\n while n + 2 < my_string.length\r\n if (engaged && my_string[n] == my_string[n+2]) || (my_string[n] == my_string[n+1] && my_string[n] == my_string[n+2])\r\n engaged = true\r\n my_string[n+1..n+2] = \"#{counter}\" #THIS LINE!\r\n counter += 1\r\n else\r\n engaged = false\r\n counter = 3\r\n n += 1\r\n end\r\n end\r\n\r\n return my_string\r\nend",
"def universal_string(k)\n bin_kmers = []\n (0..(2**k-1)).each {|n| bin_kmers << ( \"%0#{k}b\" % n)}\n puts bin_kmers.join(\" \")\n graph = debruijn_graph_from_kmers(bin_kmers)\n puts graph.to_s\n path = eulerian_path(graph)\n # puts path.join(\" \")\n\n # If there is consecutive same values remove those\n # 000 000 001 010 100 001 011 110 101 010 101 011 111 111 110 100 000\n\n return genome_from_path(path)\n end",
"def hackerrankInString(str)\n expected_chars = %w[h a c k e r r a n k]\n input_chars = str.chars\n\n str.chars.each do |char|\n # Thought so, apparently not: Edge case: there should be no more chars after the last 'k' in hackerrank.\n # break if expected_chars.empty?\n\n input_chars.shift\n expected_chars.shift if char == expected_chars[0]\n end\n\n expected_chars.empty? && input_chars.empty? ? 'YES' : 'NO'\nend",
"def basic_compression(string)\n string = string.split(\"\")\n out = \"\"\n return out if string.empty?\n\n char = string.shift\n count = 1\n out += char\n\n while string[0] == char\n string.shift\n count += 1\n end\n\n out += count.to_s\n out += basic_compression(string.join(\"\"))\n out\nend",
"def bijective_encode(i)\n # from http://refactormycode.com/codes/125-base-62-encoding\n # with only minor modification\n return ALPHABET[0] if i == 0\n s = ''\n base = ALPHABET.length\n while i > 0\n s << ALPHABET[i.modulo(base)]\n i /= base\n end\n s.reverse\nend",
"def decode(input)\n decoded_string = ''\n seekable = PushableString.new(input.dup)\n while seekable.next?\n t = decode_char(seekable)\n if t.nil?\n decoded_string << seekable.next\n else\n decoded_string << t\n end\n end\n decoded_string\n end",
"def v_decode message, key\n message_array = alphabet_number(message.split(\"\"))\n key_array = alphabet_number(make_key_repeat(key.split(\"\"), message_array.length)).take(message_array.length)\n number_alphabet(message_array.map.with_index{ |m,i| (m.to_i - key_array[i].to_i + 1) % 26}).take(message_array.length).join(\"\")\nend",
"def f(str)\n 1.upto(str.size / 2) do |idx|\n number_of_subs = str.size / idx\n if str[0...idx] * number_of_subs == str\n return [str[0...idx], number_of_subs]\n end\n end\n [str, 1]\nend",
"def decode(string)\n @@counter += 1\n string.split(' ').map do |word|\n word.split(@separator).map { |char| MORSE.detect { |k, v| v == char}[0] }.join\n end.join(' ')\n end",
"def longest_substring_with_k_distinct_characters(s, k)\n current_longest_substring = ''\n for i in 0..s.length do\n for j in (i + 1)..(s.length + 1) do\n substring = s[i..j]\n if substring.chars.uniq.count <= k && substring.length > current_longest_substring.length\n current_longest_substring = substring\n end\n end\n end\n puts current_longest_substring.length\nend",
"def string_compression(str)\n str_array = str.split(\"\")\n current_letter = str_array.first\n output = [current_letter]\n current_count = 1\n\n indx = 1\n while indx < str_array.length\n if current_letter == str_array[indx]\n current_count += 1\n else\n output << current_count unless current_count == 1\n current_count = 1\n current_letter = str_array[indx]\n output << current_letter\n end\n indx += 1\n end\n output.join(\"\")\nend",
"def find_subs(string)\n result = []\n arr = string.chars\n arr.each_index do |outer_idx|\n (arr.size - outer_idx).times do |inner_idx|\n result << arr[outer_idx..(inner_idx + outer_idx)].join\n end\n end\n result\nend",
"def pseudoIsomorphicSubstrings(s)\n\n size = 1 # this show the current size of the set i\n graph = { 0 => {} } # representation of the set sequences\n sizes = []\n\n string_size = s.size\n matrix = []\n\n s_chars = s.chars\n \n s.size.times do |pi| # Si' : Prefix i\n matrix << []\n\n i = 0\n while i <= pi do\n matrix[pi] << s_chars[i..pi].join.ljust(string_size)\n i += 1\n end\n\n matrix[pi] = matrix[pi].join(' | ')\n end\n\n puts matrix\n\n sizes\nend",
"def convert_to_ar(str)\n bgn = 0\n cur = str[bgn]\n ar = []\n unless str.empty?\n str.length.times do |ind|\n next unless str[ind] != cur\n\n ar.append(str[bgn, ind - bgn])\n bgn = ind\n cur = str[ind]\n end\n ar.append(str[bgn, str.length])\n end\n ar\n end",
"def distinct_subseq_ii(s)\n alphabets = ('a'..'z').to_a\n dict = Array.new(27, 0)\n mod = 10 ** 9 + 7\n total = 1\n s.chars.each do |char|\n index = alphabets.index(char) + 1\n combo = total * 2 - dict[index]\n dict[index] = total # if 'c' ever appears again, it will clash with the current combos.\n total = combo < 0 ? 0 + mod : combo % mod\n end\n total - 1 # subtract empty string\nend",
"def vigenereCipher(string, key, alphabet)\n aryStr = string.split(\"\")\n nStr = Array.new\n i = 0\n while i < aryStr.length\n j = 0\n while j < key.length\n nStr << (alphabet[(alphabet.index(aryStr[i]) + key[j])])\n j += 1\n i += 1\n end\n end\n return nStr.join('')\nend",
"def nested(s, i = 0, count = 0)\n return true if s.empty? \n return false if s.length.odd?\n\n if i > s.length - 1\n return true if count == 0\n return false\n end\n\n return nested(s, i += 1, count += 1) if s[i] == \"(\" \n return nested(s, i += 1, count -= 1) if s[i] == \")\"\nend",
"def unpack_encoded_string_to_unsigned_chars(encoded_string)\n # walk first to find how big it is.\n size = 0\n i = 0\n while i < encoded_string.length\n size += encoded_string.char_at(i)\n i += 2\n end\n data = CharArray.new(size)\n di = 0\n i_ = 0\n while i_ < encoded_string.length\n n = encoded_string.char_at(i_)\n v = encoded_string.char_at(i_ + 1)\n # add v n times to data\n j = 1\n while j <= n\n data[((di += 1) - 1)] = v\n j += 1\n end\n i_ += 2\n end\n return data\n end",
"def vigenere_cipher(str, k)\n alpha = (\"a\"..\"z\").to_a\n\n msg = (0...str.length).map do |i|\n old_pos = alpha.index(str[i])\n new_pos = (old_pos + k[i%k.length]) % alpha.length\n alpha[new_pos]\n end\n\n msg.join()\nend",
"def solution(s)\r\n#~ s=\"{[()()]}\"\r\n#~ s=\"{\"\r\n#~ s=\"]]][[[\"\r\n#~ s=\"\"\r\nn=s.size\r\ni=0\r\na=[]\r\n#actions when S is empty\r\nif n==0 then \r\n result=1\r\nend\r\n#actions when S is not empty\r\nwhile i<n do\r\n\tcurChar=s[i]\r\n\tif curChar==\"(\" then \r\n\t\ta.push(curChar);\r\n\telse\r\n\t\tif a.size!=0 then\r\n\t\t\ttopChar=a.last\r\n\t\t\tif curChar==\")\"&&topChar==\"(\" then\r\n\t\t\t\ta.pop\r\n\t\t\telse\r\n result=0\r\n\t\t\tend\t\r\n\t\telse\r\n\t\t result=0\r\n\t\tend\r\n\tend\t\r\ni+=1\r\nend\r\nif a.size==0&&result!=0 then\r\n result=1\r\nelse\r\n result=0\r\nend\t\r\nreturn result\r\nend",
"def findSubstring(s, k)\n vowels = \"aeiou\"\n v = Array.new(s.size, 0)\n maxcount = 0\n maxstring = ''\n s.size.times do |i|\n v[i] = 1 if vowels.include?(s[i])\n end\n\n (0..s.size - k).each do |i|\n next if v[i] == 0\n count = 0\n substr = s[i..i + k - 1]\n (i..i + k - 1).each do |j|\n count += 1 if v[j] == 1\n end\n\n if count > maxcount\n maxcount = count\n maxstring = substr\n end\n end\n return 'Not found!' if maxstring == ''\n maxstring\nend",
"def find_subs(str)\n result = []\n str.chars.each_index do |current_idx|\n (str.size - current_idx).times do |inner_idx|\n result << str[current_idx..(current_idx + inner_idx)]\n end\n end\n p result\nend",
"def encode_string s\n s.downcase.split(//).inject(\"\") do |code,char|\n code + encode_char(char)\n end\n end",
"def string_compression(str)\n output = [str[0]]\n count = 0\n str.split('').each do |char|\n if char == output[-1]\n count += 1\n else\n output << count\n output << char\n count = 1\n end\n end\n output << count\n\n output.length < str.length ? output.join : str\nend",
"def brute_force_compress(str)\n compressed_str = ''\n count_consecutive = 0\n str.each_char.with_index do |char, index|\n count_consecutive += 1\n next_char_different = ((index + 1) == str.chars.size || (str.chars[index + 1] != char))\n if next_char_different\n compressed_str << (char << count_consecutive.to_s)\n count_consecutive = 0\n end\n end\n compressed_str.length < str.length ? compressed_str : str\nend",
"def length_of_longest_substring(arr, k)\n\n start_index, max_length, max_ones = 0, 0, 0\n\n for end_index in 0..(arr.length - 1)\n if arr[end_index] == 1\n max_ones += 1\n end\n\n if (end_index - start_index + 1 - max_ones) > k\n if arr[start_index] == 1\n max_ones -= 1\n end\n start_index += 1\n end\n\n max_length = [max_length, end_index - start_index + 1].max\n end\n\n return max_length\nend",
"def string_compression(str)\n new_str = \"\"\n counter = 1\n current_letter = str[0]\n str.split(\"\")[1..-1].each do |letter|\n if letter == current_letter\n counter += 1\n else\n new_str += counter.to_s + current_letter\n current_letter = letter\n counter = 1\n end\n end\n new_str += counter.to_s + current_letter\n if new_str.length >= str.length\n return str\n else\n return new_str\n end\nend",
"def f(string)\n substrings = []\n \n 0.upto(string.length - 1) do |current_index|\n current_index.upto(string.length - 1) do |iteration_index|\n substrings << string.slice(0..iteration_index) if string.slice(0..iteration_index).length > 1\n end\n end\n\n substrings.each do |substring|\n multiplier = string.scan(substring).length\n return [substring, multiplier] if substring * multiplier == string\n end\n \n [string, 1]\nend",
"def rail_encode(s,rail_count)\n phrase = s.dup\n rail_indexes = Array(0..(rail_count-1))\n rails = create_rails(rail_indexes)\n lines = build_lines(phrase,rails,rail_indexes)\n lines.values.reduce(:+)\nend",
"def num_patterns(input, num)\n # if input is \"bb\", we want to return, but we also need to keep track of how many b's are in the pattern.\n\n uniques = input.split(\"\").uniq\n return [[num / input.length]] if uniques.length == 1\n \n solution = []\n\n # recursively remove the first letter and assign a length to it\n char = input[0]\n next_string = input.delete(char)\n\n # calculate how long the first character can be based on how many times it appears in the pattern and how many characters total are in the pattern\n max_length = num - next_string.length\n num_char = input.count(char)\n\n # get the results from all the other characters recursively\n (1..max_length / num_char).each do |leng|\n next_pattern = num_patterns(next_string, num - leng * num_char)\n next_pattern.each do |arr|\n solution.push([leng] + arr)\n end\n end\n \n p solution\n return solution\nend",
"def compress_solution_one(str)\n compressed_str = ''\n count_consecutive = 0\n str_chars = str.chars\n str_size = str_chars.size\n str_chars.each.with_index do |char, index|\n count_consecutive += 1\n next_char_different = ((index + 1) == str_size || (str_chars[index + 1] != char))\n if next_char_different\n compressed_str << char\n compressed_str << count_consecutive.to_s\n count_consecutive = 0\n end\n end\n compressed_str.length < str_size ? compressed_str : str\nend",
"def decode_n_strings(raw, offset=0, n)\n total_read = 0\n strs = []\n\n n.times do |i|\n strs[i], read = decode_string(raw, offset + total_read)\n total_read += read\n end\n\n [strs, total_read]\n end",
"def solve(a, b, k)\n alpha = ('a'..'z').to_a\n a.each_char.with_index do |char, idx|\n temp = char\n until temp == b[idx]\n k -= 1\n temp = alpha[(alpha.index(temp) + 1) % alpha.length]\n end\n end\n return k >= 0\nend",
"def nested(s, i = 0, j = (s.length - 1))\n # base case\n return true if s == \"\"\n return true if i > j\n return false if s.length.odd?\n return false if s[i] != \"(\" || s[j] != \")\"\n # recursive\n return nested(s, i + 1, j - 1)\nend",
"def decode(string, symbols = WHITESPACE) \n bits_per_symbol = (Math.log(symbols.length) / Math.log(2)).floor\n bitstring = ''\n string.each_byte do | b |\n bitstring << \"%0*b\" % [bits_per_symbol, symbols.index(b.chr)]\n end\n [bitstring].pack('B*')\n end",
"def compress_str(str)\n hash = Hash.new(0)\n string = \"\"\n str.split(\"\").each { |char| hash[char] += 1 }\n hash.each do |k, v|\n if v == 1\n string << k\n else\n string << v.to_s + k\n end\n end\n string\nend",
"def kv_decode(s); Hash[*s.split(10.chr).map {|l| l.split(\":\", 2) }.flatten] end",
"def refined_super_digit(n, k)\n string_n = n.to_s\n return n if string_n.size == 1 && k == 1\n\n repeat_n = string_n * k\n return super_digit(repeat_n)\nend",
"def nested(s)\n return true if s.empty?\n return false if s.length.odd?\n \n return false if s[0] != \"(\" || s[-1] != \")\"\n return nested(s[1...-1])\n # To do this without creating new strings, make a helper method\n # that accepts additional parameters for left_char and right_char and increments\n # them inward each time, like I did for reverse_in_place with helper_reverse\nend",
"def mark_IV_encoder(first_wheel_index,second_wheel_index,message_to_encode)\n input_array = message_to_encode.split(//)\n wheel_three_index= message_to_encode.split(//).map{|z|[$keyboard.index(z)]}.flatten!\n wheel_three_index.insert(0,0)\n output_array=[]\n for i in 0...input_array.length\n output_char = mark_II_encoder(first_wheel_index,second_wheel_index,input_array[i])\n output_array.push mark_I_encoder(2 * Integer(wheel_three_index[i]),output_char)\n end\n mark_IV_encoded_message = output_array.join\n return mark_IV_encoded_message\nend",
"def compress_solution_two(str)\n str_chars = str.chars\n str_size = str_chars.size\n return str if str_size < compressed_size(str_chars, str_size)\n\n compressed_str = ''\n count_consecutive = 0\n str_chars.each.with_index do |char, index|\n count_consecutive += 1\n next_char_different = ((index + 1) == str_size || (str_chars[index + 1] != char))\n if next_char_different\n compressed_str << char\n compressed_str << count_consecutive.to_s\n count_consecutive = 0\n end\n end\n compressed_str\nend",
"def str_perm_efficient(string, k, n)\n if k == n\n puts string\n else\n for i in k..n\n string[i], string[k] = string[k], string[i] # fixing one element\n str_perm_efficient(string, k+1, n) # calling perm on remaining string\n string[k], string[i] = string[i], string[k] # Swap back the previously swapped elements\n end\n end\nend",
"def decode_modified_run_length_encoded\n self.inject([]) do |array, current|\n if current.kind_of? Array\n array << [current[-1]] * current[0]\n else\n array << current\n end\n array\n end.flatten\n end",
"def gen_keys(str)\n split7(str).map{ |str7|\n bits = split7(str7.unpack(\"B*\")[0]).inject('')\\\n {|ret, tkn| ret += tkn + (tkn.gsub('1', '').size % 2).to_s }\n [bits].pack(\"B*\")\n }\n end",
"def build_new_string(a, count)\n g_value = lambda {|h| [h.keys[0]][0]}\n high_char = find_higher(a)\n low_char = find_low(a * 1, high_char)\n\n result = []\n k = 1\n\n while k <= count.reduce(&:+) #a.any?{|values| a.values[0] != 0}\n if k.odd?\n result.push(high_char.keys[0])\n high_char[g_value.call(high_char)] = high_char.values[0] - 1\n else\n result.push(low_char.keys[0])\n low_char[g_value.call(low_char)] = low_char.values[0] - 1\n end\n\n high_char = find_higher(a) if high_char.values[0] == 0\n low_char = find_low(a * 1, high_char) if low_char.values[0] == 0\n\n k += 1\n end\n\n result\nend",
"def length_of_longest_substring(str, k)\n start_index, max_length, max_repeat_letter_count = 0, 0 , 0\n char_freq = {}\n\n for end_index in 0..(str.length - 1)\n right_char = str[end_index]\n\n if !char_freq.include?(right_char)\n char_freq[right_char] = 0\n end\n char_freq[right_char] += 1\n\n max_repeat_letter_count = [max_repeat_letter_count, char_freq[right_char]].max\n\n # Current window size is from window_start to window_end, overall we have a letter which is\n # repeating 'max_repeat_letter_count' times, this means we can have a window which has one letter\n # repeating 'max_repeat_letter_count' times and the remaining letters we should replace.\n # if the remaining letters are more than 'k', it is the time to shrink the window as we\n # are not allowed to replace more than 'k' letters\n\n if (end_index - start_index + 1 - max_repeat_letter_count) > k\n left_char = str[start_index]\n char_freq[left_char] -= 1\n start_index += 1\n end\n\n max_length = [max_length, end_index - start_index + 1].max\n end\n return max_length\nend",
"def decode(numbers, key)\n result = \"\"\n numbers.each_with_index do |n, i|\n result += (n ^ key[i % 3].ord).chr\n end\n result\nend",
"def test_encode_rectangle_outer_length\n\n key = \"PLAYFAIREXAMPLE\"\n pf = Playfair.new(key)\n\n assert_equal(\"LV\", pf.encode(\"AU\"))\n end",
"def caesar_decode(string, offset)\n caesar_encode(string,offset*-1)\nend",
"def refined_super_digit(n, k)\n string_n = n.to_s\n return n if string_n.size == 1 && k == 1\n\n repeat_n = string_n * k\n return super_digit(repeat_n)\nend",
"def string_compression(str)\n compressed = string[0]\n\n count = 1\n (1...string.length).each do |idx|\n if string[idx] == compressed[-1]\n count += 1\n else\n compressed += count.to_s\n compressed += string[idx]\n count = 1\n end\n end\n\n compressed += count.to_s\n\n compressed.length >= string.length ? string : compressed\nend",
"def RunLengthII(str)\n\tstr_copy = str.split(\"\")\n\tlastChar = str_copy.shift\n\tresult = \"\"\n\tcount = 1\n\tstr_copy.each do |char|\n\t\tif char != lastChar\n\t\t\tresult << \"#{count}#{lastChar}\"\n\t\t\tlastChar = char\n\t\t\tcount = 1\n\t\telse\n\t\t\tcount += 1\n\t\tend\n\tend\n\n\tresult += \"#{count}#{str_copy[-1]}\"\n\treturn result\nend",
"def bijective_encode(i)\n # from http://refactormycode.com/codes/125-base-62-encoding\n # with only minor modification\n return ALPHABET[0] if i == 0\n s = ''\n base = ALPHABET.length\n while i > 0\n s << ALPHABET[i.modulo(base)]\n i /= base\n end\n s.reverse\n end",
"def encode(str)\n\tswap_raw = \"GA-DE-RY-PO-LU-KI\".reverse.split(\"-\") + \"GA-DE-RY-PO-LU-KI\".downcase.reverse.split(\"-\") + \"GA-DE-RY-PO-LU-KI\".split(\"-\") + \"GA-DE-RY-PO-LU-KI\".downcase.split(\"-\")\n\tencoder = Hash.new\n\tswap_raw.each { |pair| encoder[pair[0]] = pair[1] }\n\tencoded_string = \"\"\n\tputs encoder\n\tfor char in str.split(\"\")\n\t\tif encoder.key?(char) #correct?\n\t\t\tencoded_string += encoder[char]\n\t\telse\n\t\t\tencoded_string += char\n\t\tend\n\tend\n\treturn encoded_string\nend",
"def string_compression(str)\n new_str = ''\n current_letter = nil\n current_letter_count = 0\n\n str.split('').each do |char|\n if char != current_letter\n if !current_letter.nil?\n new_str += current_letter + current_letter_count.to_s\n end\n current_letter = char\n current_letter_count = 1\n else\n current_letter_count += 1\n end\n end\n\n new_str += current_letter + current_letter_count.to_s\n\n new_str\nend",
"def number_to_pattern(index, k)\n # NumberToPattern(index, k)\n # if k = 1\n # return NumberToSymbol(index)\n # prefixIndex ← Quotient(index, 4)\n # r ← Remainder(index, 4)\n # PrefixPattern ← NumberToPattern(prefixIndex, k − 1)\n # symbol ← NumberToSymbol(r)\n # return concatenation of PrefixPattern with symbol \n\n\n # Input: Integers index and k.\n # Output: The string NumberToPattern(index, k). \n # Sample Input:\n # 45\n # 4\n # Sample Output:\n # AGTC \n\n return number_to_symbol(index) if k == 1\n prefix_index = index/4\n r = index%4\n prefix_pattern = number_to_pattern(prefix_index, k - 1)\n symbol = number_to_symbol(r)\n return prefix_pattern + symbol\n end",
"def encode(string, symbols = WHITESPACE)\n bits_per_symbol = (Math.log(symbols.length) / Math.log(2)).floor\n result = ''\n reg = %r{#{'.?' * bits_per_symbol}}\n string.unpack('B*')[0].scan(reg) do | bits |\n result << symbols[bits.to_i(2)]\n end\n result\n end",
"def nested_brackets!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 112 )\n\n \n # - - - - main rule block - - - -\n # at line 1009:5: '[' (~ ( '[' | ']' | '\\\\\\\\' ) | '\\\\\\\\' . | NESTED_BRACKETS )* ']'\n match( 0x5b )\n # at line 1009:9: (~ ( '[' | ']' | '\\\\\\\\' ) | '\\\\\\\\' . | NESTED_BRACKETS )*\n while true # decision 67\n alt_67 = 4\n look_67_0 = @input.peek( 1 )\n\n if ( look_67_0.between?( 0x0, 0x5a ) || look_67_0.between?( 0x5e, 0xffff ) )\n alt_67 = 1\n elsif ( look_67_0 == 0x5c )\n alt_67 = 2\n elsif ( look_67_0 == 0x5b )\n alt_67 = 3\n\n end\n case alt_67\n when 1\n # at line 1009:11: ~ ( '[' | ']' | '\\\\\\\\' )\n if @input.peek( 1 ).between?( 0x0, 0x5a ) || @input.peek( 1 ).between?( 0x5e, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n when 2\n # at line 1009:35: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n when 3\n # at line 1009:45: NESTED_BRACKETS\n nested_brackets!\n\n else\n break # out of loop for decision 67\n end\n end # loop for decision 67\n match( 0x5d )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 112 )\n\n end",
"def nested(s, i = 0)\n string = s.split(\"()\")\n return false if s.length.odd?\n return true if s.empty? \n \n return true if s.length.even? && string[i].length == string[i+1].length\n return false if s.length.even? && string[i].length != string[i+1].length\nend"
] |
[
"0.6898236",
"0.6306968",
"0.60266685",
"0.5889764",
"0.5884756",
"0.58447295",
"0.5842954",
"0.57571685",
"0.57510453",
"0.5747148",
"0.57404965",
"0.5733972",
"0.5673546",
"0.55976033",
"0.5591977",
"0.55680484",
"0.55677277",
"0.55655986",
"0.5551104",
"0.54930174",
"0.5492954",
"0.54796654",
"0.5468405",
"0.5440113",
"0.5429827",
"0.5417977",
"0.5378404",
"0.5364639",
"0.535819",
"0.53569114",
"0.5347812",
"0.5340428",
"0.53074235",
"0.53020555",
"0.5300146",
"0.5292338",
"0.52885723",
"0.5277961",
"0.52758783",
"0.52754754",
"0.5270766",
"0.52696484",
"0.5252099",
"0.5246452",
"0.5218699",
"0.5216772",
"0.5205716",
"0.51844585",
"0.5178473",
"0.51663095",
"0.5155842",
"0.51524246",
"0.513915",
"0.51232135",
"0.5112696",
"0.5111847",
"0.5105123",
"0.5097325",
"0.5094933",
"0.5080961",
"0.5076451",
"0.5067688",
"0.5063572",
"0.50621665",
"0.50618684",
"0.5051661",
"0.50512993",
"0.5046866",
"0.5038851",
"0.5032988",
"0.5027913",
"0.5019482",
"0.5012963",
"0.5011024",
"0.5008856",
"0.50016296",
"0.49940625",
"0.49894038",
"0.49868503",
"0.49856183",
"0.49853012",
"0.49820504",
"0.49796999",
"0.49719468",
"0.49707505",
"0.49656445",
"0.49652442",
"0.49637052",
"0.4955776",
"0.49548882",
"0.49439502",
"0.49428123",
"0.49316847",
"0.49281228",
"0.49173635",
"0.4894204",
"0.4893379",
"0.48920226",
"0.48907945",
"0.48897636"
] |
0.5270216
|
41
|
Turns query results into a hash keyed by event name, values are a set of unique user IDs for that event
|
def data
@data ||= begin
event_users = Hash.new do |h, uuid|
h[uuid] = Set.new
end
# IDEA: maybe there's a block form if this we can do that yields results as it loads them
# to go slightly faster
fetch_results.each do |row|
event_users[row['name']] << row['user_id']
end
event_users
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def data\n @data ||= begin\n event_users = Hash.new do |h, event_name|\n h[event_name] = Set.new\n end\n\n # IDEA: maybe there's a block form if this we can do that yields results as it loads them\n # to go slightly faster\n fetch_results.each do |row|\n event_users[row['name']] << row['user_id']\n\n if row['name'] == Events::IDV_FINAL_RESOLUTION\n if row['identity_verified'] == '1'\n event_users[Results::IDV_FINAL_RESOLUTION_VERIFIED] << row['user_id']\n end\n if row['gpo_verification_pending'] == '1'\n event_users[Results::IDV_FINAL_RESOLUTION_GPO] << row['user_id']\n end\n if row['in_person_verification_pending'] == '1'\n event_users[Results::IDV_FINAL_RESOLUTION_IN_PERSON] << row['user_id']\n end\n if row['fraud_review_pending'] == '1'\n event_users[Results::IDV_FINAL_RESOLUTION_FRAUD_REVIEW] << row['user_id']\n end\n end\n end\n\n event_users.transform_values(&:count)\n end\n end",
"def mapOfAllEvents\n events = self.getAllEvents\n result = Hash.new\n\n events.each do |sport, evs|\n evs.each do |eventID, event|\n result[eventID] = event\n end\n end\n result\n end",
"def build_event_hash\n\t\t@event_hash = {}\n\t\t\n\t\teach_event { |event| @event_hash[event.id] = event }\n\tend",
"def getAllEvents\n result = Hash.new\n @sports.each do |name,sport|\n events = Hash.new\n result[name] = events\n aux = sport.events\n aux.each do |eventID, event|\n result[name][eventID]=event\n end\n end\n result\n end",
"def transform_users\n Hash[@users.map { |name, entry| [name.intern, (yield name, entry)] }]\n end",
"def vertica_userids\n dd = dy2k() - 3 #let's be very conservatibe\n cmd = \"select distinct(sifi_uid) from cost_events where clicks > 0 and dd_id >= #{dd}\"\n puts cmd\n s = go_direct(cmd)\n xs = s.split(\"\\n\")\n vus = {} \n xs.each do |x|\n vus[x] = true\n end \n vus\nend",
"def get_all_by_query_as_hash(query)\n map_to_hash_by_primary_key(get_all_by_query(query))\n end",
"def map_to_hash_by_primary_key(result) \n hash = {}\n\n result.each do |record|\n hash[record[@primary_key]] = record\n end\n\n hash\n end",
"def fetch_existing_map(events)\n MeetupEvent\n .where(meetup_event_id: events.map(&:meetup_event_id))\n .to_a\n .each.with_object({}) do |evt, hash|\n hash[evt.meetup_event_id] = evt\n end\n end",
"def events\n events = {}\n @db.each do |key, _|\n timestamp, object = parse_event(key)\n events[object] ||= []\n events[object].push(timestamp)\n end\n events\n end",
"def element_to_result(e)\n result = Hash.new\n result['date'] = e.updated_at.strftime(\"%d-%m-%Y %H:%M\")\n result['user'] = e.user.email\n result['interaction'] = e.interaction.resource_type\n result\n end",
"def extra_users_data_look_up\n return if @results.empty?\n\n tickets = DataStore.instance.tickets\n @results.each do |user|\n ticket_names = tickets.select { |t| t['assignee_id'] == user['_id'] }.map { |t| t['subject'] }\n user['tickets'] = ticket_names\n end\n end",
"def users\n result_hash['usr']\n end",
"def perform\n # Ruby trick found here: https://stackoverflow.com/questions/15761306/convert-array-of-objects-to-hash-with-a-field-as-the-key\n users = Hash[User.all.map do |u|\n [u.id, {events_count: u.events.count}]\n end]\n User.update(users.keys, users.values)\n\n events = Hash[Event.all.map do |e|\n [e.id, {users_count: e.users.count}]\n end]\n Event.update(events.keys, events.values)\n end",
"def process_events events\n @events = Hash.new\n\n # Organize the event based on type\n # http://developer.github.com/v3/activity/events/types/ lists event types.\n events.each do |event|\n @events[event.type] ||= Array.new\n @events[event.type] << event\n end\n @event_types = Hash.new\n @events.each do |key,value|\n @event_types[key.underscore.humanize.sub(' event', '')] = value.count\n end\n end",
"def questionnaire_report_by_users\r\n\r\n range = @when_start .. @when_end\r\n activity_id = Activity.get_activity('submit questionnaire_answer').id\r\n\r\n user_activities = UserActivity.where(:activity_id => activity_id).where(:created_at => range).joins(:user).all\r\n users = {}\r\n user_activities.each do |au|\r\n unless users[au.user.email]\r\n users[au.user.email] = {:user => \"#{au.user.email} #{au.user.first_name} #{au.user.last_name}\", attendance: {}}\r\n end\r\n users[au.user.email][:attendance][au.created_at.to_date] = true\r\n end\r\n\r\n users\r\n end",
"def upcoming_events\n events = @meetup.events(\n group_urlname: @meetup_url_name,\n status: 'upcoming'\n )['results']\n\n events.inject({}) do |accum, results|\n accum[results['name']] = {\n 'venue' => results['venue'],\n 'time' => results['time'],\n 'duration' => results['duration'],\n 'event_url' => results['event_url'],\n 'yes_rsvp_count' => results['yes_rsvp_count']\n }\n\n accum\n end\n end",
"def to_h\n @query_hash.sort.each_with_object({}) do |(key, value), query|\n next if value.nil? || ((value.is_a?(Array) || value.is_a?(Hash)) && value.blank?)\n\n query[key] = KEYS_WITH_UNIQUE_VALUES.include?(key) ? value.values : value\n end\n end",
"def index\n @events = Event.where('event_start >= ?', Date.today).order(:event_start, :time_begin)\n @date_events_hash = @events.group_by(&:event_start)\n end",
"def events(query)\n ret = Array.new\n imap_query(query).each do |env|\n event = event_from_envelope(env)\n event.person = query.person\n ret.push event\n end\n \n ret\n end",
"def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end",
"def user_events(user_events_array)\n \tuser_events_array.map do |user_event|\n \t\tuser_event.event\n \tend\n end",
"def to_h\n {\n event: event,\n subject: subject,\n mentions: mentions,\n tags: tags,\n time: time\n }\n end",
"def hash\n @events.hash\n end",
"def results(id)\n @pgsql.exec('SELECT key, value FROM result WHERE job = $1', [id]).map do |r|\n [r['key'], r['value']]\n end.to_h\n end",
"def hash\n [event_count, hour, index_id, index_name, org_name, public_id, retention].hash\n end",
"def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end",
"def set_entourage_user_hashes\n User.find_each do |user|\n email_hashes[hash(user.email)] = user.id\n phone_hashes[hash(user.phone)] = user.id\n end\n end",
"def create_query_hash(array)\n names = array.shift\n rval = []\n array.each do |r|\n row = {}\n names.each_with_index { |column, idx| row[column] = r[idx] }\n rval << row\n end\n rval\nend",
"def get_results(offset, limit)\n result = Hash.new\n if params[:conditions].blank?\n total = UserInteraction.count\n events = UserInteraction.limit(limit).offset(offset).order(\"updated_at ASC\")\n else\n conditions = JSON.parse(params[:conditions])\n total = build_query(conditions).count\n events = build_query(conditions).limit(limit).offset(offset).order(\"user_interactions.updated_at ASC\")\n end\n result['total'] = total\n result['elements'] = events\n return result\n end",
"def get_user_data(email)\n user_id = $db.execute(\"SELECT user_id FROM users WHERE email = ?\", email)[0][\"user_id\"]\n username = $db.execute(\"SELECT username FROM users WHERE email = ?\", email)[0][\"username\"]\n rank = $db.execute(\"SELECT rank FROM users WHERE email = ?\", email)[0][\"rank\"].to_i\n\n return {user_id: user_id, username: username, rank: rank}\nend",
"def users_by_size\n map = {}\n for user in @size_data.values\n size = user[:size]\n map[size] ||= []\n map[size].push(user)\n end\n return map\nend",
"def to_hash\n result = {}\n each_pair { |name,results| result[name] = results }\n result\n end",
"def fetch_non_favorite_bar_events()\n events = Hash.new\n temp = Bar.find(:all, :select => 'bars.name, bar_events.detail', :joins => :bar_event, :conditions => ['bars.id not in (select bar_id from favorites where user_id = ?) and verified = 1', [self.id] ])\n for t in temp do\n\t if events.key?(t.name)\n\t events[t.name] << t.detail\n\t else\n\t events[t.name] = [t.detail]\n\t end\n\tend\n\t\n\tevents\n end",
"def user_data_from_results(res, username, key)\n users = res['users']\n users.each do |user|\n return user[key] if user['name'] == username\n end\n nil\n end",
"def blast_results_to_hash(all_blast_results)\n blast_result_hash = Hash.new\n all_blast_results.each do |f|\n if(blast_result_hash.has_key?(f.name))\n blast_result_hash[f.name].push(f)\n else\n tmp_array = f.clone\n blast_result_hash[f.name] = tmp_array\n end\n end\n return(blast_result_hash)\nend",
"def exception_data\n {\n company: company.id,\n notified_user_ids: begin\n anniversary_hash = get_todays_event_hash(:anniversary) || {}\n birthday_hash = get_todays_event_hash(:birthday) || {}\n notified_user_ids = (anniversary_hash.keys + birthday_hash.keys).uniq\n notified_user_ids\n end\n }\n end",
"def event_names query={}, opts={}\n event_summary(query, opts).keys\n end",
"def convert_result_to_hash(custom_metadata)\n request = {}\n document = REXML::Document.new(custom_metadata)\n REXML::XPath.each(document, \"//customMetadataResponse/data/customMetadata[namespace=\\\"urn:nexus/user#\\\"]\") do |row|\n request[row.elements[\"key\"].text.strip] = row.elements[\"value\"].text.strip\n end\n request\n end",
"def hash_all_purchases(user_id)\n all_purchases = {}\n purchases = Purchase.where(user_id: user_id)\n purchases.each do |purchase|\n if purchase.purchase_option.movie_id\n all_purchases[\"movie\"] = {purchase.purchase_option.movie_id => purchase.created_at}\n elsif purchase.purchase_option.season_id\n all_purchases[\"season\"] = {purchase.purchase_option.season_id => purchase.created_at}\n end\n end\n return all_purchases\n end",
"def getHash(restid)\n # get all ordered items of users who ordered in restaurant \"restid\"\n userItems=OrderMng.getAllUsersItemsByRestID(restid)\n # userItems=Hash[userItems.map.with_index { |value, index| [index, value] }]\n return userItems\nend",
"def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend",
"def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend",
"def get_query_results(query)\n hits = execute_query(query).hpath('hits.hits').first\n return [] unless hits && !hits.empty?\n hits.map do |hit|\n hit['_source'].expand.merge(hit.only('_id', '_type', '_index')).kmap do |key|\n key.to_s.gsub('@', '_').to_sym\n end\n end\n end",
"def results\n x = Profile.all.select { |profile| profile.user_id == self.id }\n k = x.map {|profile| profile[:name]}\n v = x.map do |profile|\n if profile[:sentiment_id] == 1\n \"Negative\"\n elsif profile[:sentiment_id] == 2\n \"Positive\"\n elsif profile[:sentiment_id] == 3\n \"Neutral\"\n end\n end\n hash = [k, v].transpose.to_h\n sleep(3)\n hash\n end",
"def fetch_user_data\n @username = params[:username]\n @configured_sources = params[:source_ids] || []\n @result_set = Hash.new\n @configured_sources.each do |source|\n feed_result = fetch_feed(source,@username)\n @result_set[source] = feed_result\n end\n \n end",
"def check_events\n temp = poll_response\n index = 0\n puts temp if $debug\n # begin\n if temp.has_key?(\"people\")\n temp[\"people\"].each do |user|\n unless @people_hash.has_key?(user[\"screenname\"])\n @people_hash[user[\"screenname\"]] = user\n end\n end\n end\n unless temp == {}\n # begin\n temp[\"events\"].each do |event|\n key = \"#{event['server_seqid']}#{event['type']}\"\n unless @hash[key] == event[\"server_gmt\"]\n # puts event\n @api.process(event, @people_hash[event['from']]||nil, key)\n @hash[key] = event[\"server_gmt\"]\n end\n\n end\n # rescue\n # puts \"*****\"\n #@log.debug temp[\"events\"]\n # puts \"*****\"\n # puts temp\n # end\n end\n # rescue Exception => e\n # puts e.message, e.backtrace\n # end\n\n end",
"def get_votes_history\n response = Array.new\n resp = AWS_DYNAMO.query({\n table_name: AWS_DYNAMO_VOTES_BY_USER_TBL,\n limit: 100,\n scan_index_forward: \"false\",\n key_conditions: {\n \"user_id\" => {\n attribute_value_list: [id],\n comparison_operator: \"EQ\"\n },\n }\n })\n\n resp.items.each do |vote_entry|\n REDIS_USER_VOTES.sadd(\"user-voted:#{uid}\", vote_entry[\"question_id\"])\n response << vote_entry\n end\n response\n end",
"def show\n @event = Event.find(params[:id])\n array = []\n hash = {}\n @event.attribute_names.each {|var| hash[var] = @event.instance_variable_get(\"@attributes\")[var] } \n\n user_event = User.find(@event.user_id)\n res = {:event => hash, :login => user_event.login}\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: res }\n end\n end",
"def get_festivals() \n #Start from 3 days ago since can be in the middle of a festival\n threeDaysAgo = (Time.now - (3*24*60*60)).strftime('%Y-%m-%d')\n #Find relevant events\n events = Event.where(festival: 1).where('date >= ?', threeDaysAgo).order(:date)\n\n #Make hash of hashes that include all necessary info\n festivalDatesArr = {}\n events.each do |event|\n #Need to account for same name different locations\n name = \"#{event.title} #{event.location}\"\n if festivalDatesArr.has_key?(name)\n festivalDatesArr[name]['dates'].push(event.date) \n else\n festName = \"#{event.title} #{event.location}\"\n festivalDatesArr[festName] = {\n 'dates' => [event.date],\n 'id' => event.id,\n 'title' => event.title,\n 'location' => event.location,\n 'ages' => event.ages,\n 'link' => event.ticketLink,\n 'address' => event.address\n }\n end\n end\n return festivalDatesArr\n end",
"def unique_users\n result = {}\n\n each_value {|channel|\n channel.users.each {|nick, user|\n result[nick] = user.client\n }\n }\n\n return result\n end",
"def meta_data\n u_ids = object.message_status.user_ids\n {\n read_by_count: u_ids.count,\n read_by: User.select(:id,:name,:last_name).where(\"users.id IN (?)\",u_ids).map {|u| {id: u.id,name: full_name(u.name,u.last_name)}},\n is_read: object.read\n }\n end",
"def conv_results_to_a_of_h( search_results )\n result_objects = []\n\n search_results[:data].each do |row|\n tmp = {}\n row.each_index do |index|\n tmp[ search_results[:headers][index] ] = row[index]\n end\n result_objects.push(tmp)\n end\n\n return result_objects\n end",
"def get_all_users\n @users = []\n\n User.all.each do|user|\n @users << user.to_hash\n end\n end",
"def get_events\n # events created by this user\n @my_events = User.find(current_user.id).event_attendants.where('owner = 1')\n\n # events this user has joined\n @joined_events = User.find(current_user.id).event_attendants.where('attendee_status = 3 and owner IS NULL')\n \n # events this user is invited to\n @invited_to_events = User.find(current_user.id).event_attendants.where('attendee_status = 0')\n\n @maybe_events = User.find(current_user.id).event_attendants.where('attendee_status = 2')\n end",
"def filtered_results(results)\n return [] if results.blank?\n\n members = results.first[:uniquemember]\n members = results.first[:member] if members.blank?\n members.map do |r|\n uid = r.split(\",\").first\n uid.split(\"=\", 2).last\n end\n end",
"def events(query)\n ret = Array.new\n \n feed = Feedjira::Feed.parse jira_query(query)\n \n feed.entries.each do |feed_evt|\n event = event_from_feed(feed_evt)\n event.person = query.person\n \n if (event.time < query.to && event.time > query.from)\n ret << event\n end\n end\n \n ret\n end",
"def get_todays_event_hash(event_type)\n todays_event_users = get_todays_event_users(event_type)\n recipients_to_email = get_recipients_to_email(event_type)\n matched_role_recipients = RoleRecipientsManager.match_recipients_to_event(event_type, recipients_to_email, todays_event_users)\n matched_team_recipients = TeamRecipientsManager.match_recipients_to_event(event_type, recipients_to_email, todays_event_users)\n # The following 'merge' merges two hashes and also with the pipe '|' does\n # union of arrays(the values of the two hashes).\n matched_team_recipients.merge(matched_role_recipients){|key, a_val, b_val| a_val | b_val }\n end",
"def users()\n\t\t\tusers = {}\n\t\t\t@table.items.where(:type => 'USER').each do |user_row|\n\t\t\t\tusers[user_row.attributes[:user_name]] = ServerUser.new(user_row.attributes[:user_name], @dynamo_table, user_row, @metadata, self)\n\t\t\tend\n\t\t\treturn users\n\t\tend",
"def wql_hash\n metric_ids = unique_metric_ids\n if metric_ids.any?\n { id: [:in] + metric_ids }\n else\n { id: -1 } # HACK: ensure no results\n end\nend",
"def get_users\n connect_cassandra\n \n users = []\n user_rows = @client.execute(\"SELECT user_id, name FROM users\")\n user_rows.each do |user_row| \n user = Hashie::Mash.new\n user.user_id = user_row[\"user_id\"]\n user.name = user_row[\"name\"]\n\n users << user\n end\n \n users\nend",
"def get_all_users\n @users = []\n User.all.each do |user|\n @users << user.to_hash\n end\n end",
"def get_users\n username_array = []\n con = get_connection()\n usernames = con.exec \"SELECT username FROM hashes\"\n usernames.each do |name|\n username_array[username_array.length] = name['username']\n end\n return username_array\nend",
"def to_pusher_event\n user_name = if user.present? then user.name else nil end\n user_name = guest_name unless user_name.present?\n\n { session_id: session_id,\n scene_id: scene_id,\n href: \"/scenes/#{ scene_id }/with/#{ session_id }\",\n score: score,\n query_results: query_results,\n updated_at: updated_at,\n user_id: user_id || guest_uid,\n user_name: user_or_guest.name,\n profile_image: user_or_guest.image_url }\n end",
"def valid_events_by_step\n @valid_events_by_step ||= begin\n user_ids_from_last_required_event = user_ids\n # IIRC, non-MRI implementations of Ruby may map over a hash in a different key order\n # than the one it was instantiated with. The normal interpreter should do it in the same\n # order just about always, or at least enough to be practical for this purpose\n all_events_by_step.map do |step_event_key, step_events|\n event_is_required = required_event_keys.include? step_event_key\n valid_events = step_events.where user_id: user_ids_from_last_required_event\n user_ids_from_last_required_event = valid_events.pluck(:user_id) if event_is_required\n [step_event_key, valid_events]\n end.to_h\n end\n end",
"def to_h\n Hash[all_entries]\n end",
"def to_hash\n {\n :time => @time,\n :event => @event\n }\n end",
"def events(count: 150, startId: nil)\n data = get '', resource: 'userEvent', count: count, startId: startId\n data.userEvents\n end",
"def events\n events = super\n types = self.class.events\n Hash[types.zip(events.values_at(*types))]\n end",
"def to_datadog_hash\n {\n \"usr.id\" => id,\n \"usr.access_level\" => access_level,\n \"usr.sync_approval_status\" => sync_approval_status\n }\n end",
"def users_by_function\n members.includes(:user, :functions).inject({}) do |h, m|\n m.functions.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end",
"def users_by_function\n members.includes(:user, :functions).inject({}) do |h, m|\n m.functions.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end",
"def index\n if token_and_options(request)\n access_key = AccessKey.find_by_access_token(token_and_options(request))\n @user = User.find_by_id(access_key.user_id) \n p \"@user: \" + @user.to_yaml\n \n \n @events = []\n @past_events = []\n user_events = @user.events.includes([:movies, :users])\n \n user_events.each do |event| \n if event.event_date >= Date.today\n @events << event \n \n event_users = []\n all_confirmed = true\n all_voted = true\n votes_count = 0\n votes_user_count = 0\n all_declined = true\n accepted_count = 0\n \n friends_map ={} \n event.users.each do |friend_user| \n friends_map[friend_user.id] = []\n event_user = nil\n \n if event.rating_phase == \"wait_users\"\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n p \"EVENT USER:_ \" +friend_user.id.to_s + \" ACCEPTED:\" +event_user.accept.to_yaml + \"\\n\"\n if friend_user.id == @user.id && event_user.waiting?\n p \"ME - NOT ACCEPT!\"\n all_confirmed = false\n event.event_status = \"confirm\"\n all_declined = false \n elsif friend_user.id == @user.id && event_user.declined? \n event.event_status = \"declined\" \n elsif event_user.waiting?\n all_declined = false\n all_confirmed = false\n elsif friend_user.id != @user.id && event_user.accepted?\n accepted_count = accepted_count + 1\n all_declined = false\n elsif event_user.accepted?\n accepted_count = accepted_count + 1\n end\n else\n all_declined = false \n end\n \n if event.rating_phase == \"starting\"\n if event_user.nil?\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n end \n if event.one_to_five?\n if event_user.accepted? && event_user.num_votes != event.num_votes_per_user\n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false \n accepted_count = accepted_count + 1\n elsif event_user.accepted? && event_user.num_votes == event.num_votes_per_user \n votes_user_count = votes_user_count + 1\n votes_count = votes_count + event_user.num_votes \n accepted_count = accepted_count + 1\n end\n elsif event.one_to_ten?\n if event_user.accepted? \n accepted_count = accepted_count + 1\n event_user_votes = EventUserVote.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id)\n if !event_user_votes.nil?\n score = 0\n event_user_votes.each do |vote|\n score = score + vote.score\n end\n if score < 2\n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false\n else\n votes_user_count = votes_user_count + 1\n end\n else \n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false\n end \n end \n end\n end\n \n if friend_user.id != @user.id \n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n if event_user.nil?\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n end \n \n friend = Friend.where(\"user_id = ? AND friend_id = ?\", friend_user.id, @user.id).limit(1).first \n if friend.nil?\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => false, :request => false} \n \n puts \"NOT FRIEND: \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n else\n if friend.friend_confirm == true\n puts \"IS FRIEND: \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => true, :request => false} \n else\n puts \"IS REQUEST \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => false, :request => true} \n end\n end\n event_users << friend_json \n end\n end\n event.friends = event_users\n \n puts \"PHASE: \"+ event.id.to_s+ \", \"+ event.rating_phase.to_s + \" event.finished:\" + event.finished.to_s + \"system_ \" + event.rating_system.to_s\n if event.starting? && event.voting? \n voting_percent = (votes_user_count * 100) / accepted_count\n print \"PERCENT: \" + voting_percent.to_s\n if event.one_to_five?\n votes_percent = votes_count * 100 / (accepted_count * event.num_votes_per_user) \n print \"VOTES PERCENT: \" + votes_percent.to_s\n end\n end \n \n seconds_diff = (event.created_at - DateTime.now).to_i.abs\n minutes_diff = seconds_diff / 60\n puts \"ITME LIMT : \" + event.time_limit.to_s + \" m diff: \" + minutes_diff.to_s\n \n if event.finished == true\n event_movie = EventMovie.where(\"event_id = ? AND winner = true\", event.id).limit(1).first\n movie = EventMovie.where(\"event_id = ? AND winner = true\", event.id).limit(1).first \n event.event_status = \"winner\" \n p \"WINNER: \" + movie.to_yaml + \"\\n\" \n event.winner_movie = event_movie.movie_id\n elsif all_declined == true \n event.event_status = \"failed\" \n elsif all_confirmed == false && event.event_status != \"confirm\" && event.event_status != \"declined\"\n p \"WAITING\" \n \n if minutes_diff > event.time_limit\n if event.user_id == @user.id \n puts \" TIME LIMIT AFTER \" \n event.event_status = \"start_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n else \n event.event_status = \"waiting_others\"\n end\n \n elsif event.voting? && event.starting? && event.event_status != \"vote\" && all_voted == false && event.minimum_voting_percent < 100 &&\n event.minimum_voting_percent <= voting_percent && ((event.one_to_five? && event.minimum_voting_percent <= votes_percent) || event.one_to_ten?)\n puts \" VOTING MINUM<100: \" + voting_percent.to_s\n \n if minutes_diff > event.time_limit\n puts \" NEXT ROUND ANYWAYS! \" \n \n votingFinished(event, friends_map, @user, true)\n event.time_limit = event.time_limit + 30\n event.save\n else \n event.event_status = \"waiting_others\"\n end \n elsif event.voting? && event.starting? && all_voted == false && event.event_status != \"vote\"\n if minutes_diff > event.time_limit\n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n else\n p \"WAITING\"\n event.event_status = \"waiting_others\"\n end \n end\n \n if event.finished == false && event.rating_phase == \"knockout_match\"\n knockouts = EventKnockout.where(\"event_id = ? AND round = ? AND finished = false\", event.id, event.knockout_phase).order('id ASC')\n print \"knockouts: \" + knockouts.to_yaml \n @knockout_match = []\n knockouts.each do |event_knockout|\n knockout_user = KnockoutUser.where(\"event_knockout_id = ? AND user_id = ? \", event_knockout.id, @user.id).limit(1).first\n if knockout_user.nil? \n knockout_json = {id: event_knockout.id, :movie_id_1 => event_knockout.movie_id_1, :movie_id_2 => event_knockout.movie_id_2, :round => knockouts.count} \n event.knockout_matches = knockout_json\n event.event_status = \"knockout_choose\" \n break\n end \n end \n \n if event.knockout_matches.nil?\n if minutes_diff > event.time_limit\n if event.minimum_voting_percent < 100 && !knockouts.empty?\n current_knockout = knockouts.first\n knockout_users_count = KnockoutUser.where(\"event_knockout_id = ? \", current_knockout.id).count\n event_user_count = EventUser.where(\"event_id = ? AND accept = true\", event.id).count \n voting_percent = (knockout_users_count * 100) / event_user_count\n if event.minimum_voting_percent <= voting_percent\n continueKnockout(event, friends_map, @user, true)\n event.time_limit = event.time_limit + 15\n event.save\n else\n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n end\n else \n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n end\n else\n event.event_status = \"waiting_others\" \n end\n end \n end \n \n my_event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, @user.id).limit(1).first \n if my_event_user.declined? \n event.event_status = \"declined\" \n end \n\n puts \" EVENT \" + event.id.to_s + \" status: \" + event.event_status.to_s \n else\n @past_events << event \n end\n end \n \n respond_with build_events_json(@events) \n else\n render :events => { :info => \"Error\" }, :status => 403\n end \n end",
"def events_for_user (user_id)\n events_users.includes(:event).where(\"events_users.user_id=?\",user_id)\n end",
"def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end",
"def to_hash\n @table.inject(Hash.new) { |h, arr| k, v = arr; h[k.id2name] = v; h }\n end",
"def index\n @user_history_records = UserHistoryRecord.all\n num_on_time_by_day = UserHistoryRecord.group_by_day(:arrival, format: \"%B %d, %Y\").where(:on_time => true).count\n total_by_day = UserHistoryRecord.group_by_day(:arrival, format: \"%B %d, %Y\").count\n @percent_on_time_by_day = num_on_time_by_day\n @percent_on_time_by_day.each do |key, record|\n if record != 0\n @percent_on_time_by_day[key] = record / total_by_day[key].to_f\n end\n end\n\n user_on_time = UserHistoryRecord.group(:uuid).where(:on_time => true).count\n user_late = UserHistoryRecord.group(:uuid).where(:on_time => false).count\n @group_by_user = [{:name => 'On Time', :data => user_on_time}, {:name => 'Late', :data => user_late}]\n\n end",
"def hash\n [key, name, event_code, event_type, district, city, state_prov, country, start_date, end_date, year, short_name, event_type_string, week, address, postal_code, gmaps_place_id, gmaps_url, lat, lng, location_name, timezone, website, first_event_id, first_event_code, webcasts, division_keys, parent_event_key, playoff_type, playoff_type_string].hash\n end",
"def sortDataByUserId(hashed_data1)\r\n newDataValues = []\r\n sorted_hashed_data1 = []\r\n d1 = hashed_data1.length-1\r\n sorted_hashed_data1 = hashed_data1.sort_by { |k| k[\"User ID\"] }\r\n for i in (0..d1) do \r\n newDataValues << sorted_hashed_data1[i].values\r\n end\r\n return newDataValues\r\n end",
"def user_event_inforamtion\n @user_events = UserEvent.where(event_id: params[:event_id])\n\n render json: @user_events, root: \"user_event_information\", each_serializer: Web::V1::UserEventInformationSerializer\n end",
"def extra_tickets_data_look_up\n return if @results.empty?\n\n users = DataStore.instance.users\n @results.each do |ticket|\n user_name = users.find { |u| u['_id'] == ticket['assignee_id'] }&.send(:[], 'name')\n ticket['assignee_name'] = user_name\n end\n end",
"def events\n @events ||= user_events.concat(org_events).uniq\n end",
"def parse_user search\n Hash[*search.split(',').map{|pair| pair.split('=').values_at(0..1)}.flatten]['uid']\n end",
"def ps_to_hash(ps)\n result = {}\n\n ps.each_pair do |k,v|\n if k == :uid\n begin\n result[:username] = Etc.getpwuid(v).name\n rescue Exception => e\n logger.debug(\"Could not get username for #{v}: #{e}\")\n result[:username] = v\n end\n end\n\n result[k] = v\n end\n\n result\n end",
"def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def getSessions(result)\n sessions = result.array.sort_by &:start\n\n groupedSession = sessions.group_by { |session| session.start }\n @massagedGroupedSession = {}\n #puts groupedSession\n\n groupedSession.each_pair do |k, v|\n startTime = Time.iso8601(k).strftime('%I:%M%p')\n @massagedGroupedSession[startTime] = v\n end\n\n #puts groupedSession.keys.size\n\n=begin\n datesCollection = sessions.uniq { |x| x.start }\n\n zdatesCollection.each { |x|\n puts x.start\n\n }\n=end\n\n #sessions.sort_by &:start\n @massagedGroupedSession\n end",
"def event_data\n {\n user_kyc_detail: @user_kyc_detail.get_hash,\n admin: @user_kyc_detail.get_last_acted_admin_hash\n }\n end",
"def get_relation_data_as_hash(query) \n return {} if @relations.nil? or @relations.empty?\n\n includes = get_includes(query)\n\n reldata = {}\n\n @relations.each do |name, relation| \n unless includes.find_index(name).nil?\n sql = get_relation_query_sql(relation, query)\n tables = get_relation_tables(relation)\n data = cached_query(sql,tables)\n reldata[name] = map_to_hash_of_arrays_by_key(data,'_table_key')\n remove_key_from_hash_of_arrays!(reldata[name],'_table_key')\n end\n end\n reldata\n end",
"def get_results(user_name)\n \n user = UserInterest.find_by_songkick(user_name).user if user_name\n if user\n\n Rails.logger.info \">>>>> user: #{user_name}\"\n \n remote = Songkickr::Remote.new \"#{ENV['SONG_KICK_API_KEY']}\" \n Rails.logger.info \">>>> remote: #{remote.inspect}\"\n results = remote.users_tracked_events_calendar(user_name)\n Rails.logger.info \">>>>>> results: #{results.inspect}\"\n \n concerts = []\n results.results.each do |r|\n concert = {event: r.event.display_name, venue: r.event.venue.display_name, date: r.event.start, artists: r.event.performances.first.artist.display_name, link: r.event.uri}\n # Note: only grabbing 1st artist\n concerts << concert \n end\n \n if concerts.any?\n concerts.each_with_index do |concert, index|\n c = Concert.find_by_event(concert[:event])\n unless c.present?\n c = Concert.create(event: concert[:event], venue: concert[:venue], date: concert[:date], artists: concert[:artists], link: concert[:link])\n end\n\n user.concerts << c unless user.concerts.include?(c) || user.unfollow_concerts.pluck(:concert_id).include?(c.id) \n\n \n artist = Artist.find_by_name(concert[:artists])\n unless artist.present?\n artist = Artist.create(name: concert[:artists])\n end\n end \n\n \n end\n end \n\n end",
"def all_users\n every_user =\n $all_posts.group_by { |row| row.name}\n .map { |row| row.first }\n render json: every_user\n end",
"def fetch_analytics(collection)\n ga4 = ga4_analytics(collection)\n ua = ua_analytics(collection)\n \n analytics = (ga4+ua).map{|a| a.to_h }.group_by{|h| h[:object] }.map{|k,v| v.reduce({}, :merge)}\n \n analytics.each do |entry|\n entry[:users] = entry[:users].to_i + entry[:ga4_users].to_i if entry[:ga4_users].present?\n entry[:totalEvents] = entry[:totalEvents].to_i + entry[:ga4_totalEvents].to_i if entry[:ga4_totalEvents].present?\n entry[:totalHits] = entry[:totalHits].to_i + entry[:ga4_totalHits].to_i if entry[:ga4_totalHits].present? \n end\n\n object_hash = object_titles(collection)\n analytics.each{ |r| r[:title] = object_hash[r[:object]] }\n\n if sort_column == 'title'\n analytics.sort_by! { |hsh| hsh[sort_column.to_sym] }\n else\n analytics.sort_by! { |hsh| hsh[sort_column.to_sym].to_i }\n end\n analytics.reverse! if sort_direction == 'desc'\n\n analytics\n end",
"def to_hash\n @data.map do |row|\n hsh = {}\n @field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }\n hsh\n end\n end",
"def generate_hash\n @tags.group_by do |x|\n x[:name]\n x.delete(:name)\n end\n end",
"def result\n Hash[\n metadata.map do |key, value|\n [key, PostgresValue.for(value).result]\n end\n ]\n end",
"def search_users(term, value)\n results = @users_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |user|\n # Get related organizations\n user['organizations'] =\n @organizations_indice.search_by_primary_key(value: user['organization_id'])\n\n # Get submitted tickets related to user\n user['submitted_tickets'] =\n @tickets_indice.search(term: 'submitter_id', value: user['_id'])\n\n # Get assigned tickets related to user\n user['assigned_tickets'] =\n @tickets_indice.search(term: 'assignee_id', value: user['_id'])\n end\n end\n results\n end",
"def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end",
"def to_hash(user=nil, client=nil)\n hash = {\n :id => guid,\n :name => name,\n :description => description,\n :owner_id => owner.guid,\n :owner_name => owner.name_or_username,\n :created_at => created_at,\n :updated_at => updated_at,\n :channel_type => channel_type,\n :hidden => hidden,\n :message_count => self.messages.size\n }\n\n if messages.size > 0\n poster = self.messages.first.poster\n if poster\n hash.merge!({ :updated_by => { :link => poster.to_link, :name => poster.display_name }})\n end\n else\n hash.merge!({ :updated_by => { :link => owner.to_link, :name => owner.display_name }})\n end\n\n hash\n end",
"def ps_to_hash(ps)\n result = {}\n\n ps.each_pair do |k,v|\n if k == :uid\n begin\n result[:username] = Etc.getpwuid(v).name\n rescue Exception => e\n logger.debug(\"Could not get username for #{v}: #{e}\")\n result[:username] = v\n end\n end\n\n result[k] = v\n end\n\n result\n end",
"def return_this(user_id)\n return_this = []\n converts_result_hash_into_array(user_id).each do |i|\n return_this << (i[0] + \" -- \" + i[1])\n end\nreturn return_this\nend",
"def hash\n [error, from_date, group_by, message, query, res_type, series, status, to_date].hash\n end"
] |
[
"0.7278814",
"0.6213512",
"0.6115961",
"0.6013456",
"0.5996851",
"0.59955543",
"0.59932077",
"0.5943491",
"0.59336543",
"0.5907099",
"0.58147174",
"0.5800028",
"0.57987255",
"0.57955736",
"0.57641184",
"0.57549167",
"0.5732454",
"0.5695671",
"0.5689444",
"0.5679773",
"0.56595284",
"0.5657258",
"0.5637347",
"0.5629255",
"0.5609198",
"0.5564381",
"0.5544308",
"0.5531504",
"0.5486597",
"0.5479464",
"0.54781467",
"0.547534",
"0.5467363",
"0.54526573",
"0.54487485",
"0.54359776",
"0.5431045",
"0.5425323",
"0.5402003",
"0.5394976",
"0.53858894",
"0.5379635",
"0.5379635",
"0.537925",
"0.5370586",
"0.53637",
"0.53613096",
"0.535386",
"0.5348602",
"0.53352225",
"0.53330034",
"0.53156966",
"0.5304295",
"0.5302898",
"0.52953154",
"0.5291392",
"0.52913475",
"0.5288758",
"0.5287725",
"0.5285335",
"0.5279679",
"0.5272398",
"0.52723056",
"0.5270551",
"0.5262112",
"0.526005",
"0.52443236",
"0.52419674",
"0.5238963",
"0.523061",
"0.52293795",
"0.52293795",
"0.5227472",
"0.5225652",
"0.52247286",
"0.52035224",
"0.5201837",
"0.5192498",
"0.5179229",
"0.5179147",
"0.51778007",
"0.5177178",
"0.5158476",
"0.51578444",
"0.5155271",
"0.5153828",
"0.51536727",
"0.5142753",
"0.5135553",
"0.51331663",
"0.5129478",
"0.5128796",
"0.5127797",
"0.5126018",
"0.512267",
"0.51196516",
"0.5118395",
"0.51111317",
"0.51102906",
"0.510592"
] |
0.72536796
|
1
|
Directory of the input file
|
def input_dir
ENV['mapred_input_dir']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def directory\n @directory ||= File.expand_path(File.dirname(file))\n end",
"def directory\n File.dirname @path\n end",
"def dir_name\n File.dirname(file_name)\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def dir\n calc_dir(@basename)\n end",
"def directory; end",
"def directory; end",
"def file_dir\n @parent_generator.file_dir\n end",
"def file_path\n dir\n end",
"def containing_directory\n path.dirname\n end",
"def file_dir\n 'files'\n end",
"def current_dir\n File.dirname(file_path)\n end",
"def directory\r\n \t@directory.path\r\n end",
"def dirname\n File.dirname(filename)\n end",
"def basedir\n File.dirname File.absolute_path options[:file]\n end",
"def folder\n @folder ||= File.dirname(source)\n end",
"def dir_path\n File.expand_path(File.dirname(@path))\n end",
"def dirname\n File.dirname(filename)\n end",
"def directory\n self.path.directory\n end",
"def work\n '/' + File.dirname(file)\n end",
"def dir\n File.dirname(__FILE__)\n end",
"def dir\n File.dirname(self.path)\n end",
"def directory_to_scan\n Helper.question( 'What is the path to your .enex directory? (e.g.: ~/Documents/my_evernote.enex): ')\n @directory = full_path_to_directory(gets.chomp)\n\n if does_directory_exist?\n @directory = Pathname.new([@directory, '**/*'].join('/'))\n else\n Helper.warning(\"The directory does not exist ...\\n\")\n Helper.exit?\n directory_to_scan\n end\n end",
"def sequence_folder\n \"#{@parent_path}output/#{@input_name}/sequence/\"\n end",
"def dir\n @dir ||= self.class.normalize_dir(::File.dirname(@path))\n end",
"def directory(dir); end",
"def directory\n args[1]\n end",
"def dir(file_name)\n File.join(@out_dir, file_name)\n end",
"def dir\n @dir ||= File.dirname(fullpath)\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end",
"def pos_directory\n pos_fil_trailer\n end",
"def input_base_path(input_file,ext=nil)\n input_path=Pathname.new(input_file)\n throw \"Error: Input directory #{input_path.dirname} does not exist\" unless input_path.dirname.exist?\n dir=input_path.dirname.realpath.to_s\n if ( ext==nil)\n ext=input_path.extname \n end\n base_name=input_path.basename.to_s.gsub(/#{ext}$/,\"\")\n \"#{dir}/#{base_name}\"\n end",
"def ocr_in_path\n in_dir = Figgy.config[\"ocr_in_path\"]\n FileUtils.mkdir_p(in_dir) unless File.directory?(in_dir)\n\n in_dir\n end",
"def dir\n @directory\n end",
"def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end",
"def dir\n @dir ||= File.join Hoboku.data_dir, name\n end",
"def output_dir\n @output_dir\n end",
"def relative_directory; end",
"def relative_import_dir\n \"/uploads/#{InverseCsvImporter.table_name(self.file)}\"\n end",
"def file_path\n dir_name + file_name\n end",
"def basedir\n return nil if !file\n File.dirname File.absolute_path @file\n end",
"def file_dir # :nodoc:\n nil\n end",
"def file_dir\n nil\n end",
"def store_dir\n \"city-of-meridian/files/\"\n end",
"def root\n '../' * file.count('/')\n end",
"def sample_dir\n\t\t\"#{@dir}/samples\"\n\tend",
"def input_path\n path = ENV['input_path']\n check_path!(path)\n path\n end",
"def file_type; 'directory' end",
"def output_directory_path\n if @output_directory.nil?\n directory = File.join(Rails.root, 'script')\n else\n directory = File.join(@output_directory, \"\")\n end\n directory\n end",
"def output_directory_path\n if @output_directory.nil?\n directory = File.join(Rails.root, 'script')\n else\n directory = File.join(@output_directory, \"\")\n end\n directory\n end",
"def directory\n return @directory\n end",
"def dir\n self.a_dir.join '/'\n end",
"def enclosed_directory\n \".\"\nend",
"def file_path\n File.join(dir,filename)\n end",
"def _FILESDIR; Config._FILES; end",
"def directory\n @options[:directory]\n end",
"def path_dir\n File.split(path).first\n end",
"def mock_file_path\n source = __dir__\n File.join(source, \"input/input.csv\")\n end",
"def output_root\n ETL.config.core[:job][:data_dir]\n end",
"def dataset_dir\n Atlas.data_dir.join(DIRECTORY).join(key.to_s)\n end",
"def data_directory\n @data_directory\n end",
"def directory\n return _meta_data['directory'] if _meta_data.has_key? 'directory'\n dir\n end",
"def local_directories\n settings[:input].map do |dir|\n File.join(File.expand_path(dir.to_s), \"\") # always use a trailing '/' with s3cmd\n end\n end",
"def directory\n self.class.directory\n end",
"def directory\n self.class.directory\n end",
"def directory\n File.join(Cfg.rootdir, @category, @suitename, @component, \"binary-#{name}\")\n end",
"def path\n @directory.path\n end",
"def dirname\n return File.dirname( self.path )\n end",
"def a_dir\n self.path.split('/')[0...-1]\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end",
"def initialize_output_directory()\n require 'fileutils'\n FileUtils.mkdir_p(OUTPUT_DIRECTORY)\n end",
"def get_directory(prefix='')\n File.expand_path(prefix, File.dirname(__FILE__))\n end",
"def dir\n @working_directory\n end",
"def input_paths\n reads_from_elasticsearch? ? elasticsearch_hdfs_tmp_dir(input_index) : super()\n end",
"def destination(base_directory); end",
"def rootdir() File.join(File.dirname(File.expand_path(__FILE__)), 'pipin') end",
"def directory\n @directory ||= site.in_source_dir(\n File.join(container, relative_directory)\n )\n end",
"def dir\n Rails.root.join(ROOT, type, name).to_s\n end",
"def relative_directory\n @relative_directory ||= \"_#{label}\"\n end",
"def given_destination\n dir\n end",
"def path(input_filepath)\n\t\tPathname.new(input_filepath).expand_path\n\tend",
"def base_directory\n @base_directory\n end",
"def root\n File.dirname __dir__\n end",
"def _spec_data_dir(file)\n datadir = Dir.new('./spec/data/')\n File.join(datadir.path, file)\nend",
"def dir; end",
"def dir; end",
"def dir; end",
"def current_directory\n File.expand_path @current_directory\n end",
"def current_dir; end",
"def glob_to_directory(glob); end",
"def directory!\n @file_list = @file_list.select{ |f| File.directory?(f) }\n end",
"def output_dir\n output_dir = @output_dir.nil? ? Dir.getwd : @output_dir\n FileUtils.mkdir_p(output_dir) unless ::File.directory?(output_dir)\n output_dir\n end",
"def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end",
"def getfolder(file)\n # Directory to return after analysing the target\n current_dir = Dir.pwd\n # when the target is a directory cd into inmediatly\n if File.directory? file\n Dir.chdir file\n # Get the folder that is going to be replaced with ./\n directory = Dir.pwd + '/'\n else\n # When the target is a file we need to get it's location\n splited_file_path = File.expand_path(file).split('/')\n # this limit reference the last folder before the filename\n limit = splited_file_path.length - 1\n # Get into the same folder of the target file\n Dir.chdir splited_file_path[0...limit].join('/')\n # Get the folder that is going to be replaced with ./\n directory = Dir.pwd + '/'\n end\n # Return to the original working directory\n Dir.chdir current_dir\n # return the founded directory that is going to be repalced in the target's path with './'\n directory\nend",
"def generated_files_dir\n dir(@generated_files_dir || default_generated_files_dir)\n end",
"def log_directory\n File.join(@relative_to_base, LOG_DIRECTORY_NAME)\n end",
"def observation_directory\n return @observation_directory unless @observation_directory.nil?\n test_file = @current_test.metadata[:file_path]\n File.join(File.dirname(File.absolute_path(test_file)), 'test_observations')\n end",
"def directory(args)\n args.map! do |file|\n File.expand_path(file)\n end\n\n args.select! do |file|\n File.exist?(file)\n end\n args[0]\n end",
"def _dir label\n path = (@path =~ %r{\\A(.*[^/])/?}) ? $1 : @path # strip trailing slash\n (%r{\\A(.*)/#{SkylabFolder}\\Z} =~ path) and path = $1\n path = File.join(path, SkylabFolder)\n File.directory?(path) or return @err.puts(\"#{label} must be directory: #{path}\")\n path\n end"
] |
[
"0.7256849",
"0.6994249",
"0.6786726",
"0.67843723",
"0.67690074",
"0.6702588",
"0.6702588",
"0.66673404",
"0.6648779",
"0.6620506",
"0.65500283",
"0.654608",
"0.6544043",
"0.6517264",
"0.65160245",
"0.6514815",
"0.6511904",
"0.65039927",
"0.64834625",
"0.64830095",
"0.64371055",
"0.6406513",
"0.63783795",
"0.6360183",
"0.63525844",
"0.63520515",
"0.6343894",
"0.6339598",
"0.63354665",
"0.63326854",
"0.63321316",
"0.63241273",
"0.6313098",
"0.6304834",
"0.62992",
"0.62911797",
"0.6246278",
"0.6222923",
"0.62008727",
"0.619251",
"0.61706436",
"0.61573786",
"0.6139504",
"0.6136266",
"0.61210847",
"0.61204475",
"0.61204433",
"0.61160165",
"0.61146045",
"0.61146045",
"0.60910785",
"0.6087836",
"0.60793316",
"0.6068399",
"0.606515",
"0.60496557",
"0.60433966",
"0.60342634",
"0.6033746",
"0.60089487",
"0.6000408",
"0.598717",
"0.5983353",
"0.5981616",
"0.5981616",
"0.59651875",
"0.5944413",
"0.59431565",
"0.5933112",
"0.59269387",
"0.59230727",
"0.5915401",
"0.5902602",
"0.5898554",
"0.5871681",
"0.5866903",
"0.58617723",
"0.5860518",
"0.5852857",
"0.5847212",
"0.584425",
"0.58440703",
"0.58385473",
"0.58340436",
"0.582534",
"0.582534",
"0.582534",
"0.5824791",
"0.582439",
"0.5805469",
"0.58042043",
"0.5803683",
"0.58020824",
"0.5799304",
"0.57914996",
"0.57888174",
"0.57782614",
"0.577645",
"0.576844"
] |
0.6922755
|
3
|
Offset of this chunk within the input file
|
def map_input_start_offset
ENV['map_input_start']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def offset\n fil_header[:offset]\n end",
"def tell\n @offset\n end",
"def offset\n\t\t\t@position + @offset\n\t\tend",
"def byte_offset(loc) loc.y * line_byte_size + loc.x * pixel_byte_size; end",
"def lines_offset\n @starting_line - 1\n end",
"def offset; end",
"def offset; end",
"def offset; end",
"def offset\n 1\n end",
"def pos\n file.pos\n end",
"def line_offset\n\t\t\t@offset - @line_range.min\n\t\tend",
"def read_offset(fp)\n byte = Support::HexString.from_bin(fp.read(1)).ord\n tot = byte & 0x7f\n while (byte & 0x80) > 0\n byte = Support::HexString.from_bin(fp.read(1)).ord\n tot = ((tot + 1) << 7) | (byte & 0x7f)\n break if (byte & 0x80) == 0\n end\n tot\n end",
"def calc_input_offset\n if input_count.zero?\n 0\n else\n buffer.abs_offset\n end\n end",
"def offset()\n @offset__\n end",
"def parse_index_offset\n return -1 if @isMzData\n r = %r{\\<indexOffset\\>(\\d+)\\<\\/indexOffset\\>}\n seekoffset = -120\n while true \n self.seek(seekoffset, IO::SEEK_END)\n if (r.match(self.read)) then \n return $1.to_i\n end\n seekoffset -= 10\n return -1 if seekoffset <= -1000\n end\n end",
"def index_offset(io, tag='indexListOffset', bytes_backwards=200)\n tag_re = %r{<#{tag}>([\\-\\d]+)</#{tag}>}\n io.pos = (io.size - 1) - bytes_backwards\n md = io.readlines(\"\\n\").map {|line| line.match(tag_re) }.compact.shift\n md[1].to_i if md\n end",
"def b_offset\n @last_4[1].to_i\n end",
"def line_offset(line_index)\n return unless line_exists?(line_index)\n line_index == 0 ? 0 : @line_lengths[0..(line_index - 1)].sum\n end",
"def get_offset\n @offset\n end",
"def pos_on_line(offset)\n offset_on_line(offset) +1\n end",
"def pos_on_line(offset)\n offset_on_line(offset) +1\n end",
"def first_offset; end",
"def first_offset; end",
"def tell; @next_block_pos end",
"def token_pos(byte_offset) # :nodoc:\n [byte_offset - @line_pos, @line]\n end",
"def pos\n @io.pos - @buffer.size\n end",
"def offset_on_line(offset)\n end",
"def line_for_offset(offset)\n end",
"def offset\n (current_page * size) - size\n end",
"def from_line_index\n from_line - 1\n end",
"def pos\n io.pos\n end",
"def pos_on_line(offset)\n end",
"def offset\n @offset ||= raw_response['response']['start']\n end",
"def offset\n match = File.basename(@path).match(/\\d+\\.\\d\\d\\b/)\n return match[0] if match\n end",
"def current_offset; end",
"def offset_on_line(offset)\n line_offset = line_index[line_for_offset(offset)-1]\n if multibyte?\n @string.byteslice(line_offset, offset-line_offset).length\n else\n offset - line_offset\n end\n end",
"def line_offset(pos=pos())\n p = 0\n string.each_line do |line|\n len = line.length\n return (pos - p) if p + len >= pos\n p += len\n end\n 0\n end",
"def local_header_offset; end",
"def line_offset(pos=pos)\n p = 0\n string.each_line do |line|\n len = line.length\n return (pos - p) if p + len >= pos\n p += len\n end\n 0\n end",
"def content_offset(offset, dimension)\n return 0 unless offset >= dimension\n\n offset - dimension\n end",
"def next_offset\n [all_contents.size + 1, offset + limit].min\n end",
"def offset(*) end",
"def next_chunk_number\n\t\t\treturn -1\n\t\tend",
"def token_pos offset\n [offset - @line_pos, @line]\n end",
"def src_offset=(ofs)\n # returns receiver\n if ofs._isFixnum # TODO remove check\n @_st_position = ofs + 1 # convert to one-based\n else\n raise_error('invalid source offset')\n end\n end",
"def offset_on_line(offset)\n line_offset = line_index[ line_for_offset(offset)-1 ]\n @string.byteslice(line_offset, offset-line_offset).length\n end",
"def offset\n execute['offset']\n end",
"def offset\n @object.send(:read_attribute,@startAttribute)\n end",
"def offset\n operation.offset\n end",
"def offset\n loffset + 6\n end",
"def pos\n (stream[:total_out_hi32] << 32) + stream[:total_out_lo32]\n end",
"def read_chunk\n #puts(\"Reading #{BLOCK_SIZE} bytes from offset #{self.head}\")\n \n # Read a block relative to the head pointer offset\n self.last_chunk = File.read(buffer_file.path, BLOCK_SIZE, self.head)\n self.head += BLOCK_SIZE\n \n # If we've read to the end, loop around to the start\n if self.head >= File.size(buffer_file)\n self.head = 0\n end \n end",
"def offset_of(lblock)\n if (@state.first_phase)\n 0\n else\n if (lblock.kind_of?(SymbolicBlock::End))\n @state.curr_offset\n else\n lblock.offset\n end\n end\n end",
"def input_start_offset\n _response_word.fetch(\"startingPos\", nil)\n end",
"def char_offset(byte_offset)\n end",
"def in_file_location(out)\n out << \"#{@row = 1} at #{@column = 1} at #{@length}\"\n end",
"def seek(offset)\n @file.seek offset\n end",
"def offset(off)\n return self if off == 0\n next_item.offset(off - 1)\n end",
"def offset\n address(relative: true)\n end",
"def line_index()\n end",
"def entry_start_pos\n @splitter.entry_start_pos\n end",
"def line_for_offset(offset)\n if line_nbr = line_index.index {|x| x > offset}\n return line_nbr\n end\n # If not found it is after last\n return line_index.size\n end",
"def get_line_and_column_from_chunk(offset)\n if offset.zero?\n return [@chunk_line, @chunk_column]\n end\n\n string =\n offset >= @chunk.size ? @chunk : @chunk[0..offset-1]\n\n line_count = string.count(\"\\n\")\n\n column = @chunk_column\n if line_count > 0\n lines = string.split(\"\\n\")\n column = lines.empty? ? 0 : lines[-1].size\n else\n column += string.size\n end\n\n [@chunk_line + line_count, column]\n end",
"def bytepos; end",
"def get_current_offset\n @offset < 0 ? 0 : @offset\n end",
"def line_pos(row)\n (row > 0 ? src.split(\"\\n\")[0..(row - 1)].inject(0) { |pos, line| pos + line.length + 1 } : 0)\n end",
"def pos\n raise ArgumentError, \"no stream\" unless __advance!\n @_st_stream.tell\n end",
"def offset\n self[:ip_off]\n end",
"def pos\n @read\n end",
"def offset\n (page - 1) * PER_PAGE\n end",
"def pos\n @stream.pos\n end",
"def index_psm_positions\n # create an in-memroy index of PSM byteoffsets\n q,p = 0,0\n # move the cursor past the boundary line\n @filehandle.readline\n @filehandle.each do |line|\n break if line =~ @dat.boundary\n line =~ /q(\\d+)_p(\\d+)/\n qq,pp= $1.to_i, $2.to_i\n next if q == qq && p == pp\n q,p = qq,pp\n unless @psmidx.has_key?(q)\n @psmidx[q] = {}\n end\n @psmidx[q][p] = @filehandle.pos - line.length\n end\n @endbytepos = @filehandle.pos - @dat.boundary_string.length\n self.rewind\n end",
"def to_find_offset\n @offset\n end",
"def offset_to(source_position, pattern, offset = 0)\n actual_line = source_position.line - 1\n actual_offset = source_position.offset + offset - 1\n\n return nil if actual_line >= engine.lines.size\n\n actual_index = engine.lines[actual_line].index(pattern, actual_offset)\n\n actual_index && actual_index + 1 - source_position.offset\n end",
"def getNextRecordOffset(curr_pos, hdr)\n # Called the first time\n if curr_pos.nil?\n @csr = getFirstRecordOffset(hdr)\n curr_pos = @csr[:end_record]\n end\n\n # Check for wrapped messages\n if curr_pos == ELF_LOGFILE_HEADER.size\n curr_pos = findEndBuffer\n end\n\n offset = curr_pos - 4\n prev_rec_length = read_buffer(offset, 4, -1)\n rec_len = EVENTRECORDLENGTH.decode(prev_rec_length)[:record_length]\n new_pos = (curr_pos - rec_len)\n\n # Check for wrapped messages\n if new_pos < ELF_LOGFILE_HEADER.size\n copy_from_end = ELF_LOGFILE_HEADER.size - new_pos\n new_pos = @file_size - copy_from_end\n end\n new_pos\n end",
"def pos; @_io.pos; end",
"def _increment_file_line()\n\t\t@reading_line += 1\n\tend",
"def line\n\t\treturn @file_data[@current_line]\n\tend",
"def local_header_offset=(_arg0); end",
"def each_line_with_offset\n return to_enum(:each_line_with_offset) unless block_given?\n\n offset = 0\n\n each_line do |line|\n yield line, offset\n offset = tell\n end\n end",
"def starting_position; end",
"def current_line\n\n seek_line_head\n @file.gets\n end",
"def position\r\n self.line.ordered_samples.to_a.index(self)\r\n end",
"def column\n old_pos - start_of_current_line_pos\n end",
"def column\n old_pos - start_of_current_line_pos\n end",
"def pos_fil_header\n 0\n end",
"def position\n @position ||= begin\n row, column = filename_with_position.split(':').slice(1..2)\n Parsing::Location.new(row: row.to_i, column: column.to_i)\n end\n end",
"def find_first_xref_offset\n @io.seek(-1024, IO::SEEK_END) rescue seek(0)\n data = @io.read(1024)\n\n # the PDF 1.7 spec (section #3.4) says that EOL markers can be either \\r, \\n, or both.\n # To ensure we find the xref offset correctly, change all possible options to a\n # standard format\n data = data.gsub(\"\\r\\n\",\"\\n\").gsub(\"\\n\\r\",\"\\n\").gsub(\"\\r\",\"\\n\")\n lines = data.split(/\\n/).reverse\n\n eof_index = nil\n\n lines.each_with_index do |line, index|\n if line =~ /^%%EOF\\r?$/\n eof_index = index\n break\n end\n end\n\n raise MalformedPDFError, \"PDF does not contain EOF marker\" if eof_index.nil?\n raise MalformedPDFError, \"PDF EOF marker does not follow offset\" if eof_index >= lines.size-1\n lines[eof_index+1].to_i\n end",
"def normal_data_start(text)\n text.index(\"\\1\\n\", 2) + 2\n end",
"def line_number\n lines_read.length\n end",
"def find_position(path, line_number)\n io = @diff.each_line # maybe redundant?\n\n file_header = \"+++ b/#{path}\\n\" # fixme\n if !io.find_index(file_header)\n @status = :file_not_found\n return\n end\n\n line = io.peek\n if !hunk_header?(line)\n raise StandardError.new(\"Expected hunk header to be after file header, but got '#{line}'\")\n end\n\n pos = 0\n\n while true\n line = io.next\n pos += 1\n\n if file_header?(line)\n @status = :line_not_found\n return\n end\n\n if !hunk_header?(line)\n next\n end\n\n line_numbers = line_numbers_for_destination(line)\n\n if destination_position = line_numbers.find_index(line_number)\n @status = :found_position\n return pos + find_hunk_index(io, destination_position)\n end\n end\n rescue StopIteration\n @status = :line_not_found\n end",
"def tile_offset index\n\t\t\t@unit_size * index\n\t\tend",
"def line_for_offset(offset)\n if @prev_offset == offset\n # use cache\n return @prev_line\n end\n line_nbr = ary_bsearch_i(line_index, offset)\n if line_nbr\n # cache\n @prev_offset = offset\n @prev_line = line_nbr\n return line_nbr\n end\n # If not found it is after last\n # clear cache\n @prev_offset = @prev_line = nil\n return line_index.size\n end",
"def pos_fil_trailer\n size - size_fil_trailer\n end",
"def seek(offset)\n @data.seek(@data_offset + offset)\n end",
"def line_char_to_offset(text, line, character); end",
"def position(relative_to=nil)\n l = line()\n\n if l == 0\n if @ip < 0\n file(relative_to)\n else\n \"#{file(relative_to)}+#{@ip}\"\n end\n else\n \"#{file(relative_to)}:#{l}\"\n end\n end",
"def line_number\n\t\t\t@line_index + 1\n\t\tend",
"def start_line_number; end"
] |
[
"0.7363777",
"0.69336796",
"0.6904988",
"0.68578357",
"0.6818189",
"0.6736505",
"0.6736505",
"0.6736505",
"0.6667908",
"0.6655746",
"0.6645607",
"0.65575856",
"0.65435386",
"0.65065265",
"0.6461156",
"0.64482814",
"0.64155257",
"0.6406651",
"0.6400084",
"0.6391224",
"0.6391224",
"0.6371857",
"0.6371857",
"0.63390917",
"0.6336677",
"0.63107336",
"0.63097775",
"0.6285472",
"0.6266734",
"0.62532794",
"0.62481415",
"0.62353015",
"0.62331015",
"0.62305486",
"0.62284315",
"0.6207935",
"0.620287",
"0.6189556",
"0.61864233",
"0.61855",
"0.6165616",
"0.61502546",
"0.61499286",
"0.6144251",
"0.61408913",
"0.6135334",
"0.61238736",
"0.6107626",
"0.60945123",
"0.60908264",
"0.6071304",
"0.60472274",
"0.604564",
"0.60368526",
"0.60300666",
"0.6002845",
"0.5994142",
"0.59914684",
"0.59664774",
"0.59612894",
"0.5957993",
"0.59505934",
"0.5944009",
"0.5939782",
"0.5932632",
"0.59288466",
"0.59169686",
"0.59156233",
"0.5903796",
"0.5887881",
"0.5879799",
"0.58663267",
"0.5864969",
"0.58395433",
"0.58328944",
"0.5828448",
"0.5819456",
"0.5808722",
"0.58080155",
"0.58023536",
"0.57872975",
"0.57869446",
"0.578612",
"0.57837546",
"0.57837546",
"0.5777192",
"0.577685",
"0.5770463",
"0.57683706",
"0.5765147",
"0.5763213",
"0.57594657",
"0.57528293",
"0.57485765",
"0.5743456",
"0.5739329",
"0.57298744",
"0.57228655",
"0.5714817"
] |
0.59268326
|
67
|
length of the mapper's input chunk
|
def map_input_length
ENV['map_input_length']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def chunk_size()\n #This is a stub, used for indexing\n end",
"def length\n @length ||= (count.to_f / @per_chunk).ceil\n end",
"def total_in\n\t\t@input_buffer.length\n\tend",
"def input_size\n return input.first.command.size\n end",
"def total_in\n\t\t\t@input_buffer.length\n\t\tend",
"def size(input); end",
"def block_size; end",
"def length \n io_index.length\n end",
"def size\n @map.length + 1\n end",
"def size\n return @args[:data].length\n end",
"def length\n return @args[:data].length\n end",
"def length\n @main_generator.length\n end",
"def chunk_size\n 4096\n end",
"def mapsize\r\n\t\t@array_translate[0][1].to_i\r\n\tend",
"def chunk_count\n (body.length / chunk_size.to_f).ceil\n end",
"def chunk_length(param = 10)\n \"chunkLength=#{param}\"\n end",
"def width\n @map[0].size\n end",
"def block_length()\n #This is a stub, used for indexing\n end",
"def block_length()\n #This is a stub, used for indexing\n end",
"def length\n @blocks.inject(@entry.length) {| sum , item | sum + item.length}\n end",
"def long_read_len()\n #This is a stub, used for indexing\n end",
"def size\n @map.size\n end",
"def trait\n @raw_data.size\n end",
"def map_size()\n Config.map_size\n end",
"def size\n return @buffer.count\n end",
"def byte_size(); @data.byte_size + 4; end",
"def size\n self.data.length + 4\n end",
"def length\n beam.length\n end",
"def length\n pack.length\n end",
"def size\n @size ||= (@key_map || @row || []).size\n end",
"def length; count end",
"def length() end",
"def length() end",
"def length() end",
"def length() end",
"def current_length; end",
"def size\n\t\tlengths.reduce(&:*)\n\tend",
"def height\n @map.size\n end",
"def chunk_size\n @connection.chunk_size\n end",
"def length; end",
"def length; end",
"def length; end",
"def length; end",
"def length; end",
"def length; end",
"def length; end",
"def total_out\n\t\t@output_buffer.length\n\tend",
"def size\n return @args[\"data\"].length\n end",
"def hard(input)\n input.map { |line| line.dump.length - line.length }.sum\nend",
"def code_length\n @correct_row.get_pins.size\n end",
"def size\n data.values.inject(0){|m,v| m+=v.size}\n end",
"def size\r\n self.data.length\r\n end",
"def size\n @size ||= @buffer.size\n end",
"def length\n return @args[\"data\"].length\n end",
"def entry_size; BLOCK_SIZE; end",
"def entry_size; BLOCK_SIZE; end",
"def length\n @line.length\n end",
"def block_length\n 1\n end",
"def length\n do_num_bytes\n end",
"def size\n @length / 4\n end",
"def size\n @buffer.size\n end",
"def size\n @buffer.size\n end",
"def size\n @buffer.size\n end",
"def length\n @blocks.inject(0) {| sum , item | sum + item.length}\n end",
"def size\n 1 + params_size\n end",
"def size; @_io.size; end",
"def render_length; end",
"def total_out\n\t\t\t@output_buffer.length\n\t\tend",
"def length\n @data.length\n end",
"def size\n return @data.size\n end",
"def buffer_size\n @buffer.size\n end",
"def length\n do_num_bytes\n end",
"def length\n do_num_bytes\n end",
"def target_len; genomic.len; end",
"def size; @size end",
"def blksize() end",
"def length\n size\n end",
"def length\n @gens.length\n end",
"def length\n @gens.length\n end",
"def size\n return @hash.length\n end",
"def size\n read.bytesize\n end",
"def length\n @bin_data.length\n end",
"def size \n if @map.empty?\n return 0\n else \n _max_arity\n end\n end",
"def size\n loaded?? length : total_entries\n end",
"def length\n end",
"def length\n end",
"def length\n end",
"def length\n end",
"def length\n end",
"def length\n end",
"def length\n @length\n end",
"def length\n @length\n end",
"def length\n @length\n end",
"def length\n metadata[:length]\n end",
"def length\n each.count\n end",
"def size\n length\n end",
"def size\n return @data.size\n end",
"def size\n @data.size\n end",
"def size\n @data.size\n end"
] |
[
"0.7429016",
"0.7147109",
"0.7025619",
"0.6910388",
"0.6899956",
"0.6749689",
"0.6748568",
"0.67353404",
"0.671725",
"0.6675055",
"0.6656098",
"0.6626331",
"0.66145796",
"0.6611001",
"0.65860945",
"0.65526867",
"0.65507597",
"0.6525423",
"0.6525423",
"0.6475778",
"0.6461294",
"0.645473",
"0.6451561",
"0.64479274",
"0.6446678",
"0.64274675",
"0.6416276",
"0.64086616",
"0.6392275",
"0.63910097",
"0.636574",
"0.6359306",
"0.6359306",
"0.6359306",
"0.6359306",
"0.63466895",
"0.63376105",
"0.6335817",
"0.6330306",
"0.63207525",
"0.63207525",
"0.63207525",
"0.63207525",
"0.63207525",
"0.63207525",
"0.63207525",
"0.6317908",
"0.6303624",
"0.6273908",
"0.62736243",
"0.6268125",
"0.6249266",
"0.62455803",
"0.6238273",
"0.6234851",
"0.6234851",
"0.62168807",
"0.6215397",
"0.62135935",
"0.6206168",
"0.62027574",
"0.62027574",
"0.62027574",
"0.61907977",
"0.6188759",
"0.61881936",
"0.61851513",
"0.616773",
"0.6167364",
"0.61662155",
"0.61610913",
"0.6153199",
"0.6153199",
"0.6146356",
"0.61427903",
"0.61424935",
"0.6132782",
"0.61278754",
"0.61278754",
"0.612348",
"0.6122017",
"0.61137575",
"0.6105044",
"0.61046726",
"0.6101172",
"0.6101172",
"0.6101172",
"0.6101172",
"0.6101172",
"0.609809",
"0.60966945",
"0.60966945",
"0.60966945",
"0.6095813",
"0.6093297",
"0.6093008",
"0.6090179",
"0.60844517",
"0.60844517"
] |
0.71080923
|
3
|
Use callbacks to share common setup or constraints between actions.
|
def set_transfer
@transfer = Transfer.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def transfer_params
params.require(:transfer).permit(:nama_pengirim, :nama_penerima, :no_rek, :nominal, :keterangan)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Initializes a new ZAP request. The security mechanism is set to CURVE (can be changed later).
|
def initialize(domain, credentials = [], mechanism: Mechanisms::CURVE)
@domain = domain
@credentials = credentials
@mechanism = mechanism
@version = VERSION
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(request_url, params, client, options = {})\n if params.is_a?(String)\n @string_params = params\n @hash_params = Hash.from_url_params(params)\n else\n unless options.kind_of?(Hash)\n options = {}\n end\n options[:skip_param_keys] ||= []\n #this is a bit of helpful sugar for rails framework users\n options[:skip_param_keys] |= ['action','controller']\n\n if params.respond_to?(:reject)\n params.reject! {|key, val| options[:skip_param_keys].include?(key) }\n else\n params = {}\n end\n @hash_params = params\n @string_params = InboundRequest.get_http_params(@hash_params)\n end\n #puts \"Params are: #{params.inspect}\"\n @request_url = request_url\n @client = client\n @supplied_signature = @hash_params[self.class::SIGNATURE_KEY]\n @allow_sigv1 = options[:allow_sigv1] || false\n end",
"def initialize(request=nil) \n\t# if is not wrapped in a transaction then we'll wrap it to make unified handling of the request\t\n\tif !check_transaction(request)\t\t\n\t\treq_hash = HashWithIndifferentAccess.new\n\t\treq_hash[:transaction] = HashWithIndifferentAccess.new\n\t\treq_hash[:transaction][:transactionNum] = -1 \t\t\t\t\n\t\treq_list = Array.new\n\t\treq_list << request\n\t\treq_hash[:transaction][:operations] = req_list\n\t\t@request = req_hash\n\telse\n\t\t@request = request\n\tend\t \n end",
"def initialize(initial_params = {})\n raise \"Cannot directly instantiate a #{self.class}.\" if\n self.class == Request\n @params = initial_params\n end",
"def request # :nodoc:\n @request ||= PayPal::ExpressCheckout::Request.new\n end",
"def new\n @request = Request.new\n end",
"def initialize(request, params)\n @request = request\n\n if params['CartId']\n perform_request 'Get', params\n else\n perform_request 'Create', params\n end\n end",
"def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end",
"def construct_request(uri, params, credentials=[])\n Weary::Request.new uri, @method do |r|\n pass_values_onto_requestable(r)\n if !expected_params.empty?\n r.params params.reject {|k,v| !expects? k }\n end\n r.send @authenticates, *credentials if authenticates?\n end\n end",
"def initialize\n @isRequest = nil\t# true, false and nil\n @httpVersion = 'HTTP/1.1'\n @bodyType = nil\n @bodyCharset = nil\n @bodySize = nil\n @bodyDate = nil\n @headerItem = []\n @chunked = false\n @responseStatusCode = nil\n @reasonPhrase = nil\n @requestMethod = nil\n @requestUri = nil\n @requestQueryUri = nil\n @requestViaProxy = false\n end",
"def initialize(base_url,model_data)\n @base_url = base_url\n @model_data = model_data\n\n\n unless @requester_id = model_data[REQUESTER_ID]\n raise ArgumentError, \"Cannot create a #{self.class} without a requester_id\"\n end\n\n @authz_client = AuthzClient.new(resource, @requester_id, base_url)\n @id = model_data[OBJECT_ID]\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def initialize(attributes = {})\n super\n self.api_endpoint ||= Orias.configuration.api_endpoint\n self.per_request ||= Orias.configuration.per_request\n self.private_key ||= Orias.configuration.private_key\n end",
"def initialize(body: \"\", debug: false, headers: {}, request:)\n @body = body\n @debug = debug\n @headers = headers\n @request = request\n @requested_url = request.path\n end",
"def initialize(request)\n @request = request\n end",
"def initialize(request, client = Pusher)\n @client = client\n # For Rack::Request and ActionDispatch::Request\n if request.respond_to?(:env) && request.respond_to?(:content_type)\n @key = request.env['HTTP_X_PUSHER_KEY']\n @signature = request.env[\"HTTP_X_PUSHER_SIGNATURE\"]\n @content_type = request.content_type\n\n request.body.rewind\n @body = request.body.read\n request.body.rewind\n else\n @key, @signature, @body = request.values_at(:key, :signature, :body)\n @content_type = request[:content_type] || 'application/json'\n end\n end",
"def initialize(**parent_params)\n super\n\n @client = Faraday.new do |faraday|\n faraday.use FaradayMiddleware::FollowRedirects\n faraday.adapter Faraday.default_adapter\n end\n @url_template = self.class.construct_template\n end",
"def initialize(begin_date: 1427871600, region: 'na')\n super(region)\n @begin_date = begin_date\n @request = Lol::ApiChallengeRequest.new(client.api_key,\n client.region,\n client.cache_store)\n end",
"def initialize(type = nil, method = nil)\n\t\tsuper(type)\n\n\t\tif (method)\n\t\t\tself.method = method\n\t\tend\n\n\t\tself.created_at = ::Time.now\n\n\t\t# If it's a request, generate a random request identifier\n\t\tif ((type == PACKET_TYPE_REQUEST) ||\n\t\t (type == PACKET_TYPE_PLAIN_REQUEST))\n\t\t\trid = ''\n\n\t\t\t32.times { |val| rid << rand(10).to_s }\n\n\t\t\tadd_tlv(TLV_TYPE_REQUEST_ID, rid)\n\t\tend\n\tend",
"def build_request\n\n uri = URI.parse(@endpoint)\n # add uri\n params = [uri.host, uri.port]\n # add proxy\n params += @proxy.values_at(:host, :port, :user, :pass) unless @proxy.empty?\n\n @http = Net::HTTP.new(*params)\n # add ssl\n if @endpoint.start_with?('https')\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end\n\n net_http = Kernel.const_get('Net::HTTP::' + @request_method[:method].capitalize)\n @request = add_request_headers(net_http.new(uri.request_uri))\n\n end",
"def initialize(type = nil, method = nil)\n\t\tsuper(type)\n\n\t\tif (method)\n\t\t\tself.method = method\n\t\tend\n\n\t\t# If it's a request, generate a random request identifier\n\t\tif ((type == PACKET_TYPE_REQUEST) ||\n\t\t (type == PACKET_TYPE_PLAINTEXT_REQUEST))\n\t\t\trid = ''\n\n\t\t\t32.times { |val| rid << rand(10).to_s }\n\n\t\t\tadd_tlv(TLV_TYPE_REQUEST_ID, rid)\n\t\tend\n\tend",
"def initialize(options = {})\n @options = options\n @request_options = {}\n end",
"def create_request\n raise AttributeMissing.new \"(2500) TransactionReference or OrderReference need to be present.\" if (transaction_reference.nil? && order_reference.nil?)\n raise AttributeMissing.new \"(2500) SiteReference must be present.\" if (site_reference.nil? && (REXML::XPath.first(@request_xml, \"//SiteReference\").text.blank? rescue true))\n REXML::XPath.first(@request_xml, \"//Request\").attributes[\"Type\"] = \"TRANSACTIONQUERY\"\n ops = REXML::XPath.first(@request_xml, \"//Operation\")\n [\"TermUrl\", \"MerchantName\", \"Currency\", \"SettlementDay\"].each { |e| ops.delete_element e }\n (ops.elements[\"SiteReference\"] || ops.add_element(\"SiteReference\")).text = self.site_reference if self.site_reference\n (ops.elements[\"TransactionReference\"] || ops.add_element(\"TransactionReference\")).text = self.transaction_reference if self.transaction_reference\n order = REXML::XPath.first(@request_xml, \"//Operation\")\n (order.elements[\"OrderReference\"] || order.add_element(\"OrderReference\")).text = self.order_reference if self.order_reference\n root = @request_xml.root\n (root.elements[\"Certificate\"] || root.add_element(\"Certificate\")).text = self.site_alias if self.site_alias\n end",
"def initialize(model, request)\n @model = model\n @request = request\n end",
"def initialize(env)\n @env = env\n @request = ActionDispatch::Request.new(env)\n end",
"def initialize(*)\n super\n @json_rpc_call_id = 0\n @json_rpc_endpoint = URI.parse(currency.rpc)\n end",
"def get_request_obj(request_uri)\n\n req_obj = @request_class.new(request_uri)\n\n # Forward cookies\n req_obj['Cookie'] = @cookies.map { |k, v| \"#{k}=#{CGI.escape v.to_s}\" }.join('; ') if @cookies.present?\n\n # Forward headers\n @headers.each do |h, v|\n req_obj[h] = v\n end if @headers.present?\n\n # Attach basic auth\n if GlobalConstant::CompanyApi.basic_auth_user.present?\n req_obj.basic_auth(GlobalConstant::CompanyApi.basic_auth_user, GlobalConstant::CompanyApi.basic_auth_pass)\n end\n\n req_obj\n\n end",
"def create_request(method, path, body = {})\n KintoRequest.new self, method, path, body\n end",
"def initialize(params={})\n @zipcode = params[:zipcode]\n @radius = params[:radius]\n unless CareerBuilder.const_defined?(\"API_KEY\")\n raise ApiError, \"CareerBuilder::API_KEY not found\"\n end\n @http = Patron::Session.new\n @http.base_url = \"http://api.careerbuilder.com/v1\"\n reset_caches\n end",
"def initialize\n @url = 'http://api.preachingcentral.com/'\n end",
"def initialize(options)\n initialize_options(options)\n initialize_headers\n http_request\n end",
"def initialize(request, params)\n @request = request\n @params = params\n end",
"def initialize request\n @path = request.path.split('/').slice(1, 100) || []\n @original = @path.dup\n @request = request\n\n set_variables\n set_domain request\n set_format\n end",
"def initialize(&block)\n super(transport)\n\n @parameters = {}\n @query = {}\n @headers = Headers[HEADERS]\n @method = :get\n @asynchronous = true\n @binary = false\n @cacheable = true\n @opened = false\n @sent = false\n @completed = false\n @callbacks = Hash.new { |h, k| h[k] = [] }\n\n if block.arity == 0\n instance_exec(&block)\n else\n block.call(self)\n end if block\n end",
"def create_request(credentials)\n Request.new(credentials,@scheme,@host,@path,@query_elements)\n end",
"def initialize(headers = nil, cookies = nil) # Particular Ruby API version\n @headers = headers\n @cookies = cookies\n @settings = Settings.new\n @called_servers = []\n\tend",
"def initialize(args = {})\n config = AstroPay.configuration\n\n @x_login = config.card_x_login\n @x_trans_key = config.card_x_trans_key\n @sandbox = config.sandbox\n\n base_url = \"https://#{'sandbox-' if @sandbox}api.astropaycard.com/\"\n\n # AstroPay API version (default \"2.0\")\n @x_version = \"2.0\"\n # Field delimiter (default \"|\")\n @x_delim_char = \"|\"\n # Change to N for production\n @x_test_request = 'N'\n # Time window of a transaction with the sames values is taken as\n # duplicated (default 120)\n @x_duplicate_window = 30\n @x_method = \"CC\"\n # Response format:\n # \"string\", \"json\", \"xml\" (default: string; recommended: json)\n @x_response_format = \"json\"\n\n @additional_params = Hash.new\n\n super\n\n @validator_url = \"#{base_url}verif/validator\"\n @transtatus_url = \"#{base_url}verif/transtatus\"\n end",
"def initialize(options = {})\n @api_secret = options.fetch(:api_secret, ShippingEasy.api_secret)\n @method = options.fetch(:method, :get)\n @path = options.fetch(:path)\n @body = options.fetch(:body, nil)\n @params = options.fetch(:params, {})\n @api_signature = params.delete(:api_signature)\n @api_timestamp = params.fetch(:api_timestamp, nil).to_i\n @expected_signature = ShippingEasy::Signature.new(api_secret: @api_secret, method: @method, path: @path, params: @params, body: @body)\n end",
"def request\n @request ||= Request.new(::Minfraud::HTTPService.configuration)\n end",
"def http_request\n req = VanillaRequest.new @http_method, @uri.request_uri, @headers\n\n req.basic_auth @auth[:username], @auth[:password] if\n @auth && @auth[:username]\n\n req\n end",
"def initialize(current_user, request)\n @current_user, @request = current_user, request\n end",
"def initialize(request:, secret_key: nil, algorithm: nil, leeway: nil, key_store_id: nil)\n @request = request\n @secret_key = secret_key\n @algorithm = algorithm\n @leeway = leeway\n @key_store_id = key_store_id\n end",
"def initialize(method, path, body = nil)\n super\n @warn = false\n content_length = body ? body.bytesize.to_s : '0'\n @headers.update({\n 'x-ms-version' => '2014-06-01',\n 'Content-Type' => 'application/xml',\n 'Content-Length' => content_length\n })\n @uri = URI.parse(Azure.config.management_endpoint + Azure.config.subscription_id + path)\n @key = Azure.config.http_private_key\n @cert = Azure.config.http_certificate_key\n end",
"def build_request()\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n end",
"def initialize_braintree_obj\n @gateway = ::Braintree::Gateway.new(\n :environment => @environment,\n :merchant_id => @merchant_id,\n :public_key => @public_key,\n :private_key => @private_key\n )\n end",
"def initialize(options = {})\n\t\t# set some sensible defaults\n\t\t@url = 'https://secure.authorize.net/gateway/transact.dll'\n\t\t@delim_data = 'TRUE'\n\t\t@relay_response = 'FALSE'\n\t\t@version = API_VERSION\n\t\t\n\t\t# include all provided data\n\t\tsuper options\n\tend",
"def create_request\n super(@credentials)\n end",
"def initialize(apikey='f47a72ab00afe64aab78b9919ee3d427')\n\t\t@api_key = apikey\n\t\t@headers = {\"Accept\" => \"application/JSON\", \"user-key\" => @api_key}\n\t\t@base_uri = \"https://developers.zomato.com/api/v2.1/\"\n\tend",
"def initialize(params={})\n self.api_url = 'https://pay1.plugnpay.com/payment/pnpremote.cgi'\n # self.api_url = 'https://pay1.plugnpay.com/payment/inputtestapi.cgi'\n self.publisher_name = params['publisher-name'] if params['publisher-name']\n self.debug = params['debug'] if params['debug']\n end",
"def build_request(method)\n Request.create(method) do |req|\n req.params = self.params.dup\n req.headers = self.headers.dup\n req.options = self.options\n yield(req) if block_given?\n end\n end",
"def request_setup request_context\n http_method = case request_context[:method]\n when :get\n Net::HTTP::Get\n when :post\n Net::HTTP::Post\n when :put\n Net::HTTP::Put\n when :delete\n Net::HTTP::Delete\n else\n raise \"Only :get, :post and :delete http method types are allowed.\"\n end\n headers = request_context[:headers] || {}\n setup = http_method.new request_context[:uri].request_uri\n setup.initialize_http_header headers\n setup.basic_auth(request_context[:uri].user, request_context[:uri].password) if request_context[:uri].user && request_context[:uri].password\n setup\n end",
"def test_initialize\n request = OIDC::Request.new(@params)\n assert_equal @params[:response_type], request.response_type\n assert_equal @params[:client_id], request.client_id\n assert_equal @params[:redirect_uri], request.redirect_uri\n assert_equal @params[:scope], request.scope\n assert_equal @params[:state], request.state\n assert_equal @params[:nonce], request.nonce\n end",
"def init_request(opts)\n raise ArgumentError, \":uri is for backwards compatibilty and conflicts with :request\" \\\n if opts[:request] && opts[:uri]\n\n # For backwards compatibilty\n if opts[:uri]\n HTTP::Request.new(:uri => opts[:uri], :verb => :get)\n else\n opts.fetch(:request)\n end\n end",
"def initialize(request, response, body = nil)\n @request = request\n @response = response\n @body = body\n end",
"def initialize(*args)\n @body = nil\n @headers = {}\n @http_version = '1.1'\n\n super\n end",
"def initialize(username, password, https=true, log=false, requestlog=true)\n\n\t\t# need it for every request - will be merged in\n\t\tself.opts= { :param => { :login => username, :password => password}}\n\t\t\n\t\t# set savon logging and erros\n\t\tSavon.configure do |config|\n\t\t\tconfig.raise_errors = true # raise SOAP faults and HTTP errors\n\t\t\tconfig.log = log # enable/disable logging\n\t\t\tconfig.log_level = :debug # changing the log level\n\t\tend\n\t\t\n\t\tHTTPI.log=requestlog\n\t\t\n\t\t# build dynamically all methods - some magic :-)\n\t\tmake_methods\n\t\t\n\t\t# creates client with memotoo settings \n\t\tclient(https)\n\tend",
"def new\n #@request = Request.new\n end",
"def initialize(options = {})\n requires!(options, :merchant, :ip)\n @options = {:security => :ip_check, :language => 'en'}.merge(options)\n super\n end",
"def initialize(args = {})\n @args = args\n @args[:headers] ||= {}\n @body = args[:body] || \"\"\n @debug = args[:debug]\n @request = args.fetch(:request)\n end",
"def create_request\r\n request = @svc.createRequest(\"ReferenceDataRequest\")\r\n\r\n @identifiers.each {|identifier| request.append(\"securities\", identifier) }\r\n \r\n @options.each do |key, value|\r\n next if key == :fields or key == :overrides\r\n request.set(key.to_s, convert_value_to_bberg(value))\r\n end\r\n \r\n @options[:fields].each {|f| request.append(\"fields\", f) }\r\n \r\n overrides = request.getElement(\"overrides\")\r\n @options[:overrides].each do |field_id, value|\r\n new_override = overrides.appendElement()\r\n new_override.setElement(\"fieldId\", field_id.to_s)\r\n new_override.setElement(\"value\", convert_value_to_bberg(value))\r\n end\r\n @request = request\r\n end",
"def initialize(options)\n @pos_id = options[:pos_id].to_i\n @pos_auth_key = options[:pos_auth_key]\n @key1 = options[:key1]\n @key2 = options[:key2]\n @gateway_url = options[:gateway_url] || 'www.platnosci.pl'\n @variant = options[:variant] || 'default'\n @encoding = options[:encoding] || 'UTF'\n @test_payment = options.fetch(:test_payment, false)\n @add_signature = options.fetch(:add_signature, true)\n\n validate_options!\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n\n @options = {\n :pem => pem_file,\n :signature => signature\n }.update(options)\n\n if @options[:pem].blank? && @options[:signature].blank?\n raise ArgumentError, \"An API Certificate or API Signature is required to make requests to PayPal\"\n end\n\n super\n end",
"def initialize(api_key, api_url = 'https://api.telerivet.com/v1')\n @api_key = api_key\n @api_url = api_url\n @num_requests = 0\n @session = nil\n end",
"def new\n @request = Request.new\n respond_with(@request)\n end",
"def initialize(request, data={}) #:nodoc:\n @request, @data = request, data\n @code, @message = data[:code] || FX_OK, data[:message]\n end",
"def request_setup()\n Proc.new do |request|\n request.headers[:authorization] = basic_auth_header\n request.headers[:content_type] = 'application/json; charset=UTF-8'\n request.headers[:accept] = 'application/json; charset=UTF-8'\n end\n end",
"def initialize(config)\n self.zconfig = Zapi::Zconfig.new(config)\n\t\t\t savon_setup\n $session = self\t\n\t\t end",
"def initialize\n ext_initialize\n @headers = {}\n @timeout = 5\n @connect_timeout = 1\n @max_redirects = 5\n @auth_type = :basic\n end",
"def initialize(username, password, sandbox = false, modern_endpoint = false)\n @modern_endpoint = modern_endpoint\n base_url = api_url sandbox\n conn = connection base_url\n\n response = conn.post do |req|\n set_auth_request_headers! req, username, password\n end\n\n case response.status\n when 200\n @auth_cookie = response.headers['set-cookie'].split(' ')[0]\n @connection = conn\n when 429\n sleep(Zuora::RETRY_WAITING_PERIOD)\n return initialize(username, password, sandbox, modern_endpoint)\n else\n raise Zuora::Rest::ConnectionError, response.body['reasons']\n end\n end",
"def initialize(raw_response, req, ignore_signature_check = false)\n @raw_response, @request = raw_response, req\n parse ignore_signature_check\n end",
"def initialize(key, proxy = nil)\n\n ##\n # Setting initial options for the request\n\n @options = {\n user: key,\n password: \"\",\n method: :post,\n url: \"#{API_URL}/#{@type}\",\n ssl_ca_file: File.dirname(__FILE__) + '/../data/cacert.pem'\n }\n\n @proxy = proxy\n\n ##\n # Request data, which will be sent do API server\n\n @data = {}\n end",
"def initialize(method, path, body = {}, params = {}, header = {})\n @method = method\n @path = path\n @body = body\n @params = params\n @session_token = ModelApi::Requester.session_token\n setup_header(header)\n run\n valid?\n end",
"def initialize_instance\n super\n userHandle.value = get_parameter(:handle)\n request.pduHead.frag_length = self.num_bytes\n request.opnum.value = 47 \t\t#SamrQueryInformationUser2\n end",
"def construct_request(method, url, requestor, opts={})\n user_headers = opts[:headers] || {}\n version = opts[:server_api_version]\n payload_raw = opts[:payload] || \"\"\n\n payload = if payload_raw.class == Hash\n to_json(payload_raw)\n else\n payload_raw\n end\n\n # Provide a means to explicitly delete version header for test purposes\n version_headers = if opts.has_key?(:api_version)\n version = opts[:api_version]\n if version.nil?\n {}\n else\n {\"X-Ops-Server-API-Version\" => version}\n end\n else\n {\"X-Ops-Server-API-Version\" => server_api_version}\n end\n\n auth_headers = opts[:auth_headers] || requestor.signing_headers(method, url, payload)\n\n uri = URI.parse(url)\n\n # for further details, see: get_host_port in oc-chef-pedant/lib/pedant/utility.rb\n host = \"#{uri.host}:#{uri.port}\"\n\n final_headers = standard_headers.\n merge(auth_headers).\n merge(user_headers).\n merge(version_headers).\n merge({'Host' => host, 'X-REMOTE-REQUEST-ID' => UUIDTools::UUID.random_create.to_s})\n\n [final_headers, payload]\n end",
"def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end",
"def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end",
"def initialize(cert, host, client_name = '', service_name = 'AnyMote')\n @pair = PairingRequest.new\n @cert = cert\n @host = host\n @pair.client_name = client_name\n @pair.service_name = service_name\n end",
"def create_new_http_request\n # Create a new HTTP request instance\n request_spec = @data[:request][:instance]\n http_class = \"Net::HTTP::#{request_spec.verb._camelize}\"\n http_request = http_class._constantize::new(request_spec.path)\n # Set the request body\n if request_spec.is_io?\n http_request.body_stream = request_spec.body\n else\n http_request.body = request_spec.body\n end\n # Copy headers\n request_spec.headers.each { |header, value| http_request[header] = value }\n # Save the new request\n request_spec.raw = http_request\n # Set user-agent\n if @data[:options].has_key?(:connection_user_agent)\n http_request['user-agent'] ||= @data[:options][:connection_user_agent]\n end\n http_request\n end",
"def initialize\n @sandbox = true\n @enable_ssl = true\n end",
"def initialize(address)\n @requests = [HTTY::Request.new(address)]\n end",
"def initialize(env)\n @request = Zero::Request.new(env)\n @response = Zero::Response.new\n @renderer = self.class.renderer\n end",
"def post_init\n @request = Request.new\n @response = Response.new\n end",
"def initialize(options)\n raise ArgumentError, 'an options Hash is required' if !options.instance_of?(Hash)\n raise ArgumentError, ':username required' if options[:username].nil?\n raise ArgumentError, ':password required' if options[:password].nil?\n \n self.class.debug_output $stdout if options[:debug]\n self.class.base_uri options[:base_uri] || SMSIFIED_ONEAPI_PUBLIC_URI\n @auth = { :username => options[:username], :password => options[:password] }\n \n @destination_address = options[:destination_address]\n @sender_address = options[:sender_address]\n end",
"def initialize(options)\n raise ArgumentError, 'an options Hash is required' if !options.instance_of?(Hash)\n raise ArgumentError, ':username required' if options[:username].nil?\n raise ArgumentError, ':password required' if options[:password].nil?\n \n self.class.debug_output $stdout if options[:debug]\n self.class.base_uri options[:base_uri] || SMSIFIED_ONEAPI_PUBLIC_URI\n @auth = { :username => options[:username], :password => options[:password] }\n \n @destination_address = options[:destination_address]\n @sender_address = options[:sender_address]\n end",
"def initialize(username, password, auth_key) \n @username = username\n @password = password\n \n @uri = URI.parse(@@fonolo_uri)\n @headers = { \"Content-Type\" => \"application/json\",\n \"X-Fonolo-Auth\" => auth_key,\n \"X-Fonolo-Username\" => username, \n \"X-Fonolo-Password\" => password }\n \n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n end",
"def initialize(uri_string, options = {})\n @options = options.clone\n setup_uri_state!(uri_string)\n setup_request_config!\n end",
"def initialize(request)\n @logger = ::Logger.new(STDOUT)\n @logger.level = Logger::DEBUG\n @request = request\n create_headers\n create_body\n end",
"def initialize(_request, _output)\n super\n @env = request.env\n @input = request.input\n end",
"def initialize(request_info)\n @action = request_info[:action]\n @path = request_info[:path]\n @metadata = request_info[:metadata]\n @params = request_info[:params]\n @request = request_info[:request]\n\n # publishing actions\n @users_to_notify = []\n\n @response = nil\n end",
"def initialize(request, **_options)\n @request = request\n @params = request.query_parameters\n end",
"def initialize(authentication = nil)\n if authentication.nil? || authentication.is_a?(String)\n config_file = authentication.nil? ? 'config/has_offers.yml' : authentication\n @authentication = YAML::load(IO.read(config_file)) if File.exists?(config_file)\n elsif authentication.is_a?(Hash)\n @authentication = authentication\n end\n @default_params = { 'Format' => 'json',\n 'Service' => 'HasOffers',\n 'Version' => '2',\n 'NetworkId' => @authentication['network_id'],\n 'NetworkToken' => @authentication['api_key'] }\n self.debug_mode = false\n self.test_mode = false\n end",
"def request_signer\n @_request_signer ||= RequestSigner.new(self.crypto)\n end",
"def initialize(url = nil, options = nil)\n options = ConnectionOptions.from(options)\n\n if url.is_a?(Hash) || url.is_a?(ConnectionOptions)\n options = options.merge(url)\n url = options.url\n end\n\n @parallel_manager = nil\n @headers = Utils::Headers.new\n @params = Utils::ParamsHash.new\n @options = options.request\n @ssl = options.ssl\n @default_parallel_manager = options.parallel_manager\n\n @builder = options.builder || begin\n # pass an empty block to Builder so it doesn't assume default middleware\n options.new_builder(block_given? ? Proc.new { |b| } : nil)\n end\n\n self.url_prefix = url || 'http:/'\n\n @params.update(options.params) if options.params\n @headers.update(options.headers) if options.headers\n\n @manual_proxy = !!options.proxy\n @proxy = options.proxy ? ProxyOptions.from(options.proxy) : proxy_from_env(url)\n @temp_proxy = @proxy\n\n yield(self) if block_given?\n\n @headers[:user_agent] ||= \"Faraday v#{VERSION}\"\n end",
"def initialize(args = {})\n config = AstroPay.configuration\n\n @x_login = config.direct_x_login\n @x_trans_key = config.direct_x_trans_key\n @x_login_for_webpaystatus = config.direct_x_login_for_webpaystatus\n @x_trans_key_for_webpaystatus = config.direct_x_trans_key_for_webpaystatus\n @secret_key = config.direct_secret_key\n @sandbox = config.sandbox\n @response_type = 'json'\n\n super\n\n subdomain = 'sandbox.' if @sandbox\n\n @astro_urls = {\n \"create\" => \"https://#{subdomain}astropaycard.com/api_curl/apd/create\",\n \"status\" => \"https://#{subdomain}astropaycard.com/apd/webpaystatus\",\n \"exchange\" => \"https://#{subdomain}astropaycard.com/apd/webcurrencyexchange\",\n \"banks\" => \"https://#{subdomain}astropaycard.com/api_curl/apd/get_banks_by_country\"\n }\n end",
"def initialize\n @app_name = \"FPS\"\n @http_method = \"GET\"\n @service_end_point = Rails.application.config.amazon_fps_endpoint\n @version = \"2008-09-17\"\n\n @access_key = Rails.application.config.aws_access_key\n @secret_key = Rails.application.config.aws_secret_key\n @params = get_default_parameters()\n end",
"def build_request\n b = builder\n xml = b.SignatureProofOfDeliveryRequest(:xmlns => \"http://fedex.com/ws/track/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"trck\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n \n b.Type image_type\n b.TrackingNumber tracking_number\n b.FaxDetail fax_number if fax_number\n b.LetterFormat image_file_type\n end\n end",
"def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end",
"def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end",
"def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end",
"def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end",
"def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end",
"def initialize(url = nil, options = {})\n if url.is_a?(Hash)\n options = url\n url = options[:url]\n end\n @headers = Headers.new\n @params = {}\n @options = options[:request] || {}\n @ssl = options[:ssl] || {}\n @parallel_manager = options[:parallel]\n self.url_prefix = url if url\n proxy(options[:proxy])\n merge_params @params, options[:params] if options[:params]\n merge_headers @headers, options[:headers] if options[:headers]\n\n if block_given?\n @builder = Builder.create { |b| yield b }\n else\n @builder = options[:builder] || Builder.new\n end\n end"
] |
[
"0.65169096",
"0.6432653",
"0.6423272",
"0.6330767",
"0.625545",
"0.6215072",
"0.620527",
"0.6179301",
"0.6094011",
"0.6089483",
"0.60330904",
"0.5964824",
"0.5963675",
"0.59556985",
"0.59450173",
"0.5943401",
"0.59270114",
"0.59189355",
"0.590537",
"0.58905476",
"0.58703446",
"0.5863345",
"0.58599705",
"0.5854012",
"0.5846613",
"0.58447075",
"0.58281195",
"0.58280265",
"0.58098537",
"0.5808837",
"0.5807593",
"0.5801406",
"0.5801159",
"0.5745601",
"0.5744793",
"0.57425016",
"0.57403386",
"0.5738597",
"0.57339954",
"0.57333905",
"0.57250786",
"0.5719893",
"0.57187295",
"0.571792",
"0.5704961",
"0.570009",
"0.5670682",
"0.56697005",
"0.5656115",
"0.565107",
"0.56357205",
"0.5633056",
"0.5629022",
"0.56264526",
"0.5624211",
"0.5623708",
"0.5623106",
"0.5616698",
"0.5613665",
"0.56128025",
"0.5593759",
"0.5590686",
"0.5583978",
"0.55824757",
"0.55694884",
"0.5569294",
"0.55665123",
"0.5563151",
"0.55619097",
"0.5554952",
"0.55479074",
"0.55412924",
"0.55393976",
"0.5537489",
"0.5537489",
"0.5533184",
"0.5530463",
"0.55299824",
"0.55278534",
"0.55211085",
"0.55164206",
"0.5514319",
"0.5514319",
"0.55138695",
"0.55103683",
"0.55102706",
"0.550292",
"0.549978",
"0.5492985",
"0.54909015",
"0.5477677",
"0.5475609",
"0.54680455",
"0.5464743",
"0.5460188",
"0.5459683",
"0.5459683",
"0.5459683",
"0.5459683",
"0.5459683",
"0.54542124"
] |
0.0
|
-1
|
Initializes a new response.
|
def initialize(status_code)
@status_code = status_code.to_s
raise ArgumentError unless ALL.include?(@status_code)
@version = VERSION
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n @headers = response.headers\n @status = response.status\n @body = response.body || ''\n end",
"def initialize(responses)\n parse_response responses\n end",
"def initialize(response, path, options = {})\n\n # puts \"Init NG:Response , original response : #{response}\"\n # headers\n # @fields = response.get_fields\n # @header = response.to_hash\n @response = response\n puts @response\n puts \"\"\n\n #status\n @code = response.code\n puts @code\n puts \"\"\n # @message = response.message\n @response_name = response.class.name\n\n # @cookie = response.get_fields('set-cookie')\n\n #body\n if( response.body[0] != '{' && response.body[0] != '[')\n #puts \"no wrapper\"\n @body = response.body\n\n else\n # puts \"wrapper : #{response.body[0]}\"\n @body = JSON.parse(response.body)\n end\n\n @path = path\n end",
"def initialize(response, envelope = [])\n @response = response\n @envelope = envelope\n end",
"def initialize response, xml_options = {}\n super(response, xml_options)\n end",
"def initialize(response, request)\n @response = response\n @request = request\n end",
"def initialize(response)\n response.error = self\n @response = response\n\n message = []\n\n if response.parsed.is_a?(Hash)\n @code = response.parsed['error']\n @description = response.parsed['error_description']\n message << \"#{@code}: #{@description}\"\n end\n\n message << response.body.force_encoding(\"UTF-8\")\n\n super(message.join(\"\\n\"))\n end",
"def initialize(response)\n raise ArgumentError, \"Response doesnot exist\" if ((response.nil? || response.empty?) && response.code.nil? && response.code.empty?)\n @_response = response\n @_statusCode = response.code\n @_responseBody = response.body\n end",
"def initialize(response)\n @response = response\n\n if outcome\n @code = outcome[:reason_code]\n message = outcome[:reason_message]\n else\n message = \"the server responded with status #{response[:status]}\"\n end\n\n super(message)\n end",
"def initialize(response)\n @status = response.code.to_i\n @headers = response.each_header { |_, _| }\n @body = extract_body(response.body, *headers[Futile::Headers::CONTENT_ENCODING])\n @status = response.code.to_i\n end",
"def initialize(msg, response = nil)\n @response = response\n msg += \" => #{response.body}\" if response&.body\n super(msg)\n end",
"def initialize(response)\n self.savon = response\n self.body = response.body\n self.http_code = response.http.code\n # TODO: handle errors here\n end",
"def initialize(response, to_s_sym=nil)\n\t\t\tresponse = response.body if Net::HTTPResponse === response\n\t\t\t@body = response\n\t\t\t@to_s_sym = to_s_sym\n\t\tend",
"def initialize(http_response, result_format = :mashie)\n @result_format = result_format\n @headers = parse_headers(http_response.to_hash)\n @body = parse_body(http_response.body)\n end",
"def create_response(request)\n response = Response.new\n end",
"def initialize(request, response)\n @request = request\n @response = response\n end",
"def initialize\n @headers = HeaderHash.new\n @trace = []\n self.code = 200\n self.redirect = false\n end",
"def initialize(request_id)\n super request_id, SERVERDATA_RESPONSE_VALUE, nil\n end",
"def initialize(request_id)\n super request_id, SERVERDATA_RESPONSE_VALUE, nil\n end",
"def initialize\n\n response = list\n end",
"def initialize(response)\n @data = response[:data]\n @status = response[:status]\n super ApduError.message_for_apdu_response(response)\n end",
"def initialize(response, status)\n @response = response\n @status = status\n end",
"def post_init\n @request = Request.new\n @response = Response.new\n end",
"def initialize(http_response, request)\n @http_response = http_response\n @request = request\n end",
"def initialize(msg, api_response = nil)\n super(msg)\n\n # Automatically use included response object if possible\n @api_response = api_response.respond_to?(:response) ? api_response.response : api_response\n\n # Parse response and set instance vars\n parse_response unless @api_response.nil?\n end",
"def initialize(http_response)\n @http_response = http_response\n @uri = http_response.uri\n @status_code = http_response.status_code\n parse_response\n # Use reason phrase as the description if description is empty\n @description = http_response.reason_phrase if (@description.nil? || @description.empty?) && http_response.reason_phrase\n super(\"#{type} (#{status_code}): #{description}\")\n end",
"def initialize(response, url, query_params = {})\n @response_status = response.status\n @response_body = response.body\n @response_headers = response.headers\n message = \"Status code #{response.status} on resource #{url}\"\n message += \" with params: #{query_params.inspect}\" if query_params.present?\n super(message)\n end",
"def initialize(response)\n @document = response.to_hash\n end",
"def initialize(response_data = nil, error = nil)\n if response_data.class.to_s == \"Nokogiri::XML::Document\"\n @xml_data = response_data\n elsif response_data.class.to_s == \"Hash\"\n @json_data = response_data\n prepare_data(response_data)\n\n\n else\n @error = error\n end\n\n end",
"def init_from_response_body!\n return unless self.response_body\n self.objects. init_from_hal(self.response_body);\n self.links. init_from_hal(self.response_body);\n self.attributes.init_from_hal(self.response_body);\n self.loaded = true\n self\n end",
"def net_http_init(net_http_response)\n\n @original = net_http_response\n @status = net_http_response.code.to_i\n @body = net_http_response.body\n @headers = {}\n net_http_response.each { |k, v|\n @headers[k.split('-').collect { |s| s.capitalize }.join('-')] = v\n }\n end",
"def initialize\n @headers = {}\n @trace = []\n self.code = 200\n self.redirect = false \n end",
"def initialize_connection\n self.send(Response.new(action: 'init'))\n end",
"def initialize(http_resp)\n @content = http_resp.body\n @data = JSON.parse(http_resp.body, symbolize_names: true)\n @status_code = http_resp.code.to_i\n end",
"def initialize(command_response)\n super RCON_GOLDSRC_RESPONSE_HEADER, command_response\n end",
"def initialize( request )\n @request = request\n @response = Rack::Response.new\n end",
"def initialize(raw_response, req, ignore_signature_check = false)\n @raw_response, @request = raw_response, req\n parse ignore_signature_check\n end",
"def initialize(response, connection)\n @location = response.header[\"location\"]\n @status_code = response.code\n @status_message = response.message\n \n if response.body\n \n #If a receipt was returned, parse it\n begin\n #ensure that there are not parse errors. If there are, warn, rather then raise\n @entry = ::Atom::Entry.parse(response.body) \n @has_entry = true\n @entry.http = connection\n rescue Exception => message\n @has_entry = false\n $stderr.puts \"ERROR: An error occured processing the Response XML: #{message}\"\n rescue StandardError => error\n @has_entry = false\n $stderr.puts \"WARN: The deposit was successful, but there was an issue with Response XML. It could be missing. (#{error})\"\n end\n \n else\n #if the receipt was not returned, try and retrieve it\n if @location\n @entry = ::Atom::Entry.parse(connection.get(@location).body)\n @has_entry = true\n else\n #Otherwise, there is no receipt (e.g. for a delete)\n @has_entry = false\n @entry = nil\n end\n end\n end",
"def initialize(response)\n response = JSON.parse(response) if response.is_a?(String)\n @response = response.with_indifferent_access\n @itineraries = extract_itineraries\n end",
"def initialize(response)\n self.response_dup = response\n if response.body.is_a?(Hash) and !response.body[PARAM_PAGE].nil?\n self.first = path_for_page(FIRST_PAGE_NUMBER)\n self.next = response.body[META_NEXT] unless response.body\n self.prev = response.body[META_PREV]\n end\n end",
"def initialize success, body\n @success = success || false\n @body = body.fetch('RESPONSE', {})\n end",
"def initialize(attributes, response, token) # :nodoc:\n Helpers.load_variables(self, ATTRIBUTES, attributes)\n\n @last_response = response\n @application_token = token\n end",
"def initialize(reason, response_code, response_body)\r\n super(reason)\r\n @response_code = response_code\r\n @response_body = response_body\r\n end",
"def initialize(response)\n handle_errors(response)\n\n JSON.parse(response.body).each do |key, value|\n if key == 'decks'\n # Keep the API response count, it will differ when invalid decks are stripped\n @decks_count = value.size\n\n instance_variable_set(\n \"@#{key}\".to_sym, value.map { |deck| ZombieBattleground::Api::Models::Deck.new(deck) }\n )\n else\n instance_variable_set(\"@#{key}\".to_sym, value)\n end\n end\n end",
"def initialize(response)\n @data = JSON.parse(response)\n end",
"def response(arguments = {})\n Response.new(self, arguments)\n end",
"def initialize(req, res, route_params = {})\n @request, @response = req, res\n @params = Params.new(@request, route_params)\n @already_built_response = false\n end",
"def initialize(response)\n if response && response.results && !response.results.empty?\n @documents = response.results.map do |document|\n PrismicRails::Document.new(document)\n end\n else #Handles the case if the response is nil or empty\n nil_document = PrismicRails::NilDocument.new\n @documents = [nil_document]\n end\n end",
"def initialize(response)\n super\n # XXX assign to :signal\n end",
"def initialize(object, response = nil)\n @object = object\n\n @authorisation_source = object['authorisation_source']\n @consent_parameters = object['consent_parameters']\n @created_at = object['created_at']\n @id = object['id']\n @links = object['links']\n @metadata = object['metadata']\n @next_possible_charge_date = object['next_possible_charge_date']\n @payments_require_approval = object['payments_require_approval']\n @reference = object['reference']\n @scheme = object['scheme']\n @status = object['status']\n @verified_at = object['verified_at']\n @response = response\n end",
"def initialize(object, response = nil)\n @object = object\n\n @confirmation_url = object['confirmation_url']\n @created_at = object['created_at']\n @description = object['description']\n @id = object['id']\n @links = object['links']\n @mandate_reference = object['mandate_reference']\n @metadata = object['metadata']\n @redirect_url = object['redirect_url']\n @scheme = object['scheme']\n @session_token = object['session_token']\n @success_redirect_url = object['success_redirect_url']\n @response = response\n end",
"def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend",
"def initialize(response, timezone)\n raise ArgumentError, 'timezone can not be nil' if timezone.nil?\n raise ArgumentError, 'response can not be nil' if response.nil?\n\n @response = response\n @timezone = timezone\n end",
"def initialize(text)\n @headers = {}\n @http_version = ''\n @status = -1\n @response_text = ''\n \n parse text\n end",
"def set_from_response_data(hash)\n self.response_data = hash\n self.initialize_from_response_data\n self\n end",
"def initialize(method, path, response)\n @method = method\n @path = path\n @code = response.code\n @body = response.body.to_s\n @body = @body.empty? ? \"<none>\" : \"#{response.body}\"\n message = \"Unexpected server response:\\n Method: #{@method}\\n Path: \"\\\n \"#{@path}\\n Code: #{@code}\\n Body: #{@body}\"\n super message\n end",
"def initialize(request_id)\n super request_id, SERVERDATA_AUTH_RESPONSE, ''\n end",
"def initialize(params = {})\n @response = {\n has_errors: false,\n errors: []\n }\n @injected_params = params\n end",
"def setup\n @response ||= {}\n end",
"def initialize(response)\n return super unless response\n \n super(response['data'])\n paging = response['paging'] || {}\n self.next_url = paging['next']\n self.previous_url = paging['previous']\n end",
"def initialize(response)\n handle_errors(response)\n\n @deck = ZombieBattleground::Api::Models::Deck.new(JSON.parse(response.body))\n end",
"def initialize(request, response, body = nil)\n @request = request\n @response = response\n @body = body\n end",
"def initialize(http_response, http_response_code, http_raw_response)\n @http_status_code = http_response_code\n @http_raw_response = http_raw_response\n\n # only set these variables if a message-body is expected.\n if not @http_raw_response.kind_of? Net::HTTPNoContent\n @body = MultiJson.load(http_response) unless http_response.nil?\n @request = MultiJson.load(@body[\"request\"].to_s) if @body[\"request\"]\n @api_status = @body[\"status\"].to_i if @body[\"status\"]\n @api_error_message = @body[\"error_message\"].to_s if @body[\"error_message\"]\n end\n end",
"def response code, desc, media_type = nil, hash = { }\n (self[:responses] ||= { })[code] = ResponseObj.new(desc, media_type, hash)\n end",
"def initialize(attributes = {})\n @response_xml = attributes[:xml]\n @response_code = attributes[:response_code]\n @reason_code = attributes[:reason_code]\n @message = attributes[:message]\n end",
"def initialize(resp)\n @response = resp\n @parsed = -> { MultiJson.load(body) rescue body }.call\n end",
"def initialize(object, response = nil)\n @object = object\n\n @created_at = object['created_at']\n @id = object['id']\n @scheme = object['scheme']\n @status = object['status']\n @response = response\n end",
"def initialize(res = {})\n @http_status = 0\n @count = 0\n @batch_response = false # by default, not a batch response\n @result = nil\n # If a string is used for initializing, treat it as JSON\n # check for string to not be 'OK' since that is the health check API response\n res = JSON.parse(res) if res.is_a?(String) && res != \"OK\".freeze\n # If it is a hash (or parsed JSON), then parse the result.\n parse_result!(res) if res.is_a?(Hash)\n # if the result is an Array, then most likely it is a set of responses\n # from using a Batch API.\n if res.is_a?(Array)\n @batch_response = true\n @result = res || []\n @count = @result.count\n end\n #if none match, set pure result\n @result = res if @result.nil?\n end",
"def initialize(object, response = nil)\n @object = object\n\n @amount = object['amount']\n @count = object['count']\n @created_at = object['created_at']\n @currency = object['currency']\n @day_of_month = object['day_of_month']\n @end_date = object['end_date']\n @id = object['id']\n @interval = object['interval']\n @interval_unit = object['interval_unit']\n @links = object['links']\n @metadata = object['metadata']\n @month = object['month']\n @name = object['name']\n @payment_reference = object['payment_reference']\n @start_date = object['start_date']\n @status = object['status']\n @upcoming_payments = object['upcoming_payments']\n @response = response\n end",
"def initialize(object, response = nil)\n @object = object\n\n @actions = object['actions']\n @created_at = object['created_at']\n @fallback_enabled = object['fallback_enabled']\n @id = object['id']\n @links = object['links']\n @mandate_request = object['mandate_request']\n @metadata = object['metadata']\n @payment_request = object['payment_request']\n @purpose_code = object['purpose_code']\n @resources = object['resources']\n @status = object['status']\n @response = response\n end",
"def initialize(request:, response: nil)\n @request = request\n @response = response\n end",
"def initialize(faraday_response)\n @response = faraday_response\n end",
"def initialize(env)\n @request = Zero::Request.new(env)\n @response = Zero::Response.new\n @renderer = self.class.renderer\n end",
"def initialize(object, response = nil)\n @object = object\n\n @active = object['active']\n @block_type = object['block_type']\n @created_at = object['created_at']\n @id = object['id']\n @reason_description = object['reason_description']\n @reason_type = object['reason_type']\n @resource_reference = object['resource_reference']\n @updated_at = object['updated_at']\n @response = response\n end",
"def initialize(xml_data = nil, code = nil, error_message = nil)\n @response_attributes = Hash.new;\n @params = Hash.new;\n @tables = Hash.new;\n\n if(!code.nil? && !error_message.nil?)\n @response_attributes['Code'] = code;\n @response_attributes['ErrorMessage'] = error_message;\n @response_attributes['FullError'] = error_message;\n end\n\n if(!xml_data.nil?)\n parser = XML::SaxParser.string(xml_data);\n parser.callbacks = CallBacks.new(self);\n parser.parse;\n end\n end",
"def initialize(error_reply)\n\t\t\tsuper(error_reply.value)\n\t\t\t@status_code = error_reply.status_code\n\t\tend",
"def initialize(attributes = {})\n requires!(attributes, :xml, :code, :message)\n \n @response_xml = attributes[:xml]\n @response_code = attributes[:code]\n @message = attributes[:message]\n end",
"def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def initialize(headers, errors, status_code)\n @headers = headers\n\n if errors.is_a?(Array) || !errors\n @errors = (errors || []).map do |error|\n OpenStruct.new(error['error'])\n end\n else\n @errors = [OpenStruct.new(message: 'The API returned an unexpected '\\\n 'response. This is likely due to an incorrectly defined base URL.')]\n end\n\n @status_code = status_code\n end",
"def initialize(response)\n @collection = response[:data]\n @total = response[:total]\n @current_page = response[:current_page]\n end",
"def initialize(code, object = nil, status = nil, aditional_data = nil, data_root = :message)\n aditional_data = {} unless aditional_data\n response = {\n :status => status || \"success\",\n :code => code,\n :message => Response::message(code)\n }.merge(aditional_data)\n\n if object\n @_object = object\n response[:data] = {data_root => @_object}\n end\n\n @object = OpenStruct.new(response)\n end",
"def initialize(object, response = nil)\n @object = object\n\n @created_at = object['created_at']\n @links = object['links']\n @record_identifier = object['record_identifier']\n @response = response\n end",
"def initialize(object, response = nil)\n @object = object\n\n @action = object['action']\n @created_at = object['created_at']\n @details = object['details']\n @id = object['id']\n @links = object['links']\n @metadata = object['metadata']\n @resource_type = object['resource_type']\n @response = response\n end",
"def initialize(httparty)\n @data = httparty.parsed_response\n @http = httparty.response\n end",
"def from_response(response)\n\n payload = response.body\n @error = payload['error']\n @error_code = payload['error_code']\n @details = payload['details']\n @response = response\n\n logger.error(\"Request failed with status #{response.code.to_s}: '#{@error_code} #{@error}': #{response.body}\")\n\n self\n end",
"def initialize(object, response = nil)\n @object = object\n\n @end_date = object['end_date']\n @id = object['id']\n @jurisdiction = object['jurisdiction']\n @percentage = object['percentage']\n @start_date = object['start_date']\n @type = object['type']\n @response = response\n end",
"def intitiate_response_object \n response_object = Hash.new\n response_object[:status] = \"failure\"\n response_object[:statusCode] = 500\n response_object[:response] = \"\"\n response_object[:message] = \"The server encountered an unexpected condition which prevented it from fulfilling the request\"\n return response_object\n end",
"def initialize(xml)\n #puts \"________________________________________\"\n #puts xml\n #puts \"________________________________________\"\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def init_response\n headers = SSE_HEADER.merge @headers\n @parser.headers stringify_headers(headers)\n rescue ::HTTP2::Error::StreamClosed\n @stream.log :warn, \"stream closed early by client\"\n end",
"def initialize\n @isRequest = nil\t# true, false and nil\n @httpVersion = 'HTTP/1.1'\n @bodyType = nil\n @bodyCharset = nil\n @bodySize = nil\n @bodyDate = nil\n @headerItem = []\n @chunked = false\n @responseStatusCode = nil\n @reasonPhrase = nil\n @requestMethod = nil\n @requestUri = nil\n @requestQueryUri = nil\n @requestViaProxy = false\n end",
"def response=(response); @response = response end",
"def build_object\n response = make_request\n body = JSON.load(response.body) if response.body \n body = { response: body } if body.is_a? Array\n hash = body.to_snake_keys if body\n response_object = Hashie::Mash.new(hash)\n response_object.status_code = response.code.to_i unless response_object.status_code\n response_object\n end",
"def empty_response\n rates = Rates.new([], [], [])\n ParsedEntries.new(\"\", \"\", \"\", \"\", [], rates, [])\n end",
"def initialize\n @request = VarnishLog::Request.new\n @response = VarnishLog::Response.new\n end",
"def initialize(http_response, collection)\n super\n\n pagination = http_response[\"pagination\"]\n @page = pagination[\"current_page\"]\n @per_page = pagination[\"per_page\"]\n @total_entries = pagination[\"total_entries\"]\n @total_pages = pagination[\"total_pages\"]\n end"
] |
[
"0.79767466",
"0.7945351",
"0.7945351",
"0.7945351",
"0.7945351",
"0.78197616",
"0.75888395",
"0.7543758",
"0.75101167",
"0.7480676",
"0.7475213",
"0.7427679",
"0.74167264",
"0.7406836",
"0.72920525",
"0.7213491",
"0.7206326",
"0.7163924",
"0.7102348",
"0.70998394",
"0.7090481",
"0.7082447",
"0.7079264",
"0.70561177",
"0.7053629",
"0.70511514",
"0.7042339",
"0.7002283",
"0.69847035",
"0.6981682",
"0.69765294",
"0.6943824",
"0.69430035",
"0.6934718",
"0.6923614",
"0.6900075",
"0.6890218",
"0.6861108",
"0.6860897",
"0.68449163",
"0.68407625",
"0.68371856",
"0.6835441",
"0.6824798",
"0.6793066",
"0.6779359",
"0.6777292",
"0.67729527",
"0.6769578",
"0.67577577",
"0.6752839",
"0.67431927",
"0.6728631",
"0.6700717",
"0.66901934",
"0.66803586",
"0.66784096",
"0.6676435",
"0.6670404",
"0.6667318",
"0.66577256",
"0.66457915",
"0.663601",
"0.66262436",
"0.6610876",
"0.6604185",
"0.660381",
"0.6599915",
"0.65973526",
"0.6591254",
"0.65909827",
"0.6590794",
"0.6575974",
"0.6562333",
"0.65573496",
"0.65439117",
"0.6523239",
"0.6515604",
"0.6515279",
"0.6508887",
"0.6500226",
"0.6493141",
"0.6491642",
"0.6491642",
"0.64873195",
"0.6478799",
"0.64693356",
"0.64647675",
"0.64620733",
"0.64567715",
"0.6447384",
"0.6444863",
"0.64336246",
"0.6422347",
"0.6420367",
"0.6414039",
"0.641064",
"0.6406703",
"0.6387298",
"0.6384434",
"0.63828117"
] |
0.0
|
-1
|
Returns the user ID, if authentication was successful.
|
def user_id
return nil unless success?
@user_id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def auth_user_id\n session[:current_user_id] unless session[:current_user_id].nil?\n end",
"def auth_user_id\n auth[:user_id]\n end",
"def get_authenticated_user # rubocop:disable Style/AccessorMethodName\n @user_id = YourMembership::Member.isAuthenticated(self)\n end",
"def user_id\n payload = authenticate!(via: :jwt)\n return payload[\"user\"]\n end",
"def hubssolib_get_user_id\n user = self.hubssolib_current_user\n user ? user.user_id : nil\n end",
"def auth_user\n User.find(auth_user_id) unless auth_user_id.nil?\n end",
"def authentication_successful?\n @user.present?\n end",
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def user_id\n unless @user_id.nil? || @user_id == 0\n @user_id\n else\n read_attribute(:user_id) # TODO: Might need to cache result\n end\n end",
"def getUserID\n if signed_in? \n if params[:id].empty?\n uid = current_user.id\n else\n uid = params[:id]\n end\n @user = User.find(uid)\n else\n redirect_to pages_home_path\n end\n end",
"def current_user_id\n if request.headers && request.headers['Authorization']\n token = request.headers['Authorization'].split(' ')[1] #[Bearer <token>]\n begin\n decoded_token = JWT.decode(token, 'this should be in .env', true, algorithm: 'HS256')\n if decoded_token\n user_id = decoded_token[0]['user_id'] #[{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n end\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def current_user\n return unless session[:token]\n\n crypt = ActiveSupport::MessageEncryptor.new(Rails.application.credentials.secret_key_base.byteslice(0..31))\n token = crypt.decrypt_and_verify session[:token]\n user_id = token.gsub('user-id:', '').to_i\n User.find user_id\n rescue ActiveSupport::MessageVerifier::InvalidSignature\n nil\n end",
"def authenticate_user\n return if request.headers['Authorization'].blank?\n\n jwt_payload = JwtHelper.decode(token: request.headers['Authorization'].split(' ').second)\n\n raise JWT::VerificationError if JwtBlacklist.any? { |obj| obj.jti == jwt_payload['jti'] }\n\n @current_user_id = jwt_payload['id']\n end",
"def authenticate_user\n if session[:user_id]\n # set current user object to @current_user object variable\n puts \"===============================================auth_if==============================================\"\n @current_user = User.find session[:user_id]\n return true\n else\n puts \"===============================================auth_else==============================================\"\n redirect_to(:controller => 'welcome', :action => 'index')\n return false\n end\n end",
"def verify_user_authentication\n\t\t\tuser = User.get_authentication_user(params[:U], params[:S])\n\t\t\tif user\n\t\t\t\treturn user\n\t\t\telse\n\t\t\t\tre = ApiReturn.new(\"005\")\n\t\t\t\treturn_response(re)\n\t\t\t\treturn nil\n\t\t\tend\n\t\tend",
"def logged_in_user_id\n token = request.headers[\"Authorization\"]\n # something which might raise an exception\n begin \n decoded_payload = JWT.decode(token, hmac_secret, true, { algorithm: 'HS256' })\n return decoded_payload.first[\"user_id\"].to_i\n # code that deals with some exception\n rescue\n return nil\n end\n end",
"def authenticate\n if user_has_session_cookie? and user_in_database?\n Thread.current['uid'] = session[:uid]\n else\n unless authentication_in_progress?\n redirect '/auth/google_oauth2', 303\n end\n end\n end",
"def get_user_id_from_token\n if request.headers['Authorization'].present?\n @token = request.headers['Authorization'].split(' ').last\n @payload ||= AuthToken.decode(@token)\n if @payload && @payload[:user_id]\n return @payload[:user_id]\n end\n end\n return nil\n end",
"def authentication_successful?\n current_user.present?\n end",
"def user_id\n @user_id ||= self.user ? self.user.to_global_id : nil\n end",
"def get_user\n \n # Retrieve user id if stored in a cookies\n # @TODO Secure ID when stored in cookies\n if cookies[:user]\n return User.find(cookies[:user])\n\n # Retrieve user id if stored in session\n elsif session[:user]\n return User.find(session[:user])\n\n # No user logged in\n else\n return nil\n end\n\n end",
"def current_user_id\n if cookies[:session_token]\n User.find_by_session_token(cookies[:session_token]).id\n else\n nil\n end\n end",
"def check_user\n @user = authenticate(@campaign.user_id, request.path, nil)\n end",
"def find_verified_user\n logged_in? ? current_user[:id] : reject_unauthorized_connection\n end",
"def authenticate_user\n unless session[:user_id]\n #If there's no user_id in the current session the user is redirected to the login page.\n redirect_to(:controller => 'sessions', :action => 'login')\n return false\n else\n #If there is a current user_id in the session @current_user will receive the User business object corresponding to\n #that ID.\n @current_user = User.find session[:user_id]\n return true\n end\n end",
"def find_user\n\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_data(\n 'sm_gud_fu_1',\n 'Invalid user id',\n 'Invalid user id',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user.blank? || @user.client_id != @client_id\n\n success\n end",
"def authenticate_user!\n payload = decode_token\n return unless payload.is_a? Hash\n\n @current_user = User.find payload[:user_id]\n end",
"def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end",
"def get_user_id\n # TODO: #6. Complete the function to return your user id\n user_id = 'Put your user ID here'\n end",
"def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end",
"def user_id\n @current_user.id\n end",
"def authenticate_user\n\t if session[:user_id]\n\t # set current user object to @current_user object variable\n\t @current_user = User.find session[:user_id] \n\t return true\t\n\t else\n\t redirect_to(:controller => 'sessions', :action => 'login')\n\t return false\n\t end\n\tend",
"def check_user\n if self.admin?\n return 1\n end\n return (session[:user_id] && User.find(session[:user_id])) ? 1 : nil\n end",
"def logged_user\n if decoded_token\n user_id = decoded_token[0].to_i\n @user = User.find user_id\n end\n end",
"def user_id_for(user)\n find(user.id, user.login)\n end",
"def get_user_id\n if current_user\n @user = User.find(current_user.id)\n end\nend",
"def user_id\n config.present? ? config[:user_id] : ''\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def authenticated_user\n user if valid? && user&.authenticated?(password)\n end",
"def user_id\n username\n end",
"def user_id\n if (id = (@opts[:user_id] || @opts['user_id'])) && id.respond_to?(:to_s)\n if (id = id.to_s).size > 0 && id != '0'\n return id\n end\n end\n end",
"def identify_the_user\n \t@current_user = User.find_by_id(session[\"user_id\"])\n end",
"def user_id_included_in_auth_token?\n http_auth_token && decoded_auth_token && decoded_auth_token[:user_id]\n end",
"def user_id\n @raw['user']['id']\n end",
"def current_user\n user = FastlaneCI::Services.user_service.find_user(id: env[:user])\n if user.nil?\n halt 500\n else\n return user\n end\n end",
"def try_login\n if user = http_auth_login || validation_login || remember_me_login\n session[:uid] = user.id\n end\n end",
"def authenticate_user_if_logged_in\n if session[:user_id] && User.exists?(session[:user_id])\n @current_user = User.find session[:user_id]\n elsif session[:user_id]\n # If the session user id exists, but the user doesn't,\n # remove the session variable and show an error.\n session[:user_id] = nil\n session[:search_url] = nil\n flash[:notice] = \"Unable to find the logged in user!\"\n flash[:color] = \"invalid\"\n end\n end",
"def authenticated_user\n authenticated\n error!('401 Unauthorized', 401) unless current_user\n end",
"def current_user_id\n info['user']['id']\n end",
"def session_id\n @session_id ||= begin\n response = authenticate\n response.body[:authenticate_response][:return]\n end\n end",
"def user_id\n instance_variable_get(:@prepared_arguments).dig(:user_id)\n end",
"def identify_user\n @user = User.find_by(id: session[:user_id])\n if !@user\n redirect_to root_url, notice: \"User not identified!\"\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def authenticate_user\n unless session[:user_id] && User.exists?(session[:user_id])\n # If the session user id exists, but the user doesn't,\n # remove the session variable and show an error.\n if session[:user_id]\n session[:user_id] = nil\n session[:search_url] = nil\n flash[:notice] = \"Unable to find the logged in user!\"\n flash[:color] = \"invalid\"\n end\n redirect_to(:controller => 'sessions', :action => 'login')\n return false\n else\n @current_user = User.find session[:user_id]\n return true\n end\n end",
"def user_id\n @current_user.id if !@current_user.nil? && users.include?(@current_user)\n users.first.id\n end",
"def authenticated_user\n\t \tauthenticated\n\t \terror!('401 Unauthorized', 401) unless current_user\n\t end",
"def authentication_response_status\n authenticate_user.success? ? :ok : :unauthorized\n end",
"def get_login\r\n if ((self.user_id) && (self.user_id > 0))\r\n return self.user.name\r\n else\r\n return false\r\n end\r\n end",
"def current_user\n return false unless authenticated?\n User.find_by(cas_username: session['cas']['user'])\n end",
"def authenticate!\n client_id = params[:client_id] || params[:query][:client_id] rescue nil\n token = params[:token] || params[:query][:token] rescue nil\n user = User.get_user(client_id, token)\n unless user\n render json: { 'errors' => ['Authorized users only.'] }, status: 401\n end\n user\n end",
"def perform\n u = User.find_by(username: @username)\n return u if u.try(:authenticate, @password)\n nil\n end",
"def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end",
"def find_user_id\n if (params[:user_id])\n return params[:user_id].to_i\n else\n return params[:id].to_i\n end\n end",
"def logged_in_user_id\n session[:user_id]\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n @current_user\n else\n false\n end\n end",
"def authenticate_user\n login_token = cookies[:auth_token]\n auth_service = ::Rbt::Auth::UserAuthService.new\n @logged_in_user = auth_service.validate_login_token(login_token)\n end",
"def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n render_error_invalid_token and return\n end\n else\n render_error_user_not_signed_in and return\n end\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n @current_user\n else\n false\n end\n end",
"def user_id\n decoded_token.first['user_id']\n end",
"def current_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n # Returns nil if not found\n end\n end",
"def check_authentication\n authenticate_user\n end",
"def user_id\n # The user id can't be handled by the method_missing magic from\n # OctocatHerder::Base, since the id method returns the object\n # id.\n @raw['id']\n end",
"def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n render_error_add :unauthorized, 'unauthorized' and return\n end\n else\n render_error_add :unauthorized, 'unauthorized' and return\n end\n end",
"def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end",
"def get_user(id)\n begin\n user = JSON.parse(RestClient.get construct_url(\"user/#{id}\"))\n rescue RestClient::ResourceNotFound => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end\n end",
"def authenticate\n authenticate_or_request_with_http_digest(REALM) do |username|\n USERS[username]\n end\n end",
"def check_user_id_presence\n if helpers.user_id.nil?\n cookies.encrypted.permanent[:user_id] = SecureRandom.hex\n helpers.initial_setup\n render 'welcome'\n end\n end",
"def get_userid()\n user_info = call_myspace_api(:user_info, :v1_json => true)\n user_info['userId'].to_s\n end",
"def current_user_id\n @server.current_user_id\n end",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def autenticate_user\n auth_token = request.headers[:HTTP_AUTH_TOKEN] #auth_token in header\n return render_message ({status:ERR_STATUS, responseMessage: \"Sorry! You are not an authenticated user.\",responseCode: ERROR}) unless auth_token\n @user = User.find_by(auth_token: auth_token)\n unless @user\n return render_message({status:ERR_STATUS,responseMessage: UNAUTHORIZED_MESSAGE,responseCode: UNAUTHORIZED})\n end\n end",
"def check_authenticate_user\n if request.headers[:token].present?\n @auth_token = AuthToken.find_by(token: request.headers[:token])\n @current_user = auth_token.user if @auth_token.present?\n unless @auth_token && @current_user\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n else\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n end",
"def authenticate\n user = User.active.where(\"email_id = ?\", self.email_id).first\n if user.present?\n return user.hashed_password == Digest::SHA1.hexdigest(user.password_salt.to_s + self.password)\n end\n return false\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def get_user_login\n user = User.first(:id => self.user_id )\n return user.login if user\n return nil\n end",
"def id\n @data[:user_id]\n end",
"def authenticate_and_load_user\n authentication_token = nil\n if request.headers[\"Authorization\"]\n authentication_token = request.headers[\"Authorization\"].split[1]\n end\n if authentication_token\n user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256')\n username = user[0][\"nickname\"]\n email = user[0][\"name\"]\n\n if user[0]['sub'].include? 'google-oauth2'\n email = username + '@gmail.com'\n end\n\n @current_user = User.find_by(email: email, username: username)\n if !@current_user.present?\n user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token)\n if user.save\n @current_user = user\n end\n end\n end\n return if @current_user.present?\n render json: {\n messages: \"Can't authenticate user\",\n is_success: false,\n data: {}\n }, status: :bad_request\n end",
"def identify\n @user = User.new\n if omniauth = session[:omniauth]\n @provider = omniauth.provider.capitalize\n @user.apply_omniauth(omniauth)\n end\n end",
"def user_authenticated?\n !session[:user_id].nil?\n end",
"def logged_in?\n unless session[:user_id].nil?\n return current_user\n end\n end",
"def current_user\n if session[:user] != nil\n # return the user id\n return session[:user]\n else\n return false\n end\nend",
"def get_userid()\r\n user_info = @context.call_myspace_api(:user_info, :v1_json => true)\r\n user_info['userId'].to_s\r\n end",
"def authenticate\n begin\n if !session[:user_guid]\n redirect_to(root_path)\n elsif session[:user_guid] != User.find_by(id: session[:user_id].to_i).guid\n redirect_to(logout_user_path)\n end\n rescue\n redirect_to(logout_user_path)\n end\n end"
] |
[
"0.74364185",
"0.7347219",
"0.7345716",
"0.7201236",
"0.68811125",
"0.68785864",
"0.6862121",
"0.67895925",
"0.67840147",
"0.6758222",
"0.67141813",
"0.6712152",
"0.6667868",
"0.66666687",
"0.6646331",
"0.6638658",
"0.6637823",
"0.66047096",
"0.6556569",
"0.6555979",
"0.6547097",
"0.65388924",
"0.65167284",
"0.6511333",
"0.6497839",
"0.64855397",
"0.64514947",
"0.6447843",
"0.64380956",
"0.6421343",
"0.64183056",
"0.64042836",
"0.6396169",
"0.6394727",
"0.6388862",
"0.63859665",
"0.6382999",
"0.6377825",
"0.6377825",
"0.6377825",
"0.6377825",
"0.6377825",
"0.6377825",
"0.6373508",
"0.6368952",
"0.63677096",
"0.63622344",
"0.6352852",
"0.6322915",
"0.63200164",
"0.63172776",
"0.6288224",
"0.6287655",
"0.62862575",
"0.6284347",
"0.62808347",
"0.62781113",
"0.62724537",
"0.62724537",
"0.62705255",
"0.62665075",
"0.6261868",
"0.626012",
"0.62495285",
"0.623355",
"0.6228358",
"0.6227512",
"0.6217727",
"0.62141913",
"0.6213809",
"0.6212545",
"0.6208958",
"0.61926997",
"0.618208",
"0.6180718",
"0.6177416",
"0.61752397",
"0.61747414",
"0.6171821",
"0.61613464",
"0.6159715",
"0.61590755",
"0.6158189",
"0.61545265",
"0.61527497",
"0.6140313",
"0.6132163",
"0.6129485",
"0.6128202",
"0.61276263",
"0.6121849",
"0.6119942",
"0.61164737",
"0.61106575",
"0.609959",
"0.6096582",
"0.6095611",
"0.6092913",
"0.6092516",
"0.6088846"
] |
0.7841099
|
0
|
Returns the meta data, if authentication was successful.
|
def meta_data
return nil unless success?
@meta_data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def metadata\n @meta_data\n end",
"def meta_data\n @meta_data ||= params['metaData']\n end",
"def user_info\n auth_hash['user_info']\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def metadata\n @data[:metadata]\n end",
"def meta\n json_body.fetch('meta', {})\n end",
"def metadata\n return @metadata unless @metadata.nil?\n @metadata = fetch_metadata\n configure_with_metadata(@metadata)\n @metadata\n end",
"def meta\n meta = {}\n set_meta(meta)\n return meta\n end",
"def meta\n @d[:meta]\n end",
"def metadata\n api_get(\"$metadata\").body\n end",
"def meta_information\n @meta_hash ||= {}\n end",
"def meta\n @meta ||= decoded_body[:meta]\n end",
"def extract_meta\n end",
"def meta_data\n @meta_data ||= @internal_struct[:meta_data]\n end",
"def get_auth()\n\t\t\tfind_attributes(\"auth\").first\n\t\tend",
"def metadata\n self[:metadata] || {}\n end",
"def meta_data\n #object = instance_variable_get('@'+controller_name.singularize)\n object = instance_variable_get('@resource')\n meta = {}\n\n if object.kind_of? ActiveRecord::Base\n meta[:keywords] = object.meta_keywords if object[:meta_keywords].present?\n meta[:description] = object.meta_description if object[:meta_description].present?\n end\n\n #if meta[:description].blank? && object.kind_of?(Spree::Product)\n # meta[:description] = strip_tags(truncate(object.description, length: 160, separator: ' '))\n #end\n\n meta.reverse_merge!({\n keywords: current_store.meta_keywords,\n description: current_store.meta_description,\n }) if meta[:keywords].blank? or meta[:description].blank?\n meta\n end",
"def get_meta_config\n get_config[:meta]\n end",
"def meta?\n @meta\n end",
"def metadata\n @metadata ||= lambda { read_metadata }.call\n end",
"def metadata\n @metadata ||= lambda { read_metadata }.call\n end",
"def from_authentication_data response\n load_attributes_from_response(response)\n end",
"def metadata\n @metadata\n end",
"def metadata\n return @metadata\n end",
"def metadata\n return @metadata\n end",
"def auth\n {}\n end",
"def metadata\n @metadata ||= Metaforce::Metadata::Client.new(@options)\n end",
"def meta\n File.open(File.join(@load_dir, 'meta.json')) do |f|\n JSON.parse(f.read)\n end\n end",
"def meta\n options[:meta]\n end",
"def get_metadata\n if (@document == nil)\n return false\n end\n \n @msdata = get_document_metadata(@document)\n #md_index = get_md_index() #Gets metadata index for (ace/dec) sorting \n #sort_metadata(md_index) #Sorts metadata (ace/dec)\n end",
"def get_idp_metadata\n return false if @settings.idp_metadata.nil?\n \n # Look up the metdata in cache first\n id = Digest::MD5.hexdigest(@settings.idp_metadata)\n\n uri = URI.parse(@settings.idp_metadata)\n if uri.scheme == \"http\"\n response = Net::HTTP.get_response(uri)\n meta_text = response.body\n elsif uri.scheme == \"https\"\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n # Most IdPs will probably use self signed certs\n #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n get = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(get)\n meta_text = response.body\n end\n testo_response = meta_text.sub!(' xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"', '')\n doc = REXML::Document.new(testo_response)\n extract_certificate(doc)\n return doc\n\n # USE OF CACHE WITH CERTIFICATE\n # lookup = @cache.read(id)\n # if lookup != nil\n # Logging.debug \"IdP metadata cached lookup for #{@settings.idp_metadata}\"\n # doc = REXML::Document.new( lookup )\n # extract_certificate( doc )\n # return doc\n # end\n \n # Logging.debug \"IdP metadata cache miss on #{@settings.idp_metadata}\"\n # # cache miss\n # if File.exists?(@settings.idp_metadata)\n # fp = File.open( @settings.idp_metadata, \"r\")\n # meta_text = fp.read\n # else\n # uri = URI.parse(@settings.idp_metadata)\n # if uri.scheme == \"http\"\n # response = Net::HTTP.get_response(uri)\n # meta_text = response.body\n # elsif uri.scheme == \"https\"\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # # Most IdPs will probably use self signed certs\n # #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n # get = Net::HTTP::Get.new(uri.request_uri)\n # response = http.request(get)\n # meta_text = response.body\n # end\n # end\n # # Add it to the cache\n # @cache.write(id, meta_text, @settings.idp_metadata_ttl )\n # doc = REXML::Document.new( meta_text )\n # extract_certificate(doc)\n # return doc\n end",
"def include_meta_info\n true\n end",
"def metadata\n response = retrieve_metadata\n return response.body unless response.nil? || response.status == 404\n Geoblacklight.logger.error \"Could not reach #{@reference.endpoint}\"\n \"Could not reach #{@reference.endpoint}\"\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def read_metadata\n @client.get(metadata_path)\n end",
"def metadata\n if any? && metadata_schema\n response = api('request',\n :uri => \"hm://metadata/#{resource_name}s\",\n :batch => true,\n :payload => map {|resource| {:uri => resource.metadata_uri}},\n :response_schema => metadata_schema\n )\n response['result']\n else\n []\n end\n end",
"def metadata\n @metadata ||= Mash.new\n end",
"def metadata\n @metadata ||= {}\n end",
"def metadata\n @metadata ||= {}\n end",
"def auth_response\n @auth_response ||= self.authenticate\n end",
"def get_auth_data\n user, pass = nil, nil\n # extract authorisation credentials \n if request.env.has_key? 'X-HTTP_AUTHORIZATION' \n # try to get it where mod_rewrite might have put it \n authdata = request.env['X-HTTP_AUTHORIZATION'].to_s.split \n elsif request.env.has_key? 'HTTP_AUTHORIZATION' \n # this is the regular location \n authdata = request.env['HTTP_AUTHORIZATION'].to_s.split \n end \n \n # at the moment we only support basic authentication \n if authdata && authdata[0] == 'Basic' \n user, pass = Base64.decode64(authdata[1]).split(':')[0..1] \n end \n return [user, pass] \n end",
"def fetch_metadata\n uri = SCALEWAY_METADATA_URL.to_s\n response = http_client.get(uri)\n case response.code\n when \"200\"\n parser = FFI_Yajl::Parser.new\n parser.parse(response.body)\n when \"404\"\n logger.trace(\"Mixin ScalewayMetadata: Encountered 404 response retrieving Scaleway metadata: #{uri} ; continuing.\")\n {}\n else\n raise \"Mixin ScalewayMetadata: Encountered error retrieving Scaleway metadata (#{uri} returned #{response.code} response)\"\n end\n end",
"def meta\n Meta.get(self)\n end",
"def read_metadata; end",
"def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end",
"def token_metadata()\n return @data[\"access\"][\"token\"]\n end",
"def check_authentication_info(res, opts)\n\n return if no_digest_auth\n # not using digest authentication\n\n return unless @challenge\n # not yet authenticated\n\n authinfo = AuthInfo.new res\n @challenge.nonce = authinfo.nextnonce\n end",
"def remote_info\n return nil unless oauth_token?\n response = api(url: '/user')\n response.data\n end",
"def user_data\n User.user_data login\n end",
"def authenticated?\n true\n end",
"def _get_meta_data(key)\n Lorj.data.auto_section_data(key)\n # meta_default = Lorj.defaults.get_meta_auto(key)\n # return nil if meta_default.nil?\n # meta_default = meta_default.clone\n\n # section = Lorj.defaults.get_meta_section(key)\n # return meta_default if section.nil?\n # meta = PrcLib.model.meta_data.rh_get(section, key)\n # return meta_default if meta.nil?\n\n # meta_default.merge!(meta)\n end",
"def authenticate\n self.get && true\n end",
"def metadata\n return unless self[:metadata]\n\n self[:metadata].deep_symbolize_keys\n end",
"def meta\n @hash.any? ? @hash : nil\n end",
"def set_meta\n puts 'meta'\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def read_metadata\n @metadata =\n if !disabled? && File.file?(metadata_file)\n content = File.binread(metadata_file)\n\n begin\n Marshal.load(content)\n rescue TypeError\n SafeYAML.load(content)\n rescue ArgumentError => e\n Jekyll.logger.warn(\"Failed to load #{metadata_file}: #{e}\")\n {}\n end\n else\n {}\n end\n end",
"def fetch_metadata\n self.user_id ||= biblio_commons.user_id\n self.title ||= biblio_commons.name\n self.thumbnail ||= RemoteImage.new(:url => biblio_commons.thumbnail_url)\n end",
"def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end",
"def http_authenticatable?; end",
"def authenticate\n raise Rackspace::NotInitialized unless self.initialized?\n headers = RestClient::Request.execute(:method => :get, :url => \"#{AUTH_URL}/#{self.api_version}\", :headers => {\"X-Auth-User\" => self.api_user, \"X-Auth-Key\" => self.api_key}, :raw_response => true).headers\n {:auth_token => headers[:x_auth_token], :storage_url => headers[:x_storage_url], :server_management_url => headers[:x_server_management_url], :cdn_management_url => headers[:x_cdn_management_url]}\n end",
"def scrape_meta_data\n unless @data.meta\n @data.meta!.name!\n @data.meta!.property!\n parsed_document.xpath(\"//meta\").each do |element|\n get_meta_name_or_property(element)\n end\n end\n end",
"def metadata?\n true\n end",
"def metadata?\n true\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generic authentication plugin',\n 'link' => 'http://sabre.io/dav/authentication/'\n }\n end",
"def get_metadata(*args)\n self.metadata.get(*args)\n end",
"def agent_details\n authenticate_request\n if @current_user && !@current_user.is_developer\n details = @current_user.details\n render json: details, status: 200\n end\n end",
"def auth\n cfg_get(:auth)\n end",
"def authenticated?\n @authenticated\n end",
"def authenticated?\n @authenticated\n end",
"def authenticated?\n authentication.values.all?\n end",
"def authenticated?\n authentication.values.all?\n end",
"def authenticated?\n authentication.values.all?\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/v1/me').parsed\n end",
"def meta\n {}\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def authentication_response\n if authenticate_user.success?\n { :token => authenticate_user.result }\n else\n { :error => :unauthorized }\n end\n end",
"def auth_info\n params[auth_param] || {}\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def authenticated?\n authentication.authenticated?\n end",
"def read_meta_info\n if meta_info_file_pathname.exist?\n inode, bytes_read = meta_info_file_pathname.read.strip.split(':').map(&:to_i)\n {\n inode: inode,\n bytes_read: bytes_read\n }\n else\n {\n inode: nil,\n bytes_read: 0\n }\n end\n end",
"def metadata\n configuration.metadata\n end",
"def format_authentication_data(data)\n # return unless data.present?\n return if data.blank?\n response.headers.merge!(data[:headers]) if data[:headers].present?\n # return unless data[:body].present?\n return if data[:body].blank?\n render json: data[:body], status: status_for_response(data[:code])\n false\n end",
"def extract_metadata; end",
"def get_idp_metadata\n\t\t\n\t\t\treturn false if @settings.idp_metadata.nil?\n\t\t\n\t\t\t# Look up the metdata in cache first\n\t\t\tid = Digest::MD5.hexdigest(@settings.idp_metadata)\n\t\t\tlookup = @cache.read(id)\n\t\t\tif lookup != nil\n\t\t\t\tLogging.debug \"IdP metadata cached lookup for #{@settings.idp_metadata}\"\n\t\t\t\tdoc = REXML::Document.new( lookup )\n\t\t\t\textract_certificate( doc )\n\t\t\t\treturn doc\n\t\t\tend\n\t\t\t\n\t\t\tLogging.debug \"IdP metadata cache miss on #{@settings.idp_metadata}\"\n\t\t\t# cache miss\n\t\t\tif File.exists?(@settings.idp_metadata)\n\t\t\t\tfp = File.open( @settings.idp_metadata, \"r\")\n\t\t\t\tmeta_text = fp.read\n\t\t\telse\n\t\t\t\turi = URI.parse(@settings.idp_metadata)\n\t\t\t\tif uri.scheme == \"http\"\n\t\t\t\t\tresponse = Net::HTTP.get_response(uri)\n\t\t\t\t\tmeta_text = response.body\n\t\t\t\telsif uri.scheme == \"https\"\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\t# Most IdPs will probably use self signed certs\n\t\t\t\t\t#http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\t\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\t\t\tget = Net::HTTP::Get.new(uri.request_uri)\n\t\t\t\t\tresponse = http.request(get)\n\t\t\t\t\tmeta_text = response.body\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Add it to the cache\n\t\t\t@cache.write(id, meta_text, @settings.idp_metadata_ttl )\n\t\t\tdoc = REXML::Document.new( meta_text )\n\t\t\textract_certificate(doc)\n\t\t\treturn doc\n\t\tend",
"def metadata(remote)\n load_metadata(remote.name, \"v#{remote.version}\")\n end",
"def test_get_meta_data\n puts \"## get meta data about an object model##\"\n resp = Salesforce::Rest::Account.xget_meta_data()\n\n pp resp\n assert !resp.nil?\n end",
"def auth_info\n render :action => 'auth_info.json', :layout => false\n end",
"def get_wordpress_user_info\n\t\t\tif wordpress_cookie\n\t\t\t\tresponse = HTTParty.get(\"#{WORDPRESS_AUTH_URL}?cookie=#{URI.encode(wordpress_cookie)}\")\n\t\t\t\treturn JSON.parse(response.body) if response.code == 200\n\t\t\tend\n\t\t\treturn nil\n\t\tend",
"def authenticated?\n session['cas'] && session['cas']['user']\n end",
"def site_meta\n end",
"def site_meta\n end",
"def fetch_object_metadata(session_id)\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n # Do nothing.\n end\n \n # Parse the response.\n response_parse_logic = lambda do |response| \n \n end\n end",
"def authentication\n {:username => @username, :password => @password}\n end",
"def load_meta cache = true\n meta = if @meta_path.extname == '.yml'\n contents = begin\n @meta_path.read\n rescue Exception => error\n raise QB::Role::MetadataError,\n \"Failed to read metadata file at #{ @meta_path.to_s }, \" +\n \"error: #{ error.inspect }\"\n end\n \n begin\n YAML.load(contents) || {}\n rescue Exception => error\n raise QB::Role::MetadataError,\n \"Failed to load metadata YAML from #{ @meta_path.to_s }, \" +\n \"error: #{ error.inspect }\"\n end\n else\n YAML.load(Cmds.out!(@meta_path.realpath.to_s)) || {}\n end\n \n if cache\n @meta = meta\n end\n \n meta\n end",
"def http_auth_header?; end",
"def metas_storage\n Thread.current[:metas]\n end"
] |
[
"0.65194994",
"0.6234556",
"0.61730164",
"0.61438113",
"0.61438113",
"0.6120869",
"0.6114129",
"0.6085272",
"0.6083562",
"0.59939694",
"0.5990944",
"0.5949814",
"0.5948992",
"0.5938612",
"0.5899271",
"0.58932984",
"0.5873987",
"0.585858",
"0.58571815",
"0.5852336",
"0.58284175",
"0.58284175",
"0.5809219",
"0.57898587",
"0.5769503",
"0.5769503",
"0.57398903",
"0.5717717",
"0.57116324",
"0.5711335",
"0.57111436",
"0.56959754",
"0.569588",
"0.5682843",
"0.5676091",
"0.56755024",
"0.5674538",
"0.56698763",
"0.5656771",
"0.564634",
"0.5634015",
"0.5633839",
"0.56320465",
"0.56156003",
"0.56154096",
"0.55991757",
"0.55799615",
"0.55766857",
"0.55645746",
"0.5563709",
"0.5553968",
"0.5542096",
"0.5542087",
"0.55408704",
"0.5540627",
"0.55394757",
"0.5536975",
"0.55326915",
"0.5524409",
"0.55201215",
"0.55170166",
"0.550115",
"0.5495916",
"0.5494703",
"0.549284",
"0.5485874",
"0.5485453",
"0.54815793",
"0.5474607",
"0.54647696",
"0.54647696",
"0.54539293",
"0.54539293",
"0.54539293",
"0.54427636",
"0.54427636",
"0.5441049",
"0.5433498",
"0.5431811",
"0.54283655",
"0.5421406",
"0.5418884",
"0.54176885",
"0.5415484",
"0.5397394",
"0.5394577",
"0.5392299",
"0.5389511",
"0.5384472",
"0.53772205",
"0.53736544",
"0.5369436",
"0.5366911",
"0.5364746",
"0.5364746",
"0.5363568",
"0.53592736",
"0.5346287",
"0.5345197",
"0.53373927"
] |
0.7379037
|
0
|
Calculates a notched path that flows between the outer edge of the box (outside_line) and inner (inside_line). Relative location of these lines also defines the direction and orientation of the box, and hence the notches. We always want to create a symmetric path that has a notch in the middle (for center_out = true) or dip in the middle (center_out = false)
|
def path(edge)
shifts = define_shifts(edge)
path = NotchedPath.new
if fill_corners
r1 = Geometry::Rect.new(edge.inside.p1, edge.outside.p1)
r2 = Geometry::Rect.new(edge.inside.p2, edge.outside.p2)
path.corner_boxes << r1
path.corner_boxes << r2
end
point = edge.inside.p1.clone
vertices = [point]
shifts.each do |shift|
point = shift.next(point)
vertices << point
end
path.vertices = vertices
path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_path\n nodes = []\n angle = 2 * Math::PI / @sides\n theta = angle / 2 + Math::PI / 2\n @sides.times do |n|\n nodes[n] = []\n nodes[n][0] = @radius * Math.cos(angle * n + theta) + @x\n nodes[n][1] = @radius * Math.sin(angle * n + theta) + @y\n end\n\n Path.new(*nodes, **@options)\n end",
"def eulerline\n return self.orthocenter if self.is_equilateral?\n Line.new(self.orthocenter, self.circumcenter)\n end",
"def drawLines\n\n # Closed or no subfolders.\n return unless self.open? && self.subfolders.any?\n\n self.verticalLine = Rectangle.alloc.init\n self.folderView.addSubview(self.verticalLine)\n\n firstFolder = self.subfolderView.folders.first\n\n # Only one subfolder.\n if self.subfolderView.folders.count == 1\n\n views = { 'folderIcon' => self.folderIcon,\n 'verticalLine' => self.verticalLine,\n 'subfolder' => firstFolder }\n\n self.folderView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(\n \"V:[folderIcon][verticalLine(#{FOLDER_SUBFOLDER_VERTICAL_SPACING})][subfolder]\",\n options: 0, metrics: nil, views: views))\n\n # More than one subfolder.\n else\n\n lastFolder = self.subfolderView.folders.last\n\n self.horizontalLine = Rectangle.alloc.init\n self.folderView.addSubview(self.horizontalLine)\n\n views = { 'folderIcon' => self.folderIcon,\n 'verticalLine' => self.verticalLine,\n 'horizontalLine' => self.horizontalLine }\n\n verticalLineHeight = ((FOLDER_SUBFOLDER_VERTICAL_SPACING - LINE_THICKNESS) / 2.0).floor\n self.folderView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(\n \"V:[folderIcon][verticalLine(#{verticalLineHeight})][horizontalLine(#{LINE_THICKNESS})]\",\n options: 0, metrics: nil, views: views))\n\n # horizontalLine.left == firstFolder.centerX\n self.folderView.addConstraint(NSLayoutConstraint.constraintWithItem(self.horizontalLine,\n attribute: NSLayoutAttributeLeft,\n relatedBy: NSLayoutRelationEqual,\n toItem: firstFolder,\n attribute: NSLayoutAttributeCenterX,\n multiplier: 1.0,\n constant: 0.0))\n # horizontalLine.right == lastFolder.centerX\n self.folderView.addConstraint(NSLayoutConstraint.constraintWithItem(self.horizontalLine,\n attribute: NSLayoutAttributeRight,\n relatedBy: NSLayoutRelationEqual,\n toItem: lastFolder,\n attribute: NSLayoutAttributeCenterX,\n multiplier: 1.0,\n constant: 0.0))\n\n # Draw subfolder lines.\n self.subfolderLines = self.subfolderView.folders.collect { |subfolder| drawLineToSubfolder(subfolder) }\n end\n\n # At least one subfolder.\n # verticalLine.centerX == folderIcon.centerX\n self.folderView.addConstraint(NSLayoutConstraint.constraintWithItem(self.verticalLine,\n attribute: NSLayoutAttributeCenterX,\n relatedBy: NSLayoutRelationEqual,\n toItem: self.folderIcon,\n attribute: NSLayoutAttributeCenterX,\n multiplier: 1.0,\n constant: 0.0))\n # verticalLine.width = 1\n self.folderView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(\"H:[verticalLine(#{LINE_THICKNESS})]\",\n options: 0, metrics: nil, views: views))\n end",
"def make_teardroppath()\n thePath = MIPath.new\n centerPoint = MIShapes.make_point(0, 0)\n thePath.add_arc(centerPoint: centerPoint,\n radius: \"$logowidth * $fraction * $r1\",\n startAngle: \"pi_2() - asin($r1 - 0.04)\",\n endAngle: \"asin($r1 - 0.04) - pi_2()\")\n\n centerPoint2 = MIShapes.make_point(\"$logowidth * $fraction\", 0)\n thePath.add_arc(centerPoint: centerPoint2,\n radius: \"$logowidth * $fraction * 0.04\",\n startAngle: \"asin($r1 - 0.04) - pi_2()\",\n endAngle: \"pi_2() - asin($r1 - 0.04)\")\n thePath.add_closesubpath()\n\n startPoint = MIShapes.make_point(\n \"$logowidth * $fraction * (1.0 + 0.04 * ($r1 - 0.04))\",\n \"$logowidth * $fraction * 0.04 * cos(asin($r1 - 0.04))\")\n return startPoint, thePath\nend",
"def to_path\n Path.new(\n N.n(@x, @y),\n N.n(@x - @width / 2, @y + @height),\n N.n(@x + @width / 2, @y + @height),\n **@options\n )\n end",
"def normalizeLine(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n\n # make sure we didn't wrap one way or the other.\n # taking the shortest great circle distance.\n x = x <= -180 ? x + 360 : x\n x = x >= 180 ? x - 360 : x\n return [[0,0],[x,y]]\n end",
"def line_xiaolin_wu(x0, y0, x1, y1, stroke_color, inclusive = true)\n stroke_color = ChunkyPNG::Color.parse(stroke_color)\n\n dx = x1 - x0\n sx = dx < 0 ? -1 : 1\n dx *= sx\n dy = y1 - y0\n sy = dy < 0 ? -1 : 1\n dy *= sy\n\n if dy == 0 # vertical line\n x0.step(inclusive ? x1 : x1 - sx, sx) do |x|\n compose_pixel(x, y0, stroke_color)\n end\n\n elsif dx == 0 # horizontal line\n y0.step(inclusive ? y1 : y1 - sy, sy) do |y|\n compose_pixel(x0, y, stroke_color)\n end\n\n elsif dx == dy # diagonal\n x0.step(inclusive ? x1 : x1 - sx, sx) do |x|\n compose_pixel(x, y0, stroke_color)\n y0 += sy\n end\n\n elsif dy > dx # vertical displacement\n compose_pixel(x0, y0, stroke_color)\n e_acc = 0\n e = ((dx << 16) / dy.to_f).round\n (dy - 1).downto(0) do |i|\n e_acc_temp, e_acc = e_acc, (e_acc + e) & 0xffff\n x0 += sx if e_acc <= e_acc_temp\n w = 0xff - (e_acc >> 8)\n compose_pixel(x0, y0, ChunkyPNG::Color.fade(stroke_color, w))\n if inclusive || i > 0\n compose_pixel(x0 + sx, y0 + sy, ChunkyPNG::Color.fade(stroke_color, 0xff - w))\n end\n y0 += sy\n end\n compose_pixel(x1, y1, stroke_color) if inclusive\n\n else # horizontal displacement\n compose_pixel(x0, y0, stroke_color)\n e_acc = 0\n e = ((dy << 16) / dx.to_f).round\n (dx - 1).downto(0) do |i|\n e_acc_temp, e_acc = e_acc, (e_acc + e) & 0xffff\n y0 += sy if e_acc <= e_acc_temp\n w = 0xff - (e_acc >> 8)\n compose_pixel(x0, y0, ChunkyPNG::Color.fade(stroke_color, w))\n if inclusive || i > 0\n compose_pixel(x0 + sx, y0 + sy, ChunkyPNG::Color.fade(stroke_color, 0xff - w))\n end\n x0 += sx\n end\n compose_pixel(x1, y1, stroke_color) if inclusive\n end\n\n self\n end",
"def incenter\n return @incenter if defined?(@incenter)\n\n s = self.sides\n l = [1, 2, 0].map { |i| s[i].length }\n p = l.sum\n\n x_arr = self.vertices.map { |v| v.x / p }\n y_arr = self.vertices.map { |v| v.y / p }\n\n x = l[0] * x_arr[0] + l[1] * x_arr[1] + l[2] * x_arr[2]\n y = l[0] * y_arr[0] + l[1] * y_arr[1] + l[2] * y_arr[2]\n\n @incenter = Point.new(x, y)\n @incenter\n end",
"def sideline_seg( side )\n l = nil\n case side\n when :u; l = Gseg.new_by_pos( x1y1, x2y1 )\n when :d; l = Gseg.new_by_pos( x1y2, x2y2 )\n when :l; l = Gseg.new_by_pos( x1y1, x1y2 )\n when :r; l = Gseg.new_by_pos( x2y1, x2y2 )\n else; l = nil\n end\n l\n end",
"def down_stroke(col: 0, top: 0, bot: 0, asc: 0, dsc: 0, left: 1, right: 1)\n\n x1 = xp + col*nw - (top*2*dx)*left\n x2 = xp + col*nw\n x3 = xp + col*nw + (bot*2*dx)*right\n\n y1 = yp + dy - asc*2*dy\n y2 = yp + dy + top*2*dy - asc*2*dy\n y3 = yp + 4*nib - dy - bot*2*dy + dsc*2*dy\n y4 = yp + 4*nib - dy + dsc*2*dy\n\n output = \"\"\n output += penline(x1, y1, x2, y2) if top > 0\n output += penline(x2, y2, x2, y3)\n output += penline(x2, y3, x3, y4) if bot > 0\n output\n end",
"def lattice_paths(grid_size)\n # Initialization\n intersections = Array.new(grid_size + 1)\n intersections.map! { |r| Array.new(grid_size + 1) }\n\n # Base case - at the bottom and right edges, there is only one route remaining.\n # Technically the bottom-right point has no routes remaining, but it doesn't matter here.\n (0..grid_size).each do |i|\n intersections[i][grid_size] = 1\n intersections[grid_size][i] = 1\n end\n\n calculate_routes(0, 0, intersections)\n\n intersections[0][0]\nend",
"def offLine(c1,c2,c3)\n\n if equalCoordinates?(c1, c2)\n return equalCoordinates?(c1, c3) ? 0 : getGeoDistance(c1, c3)\n end\n\n if equalCoordinates?(c1, c3)\n return 0\n end\n # we get the difference Geodesic angles\n theta1 = getGeoAngle(c1, c2)\n theta2 = getGeoAngle(c1, c3)\n theta3 = theta2-theta1\n\n # buf buf\n # (--- c1 ----------------- c2 ---)\n # * |\n # H(c1-c3) * | H*Sin(theta3)\n # * |\n # c3\n hc1c3 = getGeoDistance(c1, c3)\n hc1c2 = getGeoDistance(c1, c2)\n #\n # if the point is with in a buffer's radius of C1 then it is on the line,\n # Otherwise, its distance from C1 must be less than the distance to C2\n # plus the buffer, and its distance to the C1-C2 line must be less than the buffer.\n # Furthermore this calculation only works if difference in angles is less than PI/2.\n # If the difference in angles is greater than that, then the point is not near\n # the line, unless it was within the buffer radius of C1.\n #\n result = abs(Math.sin(theta3) * hc1c3)\n\n return result\n end",
"def down_stroke(col: 0, top: 0, bot: 0, asc: 0, dsc: 0, left: 1, right: 1, top_s: false, bot_s: false)\n\n real_top = top\n real_top = 0.5 if top_s\n real_bot = bot\n real_bot = 0.5 if bot_s\n\n x1 = xp + col*nw - (real_top*2*dx)*left\n x2 = xp + col*nw\n x3 = xp + col*nw + (real_bot*2*dx)*right\n\n y1 = yp + dy - asc*2*dy\n y2 = yp + dy + real_top*2*dy - asc*2*dy\n y3 = yp + 4*nib - dy - real_bot*2*dy + dsc*2*dy\n y4 = yp + 4*nib - dy + dsc*2*dy\n\n output = \"\"\n output += penline(x1, y1, x2, y2) if top > 0 and not top_s\n output += penline(x1, y1, x2+(x2-x1), y2+(y2-y1)) if real_top > 0 and top_s\n output += penline(x2, y2, x2, y3)\n output += penline(x2, y3, x3, y4) if bot > 0 and not bot_s\n output += penline(x2-(x3-x2), y3-(y4-y3), x3, y4) if real_bot > 0 and bot_s\n output\n end",
"def arc_to_radius(pMill, pCent_x, pCent_y, pBeg_radius,pBeg_deg, pEnd_radius, pEnd_deg,pBegZ, pEndZ)\r\n# # # # # # # # # # # # # # # # # # # \r\n # start as center and \r\n mill = pMill\r\n \r\n if (pBegZ > 0)\r\n pBegZ = 0 - pBegZ\r\n end\r\n if (pEndZ > 0)\r\n pEndZ = 0 - pEndZ\r\n end\r\n\r\n tot_step_cnt = 0\r\n #print \"(arc_to_radius pCent_x=\", pCent_x, \" pCent_y=\", pCent_y, \"pBeg_radius\", pBeg_radius, \" pBeg_deg=\", pBeg_deg, \" pEnd_radius=\", pEnd_radius, \" pEnd_deg=\", pEnd_deg, \")\\n\"\r\n\r\n # TODO: Calculate the distance traveled along the arc\r\n # and use it to adjust the amount of depth that can be\r\n # calculated. \r\n \r\n # TODO: Add a flag which is a face on versus a incremental side cut and when face on we need to either run slower or take a more shallow cut.\r\n curr_deg = pBeg_deg\r\n radius_delta = pEnd_radius - pBeg_radius\r\n degree_delta = pEnd_deg - pBeg_deg\r\n radius_inc = pMill.cut_inc\r\n def_deg_step = degrees_for_distance(pBeg_radius, 0.02)\r\n print \"(def_deg_step = \", def_deg_step, \")\\n\"\r\n # this is the number of degrees in 0.01 inches\r\n # or 1/100 of an inch. \r\n no_steps_deg = degree_delta / def_deg_step # One degree \r\n print \"(degree_delta=\", degree_delta, \")\\n\"\r\n print \"(radius_delta=\", radius_delta, \")\\n\"\r\n print \"(radius_inc=\", radius_inc, \")\\n\"\r\n no_steps = (radius_delta / radius_inc)\r\n if (no_steps_deg > no_steps)\r\n no_steps = no_steps_deg \r\n # use what ever number of steps is greater \r\n # by degree change or radius change. \r\n end \r\n \r\n # if there are not enough calculated steps\r\n # then increase automatically to use a larger\r\n # number to get some reasonably small granulatiry\r\n # of move.\r\n if (no_steps < 1)\r\n no_steps = 5 \r\n elsif (no_steps < 10)\r\n no_steps *= 5\r\n end\r\n \r\n no_steps = no_steps.to_i\r\n no_steps_f = no_steps.to_f\r\n radius_inc = radius_delta. / no_steps_f.abs\r\n degree_inc = degree_delta / no_steps_f.abs \r\n depth_inc = (pMill.cut_depth_inc * 0.7) / (no_steps_f.abs * 2.0) # have of the cut depth one way and one half on the way back\r\n curr_depth = pBegZ \r\n cnt = 0\r\n depth_end_flag = false\r\n \r\n while (depth_end_flag == false) \r\n curr_deg = pBeg_deg \r\n curr_radius = pBeg_radius \r\n \r\n for step_cnt in (1..no_steps) \r\n cp = calc_point_from_angle(\r\n pcx=pCent_x,\r\n pcy=pCent_y, \r\n angle=curr_deg, \r\n length=curr_radius)\r\n \r\n if (tot_step_cnt == 0)\r\n pMill.retract(pBegZ + 0.1)\r\n pMill.move_fast(cp.x,cp.y)\r\n pMill.move_fast(cp.x,cp.y, pBegZ)\r\n pMill.move(cp.x,cp.y)\r\n pMill.plung(curr_depth) \r\n end\r\n \r\n pMill.move(cp.x, cp.y, curr_depth)\r\n tot_step_cnt += 1\r\n curr_radius += radius_inc\r\n curr_deg += degree_inc \r\n curr_depth -= depth_inc \r\n if (curr_depth < pEndZ)\r\n curr_depth = pEndZ\r\n end \r\n end # for\r\n\r\n if curr_depth == pEndZ \r\n depth_end_flag = true\r\n end\r\n \r\n \r\n # Arch back to start \r\n for step_cnt in (1..no_steps)\r\n cp = calc_point_from_angle(\r\n pcx=pCent_x,\r\n pcy=pCent_y, \r\n angle=curr_deg, \r\n length=curr_radius)\r\n pMill.move(cp.x, cp.y, curr_depth)\r\n tot_step_cnt += 1\r\n curr_radius -= radius_inc\r\n curr_deg -= degree_inc \r\n curr_depth -= depth_inc \r\n if (curr_depth < pEndZ)\r\n curr_depth = pEndZ\r\n end \r\n end # for\r\n end # while depth\r\n\r\n pMill.retract(pBegZ)\r\n return 1\r\n\r\nend",
"def create_pathdrawelement(line_width: 16.0, stroke_color: nil)\n strokeColor = stroke_color unless stroke_color.nil?\n strokeColor = MIColor.make_rgbacolor(0.2, 0.2, 0.2) if stroke_color.nil?\n arcBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n startX = $theWidth * 0.5 + $radius * Math.sin(-0.75 * Math::PI)\n startY = $theHeight * 0.5 + $radius * Math.cos(-0.75 * Math::PI)\n startPoint = MIShapes.make_point(startX, startY)\n arcBBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n thePath = make_arcpath(inBox: arcBBox, radius: $radius)\n pathDrawElement = MIDrawElement.new(:strokepath)\n pathDrawElement.arrayofpathelements = thePath\n pathDrawElement.startpoint = startPoint\n pathDrawElement.linewidth = line_width\n pathDrawElement.linecap = :kCGLineCapRound\n pathDrawElement.strokecolor = strokeColor\n pathDrawElement\nend",
"def mill_spiral(\r\n mill,\r\n cent_x,\r\n cent_y,\r\n inner_diam,\r\n outer_diam,\r\n channel_width,\r\n wall_thick,\r\n depth = nil)\r\n# - - - - - - - - - - - - - - - - - - -\r\n cut_inc = mill.cut_increment\r\n degree_inc = 1.0\r\n min_radius = inner_diam / 2.0\r\n max_radius = outer_diam / 2.0\r\n delta_radius = max_radius - min_radius\r\n \r\n if (depth == nil)\r\n depth = mill.cut_depth\r\n end #if\r\n\r\n # have to allow bit radius on\r\n # both sides of the cutting tool\r\n # for cutting tool compensation\r\n\r\n adjusted_channel_width = channel_width - mill.bit_radius\r\n if adjusted_channel_width < mill.bit_diam\r\n # our channel can not be less than\r\n # one bit thick\r\n adjusted_channel_width = mill.bit_diam\r\n end #if\r\n\r\n channel_start_max_radius = (min_radius + channel_width) - mill.bit_radius\r\n\r\n no_passes = (adjusted_channel_width / cut_inc) + 1.0\r\n usage_per_circle = (channel_width + wall_thick) * 1.05\r\n increase_per_degree = usage_per_circle / 360\r\n\r\n #print \"(mill_spiral no_passes=\", no_passes, \" usage_per_circle = \", usage_per_circle, \" increase per degree=\", increase_per_degree, \" min_radius=\", min_radius, \" max_radius=\", max_radius, \" cut_inc = \", cut_inc,\" tool adjusted channel_width=\", adjusted_channel_width, \")\\n\"\r\n\r\n pass_beg_radius = min_radius + mill.bit_radius\r\n pass_max_radius = (max_radius - channel_width) + mill.bit_radius\r\n\r\n\r\n\r\n passcnt = 0\r\n while (true)\r\n # one pass here for each width\r\n # of the bit we need to make\r\n curr_radius = pass_beg_radius\r\n deg = 0.0\r\n\r\n # Move the head to start of the spiral\r\n mill.retract()\r\n first_point = calc_point_from_angle(cent_x, cent_y, deg, curr_radius)\r\n mill.move(first_point.x, first_point.y)\r\n mill.plung(depth)\r\n\r\n while curr_radius <= pass_max_radius\r\n # mill a single pass of the \r\n # spiral\r\n aPoint = calc_point_from_angle(cent_x, cent_y, deg, curr_radius)\r\n mill.move(aPoint.x, aPoint.y)\r\n curr_radius += increase_per_degree\r\n deg += 1.0\r\n if (deg >= 360)\r\n deg = 0\r\n end #if\r\n\r\n end #while\r\n if (pass_beg_radius >= channel_start_max_radius)\r\n # our last pass was our final\r\n # for the specified channel width\r\n break\r\n elsif (pass_beg_radius + cut_inc) > channel_start_max_radius\r\n # one more cut increment will put us over the\r\n # the max channel width so we adjust the cut_inc\r\n # down so the last pass takes off just enough\r\n cut_inc = channel_start_max_radius - pass_beg_radius\r\n end #if\r\n pass_beg_radius += cut_inc\r\n pass_max_radius += cut_inc\r\n end # for\r\nend",
"def circle(n)\r\n lines = []\r\n half_grid = n / 2\r\n top_stars = half_grid.even? ? half_grid - 1 : half_grid\r\n\r\n spaces_between_stars = top_stars\r\n loop do\r\n lines << ('*' +\r\n ' ' * spaces_between_stars +\r\n '*').center(n)\r\n\r\n spaces_between_stars += 2\r\n break if spaces_between_stars == n - 2\r\n end\r\n\r\n top_bottom = ('*' * top_stars).center(n)\r\n\r\n puts top_bottom\r\n puts lines\r\n (top_stars).times do\r\n puts ('*' + ' ' * (n - 2) + '*').center(n)\r\n end\r\n puts lines.reverse\r\n puts top_bottom\r\nend",
"def pentagon_surface(in_edge_length)\n check_pre(((in_edge_length.numeric?) and (in_edge_length >= 0)))\n return ((in_edge_length ** 2) / 4.0) * CONSTANT\nend",
"def find_each_path_rectangle\n paths = []\n\n iterate_over_each_character_in_array_of_lines(@map_in_lines) do |y, x|\n c = @map_in_lines[y][x]\n\n next if c == '.'\n\n if above(y, x) == '.' and left(y, x) == '.'\n paths.push([])\n paths.last.push([y,x])\n\n until below(y, x) == '.' and left(y, x) == '.'\n y += 1\n end\n\n until below(y, x) == '.' and right(y, x) == '.'\n x += 1\n end\n\n paths.last.push([y, x])\n end\n end\n\n paths\n end",
"def calculate_path(from, to)\n if @color == :white && !@moved\n case to\n when [7,1]\n return horizontal_move(from, [8,1])\n when [3,1]\n return horizontal_move(from, [1,1])\n end\n elsif @color == :black && !@moved\n case to\n when [7,8]\n return horizontal_move(from, [8,8])\n when [3,8]\n return horizontal_move(from, [1,8])\n end\n end\n\n if ((from[0] - to[0]).abs > 1) || ((from[1] - to[1]).abs > 1)\n false\n else\n []\n end\n end",
"def attach_npc_positions_to_path_arrays\n paths = find_each_path_rectangle\n\n iterate_over_each_character_in_array_of_lines(@map_in_lines) do |y, x|\n c = @map_in_lines[y][x]\n\n next if c == '.' or c == 'p'\n\n if c == 'N'\n paths.each do |e|\n if y >= e[0][0] and y <= e[1][0]\n if x >= e[0][1] and x <= e[1][1]\n e.push([y, x])\n end\n end\n end\n end\n end\n\n @paths = paths\n end",
"def drawSolidLine(x0,y0,x1,y1,thickness=1,color=\"black\") ;\n @device.drawSolidLine(x0,y0,x1,y1,thickness,color) ;\n end",
"def path_to(x:, y:)\n x_signal = x / [x.abs, 1].max\n y_signal = y / [y.abs, 1].max\n\n if x.abs > y.abs\n [[1 * x_signal, 0]]\n elsif x.zero? && y.zero?\n [[0, 0]]\n else\n [[0, 1 * y_signal]]\n end\n end",
"def draw_line(grids, length)\n grid(grids[0], grids[1]).bounding_box() do\n stroke_horizontal_line 0, 470*length, at: 5\n end\n end",
"def mill_out_air_entrance(mill, pCent_x, pCent_y, pMin_radius, pMax_radius, pNum_holes, pBeg_z, pEnd_z, pSpoke_angle, pSpoke_width=0.1)\r\n # # # # # # # # #\r\n # Mill out center holes as large as possible\r\n # without comprimising strength\r\n # # # # # # # # # \r\n degrees_per_hole = 360 / pNum_holes\r\n \r\n \r\n pMin_radius += mill.bit_radius\r\n pMax_radius -= mill.bit_radius\r\n \r\n if (pMax_radius < pMin_radius)\r\n pMax_radius = pMin_radius\r\n end\r\n \r\n \r\n #print \"(pNum_holes=\", pNum_holes, \")\\n\"\r\n #print \"(degrees_per_hole=\", degrees_per_hole, \")\\n\"\r\n #print \"(pMin_radius=\", pMin_radius, \")\\n\"\r\n #print \"( pMax_radius=\", pMax_radius, \"\\n\"\r\n \r\n bit_radius_degree_inner = degrees_for_distance(pMin_radius, mill.bit_radius)\r\n \r\n bit_radius_degree_outer = degrees_for_distance(pMax_radius, mill.bit_radius)\r\n \r\n inner_bit_and_spoke_degree = degrees_for_distance(pMin_radius, (mill.bit_radius * 2 + pSpoke_width))\r\n outer_bit_and_spoke_degree = degrees_for_distance(pMax_radius, (mill.bit_radius * 3 + pSpoke_width))* 1.05\r\n \r\n usable_inner_degrees = degrees_per_hole - inner_bit_and_spoke_degree\r\n #print \"(inner_bit_and_spoke_degree=\", inner_bit_and_spoke_degree, \")\\n\"\r\n #print \"(usable_inner_degrees=\", usable_inner_degrees, \")\\n\"\r\n \r\n if (usable_inner_degrees < 0)\r\n usable_inner_degrees = 0\r\n end\r\n \r\n usable_outer_degree = degrees_per_hole - outer_bit_and_spoke_degree\r\n #print \"(outer_bit_and_spoke_degree=\", outer_bit_and_spoke_degree, \")\\n\"\r\n #print \"(usable_outer_degree=\", usable_outer_degree, \")\\n\"\r\n\r\n if (usable_outer_degree < 0)\r\n usable_outer_degree = 0\r\n end\r\n \r\n if (usable_inner_degrees < 0)\r\n usable_inner_degrees = 0\r\n end\r\n \r\n #print \"(inner_bit_and_spoke_degree=\", inner_bit_and_spoke_degree, \")\\n\"\r\n \r\n \r\n beg_degree = 0\r\n for hole_num in (1..pNum_holes)\r\n mill.retract()\r\n \r\n \r\n end_inner_degree = (beg_degree + usable_inner_degrees)\r\n \r\n end_out_degree = (beg_degree + usable_outer_degree + pSpoke_angle)\r\n \r\n #print \"(beg_degree =\", beg_degree, \" end_inner_degree = \", end_inner_degree, \" end_out_degree=\", end_out_degree, \")\\n\"\r\n \r\n mill_fan_pocket(mill = aMill,\r\n cent_x = pCent_x,\r\n cent_y = pCent_y,\r\n in_radius = pMin_radius,\r\n in_beg_deg=beg_degree + bit_radius_degree_inner, \r\n in_end_deg=end_inner_degree, \r\n out_raius=pMax_radius,\r\n out_beg_deg=beg_degree + pSpoke_angle + bit_radius_degree_inner,\r\n out_end_deg=end_out_degree, \r\n pBeg_z = 0,\r\n pEnd_z= pEnd_z) \r\n \r\n aMill.retract() \r\n \r\n beg_degree += degrees_per_hole \r\n \r\n end #for\r\n aMill.retract() \r\n end",
"def draw_part(pts)\r\n\r\n # Draw holes\r\n for i in 0..(pts.length-1)\r\n draw_circle(pts[i], $normVec, $holeRadius)\r\n end\r\n \r\n # Loop through points\r\n for i in 0..(pts.length-1)\r\n \r\n # Get adjacent points\r\n adjPts = GetAdjacentPts(pts, i)\r\n \r\n # Compute start and end angles\r\n sAngle = angle_between_point_xy([adjPts[0],adjPts[1]])\r\n eAngle = angle_between_point_xy([adjPts[1],adjPts[2]])\r\n \r\n # Make adjustments\r\n sAngle = sAngle - 0.5\r\n eAngle = eAngle - 0.5\r\n if(eAngle < sAngle) \r\n eAngle = eAngle + 2 \r\n end\r\n\r\n # Draw curves\r\n draw_curve(adjPts[1], $normVec, $xaxis, $outerRadius, sAngle * Math::PI, eAngle * Math::PI)\r\n\r\n # Draw lines \r\n draw_line(add_outer_radius(adjPts[0],$outerRadius,sAngle),add_outer_radius(adjPts[1],$outerRadius,sAngle))\r\n \r\n end\r\n \r\nend",
"def print_employee_graphics_box(box)\n\n # Horizontal lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n self.line_width = 0.01.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n self.line_width = 0.02.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.125.in\n stroke_line([x, y], [x + 1.25.in, y])\n y -= 0.125.in\n self.line_width = 0.01.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n\n # Vertical lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n stroke_line([x, y], [x, y - 4.75.in])\n stroke_line([x + 2.6.in, y], [x + 2.6.in, y - 0.25.in])\n stroke_line([x + 3.75.in, y], [x + 3.75.in, y - 4.75.in])\n self.line_width = 0.02.in\n y -= 0.25.in\n stroke_line([x, y], [x, y - 0.375.in])\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n stroke_line([x + 3.75.in, y], [x + 3.75.in, y - 0.25.in])\n y -= 0.25.in\n self.line_width = 0.01.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 0.125.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n y -= 0.125.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 2.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.5.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 1.25.in])\n y -= 0.5.in\n stroke_line([x + 1.in, y], [x + 1.in, y - 0.75.in])\n y -= 0.75.in\n stroke_line([x + 0.3.in, y], [x + 0.3.in, y - 0.25.in])\n stroke_line([x + 1.4.in, y], [x + 1.4.in, y - 0.375.in])\n stroke_line([x + 2.6.in, y], [x + 2.6.in, y - 0.375.in])\n y -= 0.375.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.375.in])\n\n # Text (top to bottom, left to right).\n x = box[:x]\n y = box[:y]\n self.vms_text_box(box[:title], x + 0.1, y, 2.4, 0.25, 7, :bold, :left, :center, nil, 'ff0000')\n self.vms_text_box(\"41-0852411\\nOMB No. 1545-0008\", x + 2.6, y, 1.15, 0.25, 6, :normal, :center, :center)\n y -= 0.25\n self.vms_text_box(\"<strong>a</strong> Employee's soc. sec. no.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>1</strong> Wages, tips, other comp.\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>2</strong> Federal income tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>3</strong> Social security wages\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>4</strong> Social security tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>b</strong> Employer ID number (EIN)\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>5</strong> Medicare wages and tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>6</strong> Medicare tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>c</strong> Employer's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>d</strong> Control number\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>e</strong> Employee's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"Suff.\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :right, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>7</strong> Social security tips\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>8</strong> Allocated tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>9</strong> Verification code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>10</strong> Dependent care benefits\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>11</strong> Nonqualified plans\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12a</strong> Code (See inst. for box 12)\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>13</strong> Statutory employee\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>14</strong> Other\", x + 1.05, y - 0.02, 1.4, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12b</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Retirement plan\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12c</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Third-party sick pay\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12d</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.5\n self.vms_text_box(\"<strong>15</strong> State Employer's ID Number\", x + 0.05, y - 0.02, 1.3, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>16</strong> State wages, tips, etc.\", x + 1.45, y - 0.02, 1.1, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>17</strong> State income tax\", x + 2.65, y - 0.02, 1.05, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>18</strong> Local wages, tips, etc.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>19</strong> Local income tax\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>20</strong> Locality name\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.375\n self.vms_text_box(\"2018\", x, y - 0.02, 3.75, 0.25, 8, :bold, :center, :top, nil, 'ff0000')\n self.vms_text_box(\"Form W-2 Wage and Tax Statement\", x, y - 0.04, 3.75, 0.125, 6, :bold, :left, :top, nil, 'ff0000')\n self.vms_text_box(\"Dept. of the Treasury -- IRS\", x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n y -= box[:bottom_left_offset]\n self.vms_text_box(box[:bottom_left], x, y - 0.04, 3.75, box[:bottom_left_height], 6, :normal, :left, :top)\n y -= box[:bottom_right_offset]\n self.vms_text_box(box[:bottom_right], x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n\n end",
"def get_polyline_on_edges(p_hash)\n # initialize with the given hash\n hcl = p_hash [\"hexagone_depart\"].split(';')\n hexagon = hn_from_hcl(hcl.first.to_i, hcl.last.to_i) \n vertex = p_hash [\"angle_depart\"]\n directions = Service.uncompressed_directions(p_hash [\"liste_directions\"])\n # provide the beginning of the polyline\n polyline_points = \"#{x_vertex(hexagon, vertex.swapcase.intern)},#{y_vertex(hexagon, vertex.swapcase.intern)} \"\n # for each direction, find the new hexagon and vertex, then provide the next set of coordinates\n directions.split(',').each do |direction|\n case direction + vertex\n when \"NN\", \"NONE\" then hexagon = adjacent(hexagon, :ne) \n when \"NENE\", \"NSE\" then hexagon = adjacent(hexagon, :e) \n when \"NES\", \"SESE\" then hexagon = adjacent(hexagon, :se) \n when \"SS\", \"SESO\" then hexagon = adjacent(hexagon, :so) \n when \"SNO\", \"SOSO\" then hexagon = adjacent(hexagon, :o) \n when \"SON\", \"NONO\" then hexagon = adjacent(hexagon, :no)\n end \n vertex = case direction\n when \"N\" then \"NO\" \n when \"NE\" then \"N\" \n when \"SE\" then \"NE\" \n when \"S\" then \"SE\" \n when \"SO\" then \"S\" \n when \"NO\" then \"SO\"\n end \n polyline_points << \"#{x_vertex(hexagon, vertex.swapcase.intern)},#{y_vertex(hexagon, vertex.swapcase.intern)} \"\n end\n # and return the string of coordinates\n return polyline_points.chop\n end",
"def line(x0, y0, x1, y1)\n # clean params\n x0, y0, x1, y1 = x0.to_i, y0.to_i, x1.to_i, y1.to_i\n y0, y1, x0, x1 = y1, y0, x1, x0 if y0>y1\n sx = (dx = x1-x0) < 0 ? -1 : 1 ; dx *= sx ; dy = y1-y0\n\n # special cases\n x0.step(x1,sx) { |x| point x, y0 } and return if dy.zero?\n y0.upto(y1) { |y| point x0, y } and return if dx.zero?\n x0.step(x1,sx) { |x| point x, y0; y0 += 1 } and return if dx==dy\n\n # main loops\n point x0, y0\n\n e_acc = 0\n if dy > dx\n e = (dx << 16) / dy\n y0.upto(y1-1) do\n e_acc_temp, e_acc = e_acc, (e_acc + e) & 0xFFFF\n x0 += sx if (e_acc <= e_acc_temp)\n point x0, (y0 += 1), intensity(@color,(w=0xFF-(e_acc >> 8)))\n point x0+sx, y0, intensity(@color,(0xFF-w))\n end\n point x1, y1\n return\n end\n\n e = (dy << 16) / dx\n x0.step(x1-sx,sx) do\n e_acc_temp, e_acc = e_acc, (e_acc + e) & 0xFFFF\n y0 += 1 if (e_acc <= e_acc_temp)\n point (x0 += sx), y0, intensity(@color,(w=0xFF-(e_acc >> 8)))\n point x0, y0+1, intensity(@color,(0xFF-w))\n end\n point x1, y1\n end",
"def cardinal_paths(direction)\n off_gen = CardinalOffsetGenerator.new(coordinates, direction)\n off_gen.moves\n end",
"def get_move_path(start_cell, end_cell)\n start_coordinates = board.chess_notation_to_coordinates(start_cell)\n end_coordinates = board.chess_notation_to_coordinates(end_cell)\n start_y, start_x = start_coordinates[0], start_coordinates[1]\n end_y, end_x = end_coordinates[0], end_coordinates[1]\n path = []\n\n if horizonal_move?(start_cell, end_cell)\n path = build_horizonal_path(start_y, start_x, end_y, end_x)\n elsif vertical_move?(start_cell, end_cell)\n path = build_vertical_path(start_y, start_x, end_y, end_x)\n else\n path = build_diagonal_path(start_y, start_x, end_y, end_x)\n end\n\n path.map { |coordinates| board.coordinates_to_chess_notation(coordinates) }\n end",
"def line x0, y0, x1, y1, c\n dx = (x1 - x0).abs\n sx = x0 < x1 ? 1 : -1\n dy = (y1 - y0).abs\n sy = y0 < y1 ? 1 : -1\n err = (dx > dy ? dx : -dy) / 2\n \n loop do\n set x0, y0, c\n break if x0 === x1 && y0 === y1\n e2 = err\n if e2 > -dx\n err -= dy\n x0 += sx\n end \n if e2 < dy\n err += dx\n y0 += sy \n end\n end \n end",
"def to_s\n # Special handling: print the top line.\n buffer = @width.times.inject(\"+\") {|str, x| str << (x == @start_x ? \" +\" : \"---+\")} + \"\\n\"\n \n # For each cell, print the right and bottom wall, if it exists.\n @height.times do |y|\n line = @width.times.inject(\"|\") do |str, x|\n str << (@path[x][y] ? \" * \" : \" \") << (@vertical_walls[x][y] ? \"|\" : \" \")\n end\n buffer << line + \"\\n\"\n \n buffer << @width.times.inject(\"+\") {|str, x| str << (@horizontal_walls[x][y] ? \"---+\" : \" +\")} + \"\\n\"\n end\n buffer\n end",
"def draw_line_markers\n return if @hide_line_markers\n\n\n # have to do this here (AGAIN)... see draw() in this class\n # because this funtion is called before the @radius, @center_x and @center_y are set\n @radius = @graph_height / 2.0\n @center_x = @graph_left + (@graph_width / 2.0)\n @center_y = @graph_top + (@graph_height / 2.0) - 10 # Move graph up a bit\n\n\n # Draw horizontal line markers and annotate with numbers\n @d = @d.stroke(@marker_color)\n @d = @d.stroke_width 1\n\n\n (0..@column_count-1).each do |index|\n rad_pos = index * Math::PI * 2 / @column_count\n\n @d = @d.line(@center_x, @center_y, @center_x + Math::sin(rad_pos) * @radius, @center_y - Math::cos(rad_pos) * @radius)\n\n\n marker_label = labels[index] ? labels[index].to_s : '000'\n\n draw_label(@center_x, @center_y, rad_pos * 360 / (2 * Math::PI), @radius, marker_label)\n end\n end",
"def dividing_line; end",
"def linelength(roundsign = 0)\n ll = Math.sqrt(((@point_two.x - @point_one.x)**2) + ((@point_two.y - @point_one.y)**2))\n roundsign.zero? ? ll : format(\"%.#{roundsign}f\", ll)\n end",
"def get_polyline_across_edges(p_hash)\n # initialize with the given hash\n hcl = p_hash [\"hexagone_depart\"].split(';')\n hexagon = hn_from_hcl(hcl.first.to_i, hcl.last.to_i) \n directions = Service.uncompressed_directions(p_hash [\"liste_directions\"])\n # provide the beginning of the polyline\n polyline_points = \"#{x_center(hexagon)},#{y_center(hexagon)} \"\n # for each direction, find the new hexagon then provide the next set of coordinates\n directions.split(',').each do |direction|\n hexagon = adjacent(hexagon, direction.swapcase.intern) \n polyline_points << \"#{x_center(hexagon)},#{y_center(hexagon)} \"\n end\n # and return the string of coordinates\n return polyline_points.chop\n end",
"def hollow_diamond(int)\n spaces = 1\n puts '*'.center(int)\n \n 1.upto(int - 4) do |line|\n puts ('*' + ' ' * spaces + '*').center(int)\n line > (int / 2 - 2) ? spaces -= 2 : spaces += 2\n end\n \n puts '*'.center(int)\nend",
"def draw_line(x1,y1,x2,y2,r,g,b,graph_function=false)\r\n if ( @line_dot_size > 1 )\n self.draw_dotted_line(x1,y1,x2,y2,@line_dot_size,r,g,b,graph_function)\n else\n r = 0 if ( r < 0 ) \n r = 255 if ( r > 255 ) \r\n g = 0 if ( g < 0 ) \n g = 255 if ( g > 255 ) \r\n b = 0 if ( b < 0 ) \n b = 255 if ( b > 255 ) \r\n distance = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) \r\n if ( distance == 0 )\r\n #return -1\n else \r\n xstep = (x2-x1) / distance\r\n ystep = (y2-y1) / distance\r\n i =0\n while i<=distance \r\n x = i * xstep + x1\r\n y = i * ystep + y1\r\n if((x >= @garea_x1 && x <= @garea_x2&& y >= @garea_y1 && y <= @garea_y2) || !graph_function )\r\n if ( @line_width == 1 )\r\n self.draw_antialias_pixel(x,y,r,g,b)\n else\r\n start_offset = -(@line_width/2) \n end_offset = (@line_width/2)\n j = start_offset\n while j<=end_offset\n self.draw_antialias_pixel(x+j,y+j,r,g,b)\n end \r\n end\r\n end\n i =i+1\r\n end\n end \n end \r\n end",
"def circle_side_edge(radius, side_number)\n angle = (DEGREES_PER_STEP * side_number).gosu_to_radians\n CP::Vec2.new(radius, 0).rotate(CP::Vec2.for_angle(angle))\n end",
"def shifted_horizontal_line y\n line = { x: grid.width + 1, y: y, w: grid.width, h: 0 }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def drawDashedLine(x0,y0,x1,y1,thickness=1,color=\"grey\") ;\n @device.drawDashedLine(x0,y0,x1,y1,thickness,color) ;\n end",
"def horizontal_swath_edges(coord, ascending)\n # Candidate solutions. We may end up finding more points than we need.\n # Before returning, we'll take the two points closest to the given\n # coordinate\n candidates = []\n\n # We need to be able to assume the coordinate isn't on the equator, so\n # we'll return early if we find that it is. We know the swath width\n # from the orbit parameters. This calculation is slightly off, since\n # the swath width is measured perpendicular to the orbit, but the\n # Java code makes this assumption. This case should almost never\n # happen. When it does, the numbers are likely close enough.\n\n if coord.phi.abs <= EPSILON\n return [Coordinate.phi_theta(0, coord.theta - swath_width_rad / 2),\n Coordinate.phi_theta(0, coord.theta + swath_width_rad / 2)]\n end\n\n # We ignore the rotation of the Earth for the purposes of this method.\n # The values we return (the swath edges) are not influenced by the\n # Earth's rotation. Intermediate values are, but they're not visible\n # outside of this method.\n #\n # Ignoring the rotation of the Earth, we can imagine three circles\n # traced by the orbit. The first is the path on the ground directly\n # beneath the orbit. This is a great circle whose center is the origin.\n # The other two are the paths traced by the swath edges, which are not\n # great circles and not centered at the origin.\n #\n # These three circles each lie in a plane, and the three planes are\n # parallel to each other.\n #\n # There's another circle we're interested in, which is the circle\n # traced by the latitude line at coord. This circle lies in its own\n # plane which is not parallel to the other three.\n #\n # The four original circles are the intersections of their respective\n # planes and the sphere of the Earth.\n #\n # So, to find the swath's edge coordinates, we need to find the\n # intersection between three things:\n #\n # 1. `x^2 + y^2 + z^2 = 1`\n #\n # The sphere of the Earth. We've scaled everything so the Earth\n # has radius 1, and it's centered on the origin. Convenient.\n #\n # 2. `ax + by + cz = d`\n #\n # The swath's plane. `a`, `b`, `c` and `d` are constants which\n # we'll calculate. Since they're parallel, the swath edges share\n # `a`, `b`, and `c` with the orbital plane, but each edge has a\n # different `d` value.\n #\n # 3. `z = \"coord.z\"`\n #\n # The plane slicing through latitude = coord.lat\n\n # We already know z\n\n z = coord.z\n\n # We'll find `a`, `b`, and `c` for the orbit's plane, which are the same\n # constants for the swath's plane. To find them, we need 3 non-colinear\n # points in the orbit's plane. The origin is one, but we need two more.\n\n # First, we'll get a point that the orbit can pass over which is close\n # to coord. Usually we'll just use coord, but if coord's latitude is\n # above the orbit's inflection point, we need to find a point with a\n # lower latitude\n\n target_phi = coord.phi\n target_phi = max_orbit_phi if target_phi > max_orbit_phi\n target_phi = min_orbit_phi if target_phi < min_orbit_phi\n target = Coordinate.phi_theta(target_phi, coord.theta)\n\n # For the second point, we'll use the equatorial crossing of the orbit\n # through the target. This is safe, because we bailed earlier if\n # the target was on the equator. The \"false\" parameter tells the method\n # to ignore the Earth's rotation.\n\n cross = equator_crossing(target, ascending, false)\n\n # For a plane passing through the origin, `ax + by + cz = 0`. With our\n # two other points, we can solve for `a`, `b`, and `c`:\n\n a = target.y * cross.z - target.z * cross.y\n b = target.z * cross.x - target.x * cross.z\n c = target.x * cross.y - target.y * cross.x\n\n # If we can find a point on the swath edge, we can calculate `d`. We\n # can find a point on each edge by finding the orbit's inflection point\n # and adding/subtracting half the swath width from its latitude.\n\n inf = Coordinate.phi_theta(-inclination_rad, cross.theta - PI / 2)\n\n # Calculate solutions for the point p on each swath edge\n\n [Coordinate.phi_theta(inf.phi + swath_width_rad / 2, inf.theta),\n Coordinate.phi_theta(inf.phi - swath_width_rad / 2, inf.theta)].each do |p|\n\n # Calculate `d` from the plane equation\n\n d = a * p.x + b * p.y + c * p.z\n\n # The fact that `z` is constant is very handy. It means we really only\n # care about two dimensions. We're really trying to find the intersection\n # of a line (the edge's plane when `z = \"coord.z\"`) and a circle (the part\n # of the Earth intersecting `z = \"coord.z\"`).\n #\n # Note: that simplified math could make it easier to switch this\n # algorithm to use an ellipsoidal Earth (WGS84) in the future, since we\n # would just be intersecting a line with a slightly different circle.\n #\n # The swath plane's equation is:\n #\n # `ax + by + cz = d`\n #\n # `a`, `b`, `c`, `d`, and `z` are all known at this point, so we just\n # need to figure out `x` and `y`. Solve the equation for `y`\n #\n # `y = -a/b x + (d - cz) / b`\n #\n # Which is the line we need to intersect with the latitude circle.\n\n # We can't just compute constants for the line, because `b` could be near 0.\n # Let's deal with that special case first.\n\n if b.abs < 0.000001\n\n # If `b = 0`, then the plane's equation is:\n #\n # `ax + 0y + cz = d`\n #\n # Solving for `x`:\n #\n # `x = (d - cz) / a`\n\n # Ok, another problem. It's possible that both `a` and `b` are 0. In that\n # case, we have an orbit that follows the equator. If coord lies within the\n # swath, then every orbit will cover the point, otherwise no orbits will.\n\n if a.abs < 0.000001\n if coord.phi.abs < swath_width_rad / 2\n return [Coordinate.phi_theta(0, -PI), Coordinate.phi_theta(0, PI)]\n else\n return []\n end\n end\n\n # Now we can handle the case where `b` is 0 and `a` isn't\n\n x = (d - c * z) / a\n\n # We now know `x` and `z`, so we can use the sphere equation to solve for `y`.\n #\n # `y = +- sqrt(1 - z^2 - x^2)`\n #\n # In this case, `1 - z^2 - x^2` could be negative. This would indicate\n # that the latitude does not intersect the swath edge. Perhaps the point is\n # completely above one swath edge but below the other. We won't worry\n # about duplicate solutions (`y = +- 0`), since the LongitudeCoverage\n # class will combine them correctly.\n\n dis = 1 - z**2 - x**2\n\n if dis >= 0\n y = sqrt(dis)\n candidates << Coordinate.xyz(x, y, z)\n candidates << Coordinate.xyz(x, -y, z)\n end\n\n # Now the case when b is not 0.\n else\n # Recall, the line's equation is:\n #\n # `y = -a/b x + (d - cz) / b`\n #\n # We'll call those constants `m` and `k`\n\n m = -a / b\n k = (d - c * z) / b\n\n # Which means\n #\n # `y = mx + k`\n #\n # (We won't use the standard `b` as the `y`-intercept name, since\n # it means something different in the plane equation).\n\n # We need to find the intersection of that line with the latitude\n # circle at `z = \"coord.z\"`. Using the sphere equation with a\n # constant z, we get the latitude circle's equation:\n #\n # `x^2 + y^2 = 1 - z^2`\n\n # It's centered at the origin. `1 - z^2` is the radius squared.\n #\n # Taking the square root is safe because we calculated z from a\n # lat/lon coordinate. Further, a negative radius doesn't make sense.\n\n r = sqrt(1 - z**2)\n\n # So,\n #\n # `x^2 + y^2 = r^2`\n #\n # Substituting `y` with the value from our line equation:\n #\n # `x^2 + (mx + k)^2 = r^2`\n #\n # Multiplying out, we get:\n #\n # `x^2 + m^2x^2 + 2mkx + k^2 = r^2`\n\n # Grouping constants, we get:\n #\n # `(m^2 + 1)x^2 + (2mk)x + (k^2 - r^2) = 0`\n #\n # We call those constants `a_q`, `b_q`, and `c_q`\n\n a_q = m**2 + 1\n b_q = 2 * m * k\n c_q = k**2 - r**2\n\n # So:\n #\n # `a_q x^2 + b_qx + c_q = 0`\n\n # We can solve this using the quadratic equation:\n #\n # `x = (-b +- sqrt(b^2 - 4ac)) / (2a)`\n\n discriminant = b_q**2 - 4 * a_q * c_q\n\n # The discriminant could be negative if the line and circle do\n # not intersect\n if discriminant >= 0\n # There are two possible `x` values\n [(-b_q + sqrt(discriminant)) / (2*a_q),\n (-b_q - sqrt(discriminant)) / (2*a_q)].each do |x2|\n # Now we need `y`\n y = m * x2 + k\n\n candidates << Coordinate.xyz(x2, y, z)\n end\n end\n end\n end\n\n # Return if we haven't found any valid points\n return [] if candidates.empty?\n\n # At this point, we have either 2 or 4 candidate points that are swath\n # edge intersections with the target latitude. Now we need to find\n # the two that are closest to the coordinate the caller passed. We\n # want them in west-to-east order to make things simpler for the caller.\n\n # Find the index of the first candidate to the east of the target\n candidates.sort_by!(&:theta)\n east_index = candidates.find_index { |c2| coord.theta < c2.theta }\n\n # Handle wrapping around the date line\n east_index = 0 if east_index.nil?\n\n # The west index is the one to the left of the east index, wrapping around\n # the date line if needed\n west_index = (east_index - 1) % candidates.size\n\n west_edge = candidates[west_index]\n east_edge = candidates[east_index]\n\n # There is a special case here. If we only found two candidates, that\n # indicates that the point is above one swath edge, but below the other,\n # which happens at latitudes near the inflection point.\n #\n # This method returns swath edges for either the ascending or descending\n # pass, not both. If both of our candidates are on the same edge, then\n # one is seen on the ascending pass and the other on the descending. We\n # solve this problem by moving one edge point to the inflection longitude.\n #\n # Note: the rest of this method will produce the same results regardless\n # of the value of \"ascending.\" Factoring this out could slightly\n # improve performance.\n\n xprod = target * cross\n north_hemisphere = coord.phi > 0\n if candidates.size == 2\n inf_theta = north_hemisphere ? inf.theta + PI : inf.theta\n inflection = Coordinate.phi_theta(coord.phi, inf_theta)\n if north_hemisphere && retrograde? == ascending ||\n !north_hemisphere && retrograde? != ascending\n west_edge = inflection\n else\n east_edge = inflection\n end\n end\n\n # Return the edges\n [west_edge, east_edge]\n end",
"def y_vertex(p_hn, p_v)\n case p_v\n when :n then return yp_from_hn(p_hn)\n when :ne, :no then return yp_from_hn(p_hn) + th\n when :s then return yp_from_hn(p_hn) + fh\n else return yp_from_hn(p_hn) + th + hex_side_length \n end \n end",
"def line(xx1, yy1, xx2, yy2)\n return \"some y out of range\" unless (0..@height).include?(yy1) && (0..@height).include?(yy2) \n return \"some x out of range\" unless (0..@width).include?(xx1) && (0..@width).include?(xx2)\n\n x1 = [xx1, xx2].min\n x2 = [xx1, xx2].max\n y1 = [yy1, yy2].min\n y2 = [yy1, yy2].max\n\n m = (y2.to_f - y1) / (x2 - x1)\n b = y2 - m * x2\n pixels = Array.new(@width, Array.new(@height, 0))\n\n (x1..x2).each do |x|\n column = Array.new(@height, 0)\n (y1..y2).each do |y|\n pixel = 0\n @density.times do |i|\n xx = (x + i.to_f / @density)\n yy = m * xx + b\n if yy >= y && yy < y + 1\n pixel = 1\n break\n end\n end\n column[y] = pixel\n end\n pixels[x] = column\n end\n\n PNM.create(pixels.transpose, {:type => :pbm})\n end",
"def two_empty_in_line(marker)\n initial = Square::INITIAL_MARKER\n check_lines_for_constellation(marker, initial, initial)\n end",
"def path(k)\n x = k\n y = 1 - k\n path = []\n direction = 1\n (k*8).times do |i|\n path.push(x.to_s + ';' + y.to_s)\n if direction == 1\n y += 1\n direction = 2 if y == k\n elsif direction == 2\n x -= 1\n direction = 3 if x * (-1) == k\n elsif direction == 3\n y -= 1\n direction = 4 if y * (-1) == k\n elsif direction == 4\n x += 1\n end\n end\n path\nend",
"def do_part2(lines)\n map, _, end_loc = map_from(lines)\n remove_inaccessible_cells(map, end_loc)\n paths = []\n map.height.times do |row|\n map.width.times do |col|\n paths << a_star(map, [row, col], end_loc) if map.at(row, col) == 0\n end\n end\n\n paths.compact.map(&:length).min\n end",
"def draw_line(x1,y1,x2,y2,r,g,b,graph_function=false)\n if ( @line_dot_size > 1 )\n self.draw_dotted_line(x1,y1,x2,y2,@line_dot_size,r,g,b,graph_function)\n else\n r = 0 if ( r < 0 )\n r = 255 if ( r > 255 )\n g = 0 if ( g < 0 )\n g = 255 if ( g > 255 )\n b = 0 if ( b < 0 )\n b = 255 if ( b > 255 )\n distance = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))\n if ( distance == 0 )\n #return -1\n else\n xstep = (x2-x1) / distance\n ystep = (y2-y1) / distance\n i =0\n while i<=distance\n x = i * xstep + x1\n y = i * ystep + y1\n if((x >= @g_area_x1 && x <= @g_area_x2&& y >= @g_area_y1 && y <= @g_area_y2) || !graph_function )\n if ( @line_width == 1 )\n self.draw_antialias_pixel(x,y,r,g,b)\n else\n start_offset = -(@line_width/2)\n end_offset = (@line_width/2)\n j = start_offset\n while j<=end_offset\n self.draw_antialias_pixel(x+j,y+j,r,g,b)\n end\n end\n end\n i =i+1\n end\n end\n end\n end",
"def polygon (sides, length)\n sides.times do\n line length\n turn (360.0/sides).degrees\n end\n end",
"def lineto(x, y)\n CGContextAddLineToPoint(@ctx ,x, y)\n end",
"def sroke_line_width\n y = 250\n 3.times do |i|\n case i\n # when 0 then line_width = 10 # This call will have no effect\n when 1 then self.line_width = 10\n when 2 then self.line_width = 25\n end\n stroke do\n horizontal_line 50, 150, at: y\n rectangle [275, y + 25], 50, 50\n circle [500, y], 25\n end\n y -= 100\n end\n end",
"def get_edge_corner_dis\n top_left = [self.x - self.ox, self.y - self.oy]\n bot_right = [top_left[0] + self.width, top_left[1] + self.height]\n return [top_left, bot_right]\n end",
"def find_path(start_node, end_node, grid)\n start_node = sanitize(start_node)\n end_node = sanitize(end_node)\n if grid.nil?\n [start_node]\n else\n _max_x = grid.max_x\n _max_y = grid.max_y\n\n @current_grid = grid.inner_grid.clone\n\n raise 'max_x & max_y required' unless _max_x && _max_y\n\n _start_node = start_node.clone\n _end_node = end_node.clone\n\n heuristic = @heuristic.new(_end_node, @weight)\n\n _start_node[:f] = 0 # sum of g and h\n _start_node[:g] = 0 # steps to start node\n _start_node[:h] = nil # steps to end node\n _start_node[:opened] = true\n\n # use heap or tree for better perf\n open = []\n open.push _start_node\n\n while !open.empty? do\n _current_node = open.pop\n\n _current_node[:closed] = true\n @current_grid[node_to_a(_current_node)] = _current_node\n\n if node_to_a(_current_node) == node_to_a(_end_node)\n return final_path(_current_node)\n end\n\n new_g = _current_node[:g] + 1\n\n x = _current_node[:x]\n y = _current_node[:y]\n\n neighbors = []\n\n neighbors << [x-1, y] if x > 0\n neighbors << [x, y-1] if y > 0\n neighbors << [x+1, y] if x < _max_x-1\n neighbors << [x, y+1] if y < _max_y-1\n\n _neighbors = neighbors.map do |position|\n node = @current_grid[position]\n if node.nil? || node[:walkable]\n node ||= {}\n @current_grid[position] = node.merge({\n x: position.first,\n y: position[1],\n closed: false,\n opened: false\n })\n end\n end.compact\n\n _neighbors.each do |neighbor|\n if (!neighbor[:opened] || new_g < neighbor[:g])\n neighbor[:g] = new_g\n neighbor[:h] ||= heuristic.h(neighbor)\n neighbor[:f] = neighbor[:g] + neighbor[:h]\n neighbor[:parent] = node_to_a(_current_node)\n\n if (!neighbor[:opened])\n open.push neighbor\n neighbor[:opened] = true\n else\n # ???\n puts \"got here some how!!!\"\n end\n end\n end\n\n open.sort_by! {|i| [-i[:f], -i[:h]]}\n # grid_p\n end\n end\n end",
"def calc_point_from_angle(cx, cy, angle, length)\r\n # - - - - - - - - - - - - - - - - - - - - -\r\n #System.Convert.ToInt32(System.Convert.ToDouble(originX) * Math.Cos(radians)), originY + #System.Convert.ToInt32(System.Convert.ToDouble(originY) * Math.Sin(radians)))\r\n # radians = (90 - angle) * degree_to_radian;\r\n if (angle > 360) \r\n angle = angle % 360\r\n end #if\r\n #print \"(cx=\", cx, \" cy=\", cy, \" angle=\", angle, \", length=\", length, \")\\n\"\r\n\r\n #if (angle > 360)\r\n # angle = angle % 360.0\r\n\r\n \r\n quad = 1\r\n tang = angle\r\n\r\n## if (angle == 9999)\r\n## if (angle == 0)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle == 90)\r\n## return CNCPoint.new(cx + length, cy)\r\n## elsif(angle == 180)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle == 270)\r\n## return CNCPoint.new(cx - length, cy)\r\n## elsif(angle == 360)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle > 90)\r\n## quad = 2\r\n## tang -= 90\r\n## elsif (angle > 180)\r\n## quad = 3\r\n## tang -= 180\r\n## elsif (angle > 270)\r\n## quad = 4\r\n## tang -= 180\r\n## end #else\r\n## end # 99999\r\n## #print \"tang = \", tang, \" quad=\", quad, \"\\n\"\r\n##\r\n\r\n radians = conv_degree_to_radian(tang -90)\r\n\r\n\r\n new_x = cx + Math.cos(radians) * (length)\r\n new_y = cy + Math.sin(radians) * (length)\r\n\r\n #print \"(new_x = \", new_x, \" new_y=\", new_y, \")\\n\"\r\n##\r\n## if (angle == 9999)\r\n## case quad\r\n## when 1\r\n## # nothing needs to be done\r\n## when 2\r\n## # x is ok\r\n## #new_y = 0 - new_y\r\n## when 3\r\n## new_x = 0 - new_x\r\n## new_y = 0 - new_y\r\n## when 4\r\n## new_x = 0 - new_x\r\n## end\r\n## end # 9999\r\n##\r\n\r\n aRes = CNCPoint.new(new_x, new_y)\r\n return aRes\r\n end",
"def draw_box(line_num)\n return if line_num < 1\n x = (line_height / 2) - 1\n y = @draw_y + (line_height / 2) - 1\n w = contents_width - 2*x\n h = (1 + line_num)*line_height\n draw_rect_outline_with_shadow(x, y, w, h) \n end",
"def line_stroke(left_border, junc_border, right_border, &block)\n stroke = ''\n stroke += left_border if settings.border.left?\n dimensions.num_cols.times do |col_num|\n stroke += junc_border if col_num > 0 && settings.border.inner_vert?\n stroke += yield\n end\n stroke += right_border if settings.border.right?\n stroke\n end",
"def compute_direction(this_exit, other_exit, curvilinear_type)\n if curvilinear_type == STRAIGHT\n # no curve but we still need a direction, and we need to ensure both\n # \"half paths\" have different directions\n return this_exit < other_exit ? :left : :right\n end\n\n return :none if !other_exit || !this_exit\n\n if (this_exit + curvilinear_type) % 6 == other_exit\n :left\n elsif (other_exit + curvilinear_type) % 6 == this_exit\n :right\n end\n end",
"def pentadodekaeder_surface(in_edge_length)\n check_pre(((in_edge_length.numeric?) and (in_edge_length >= 0)))\n return 12 * pentagon_surface(in_edge_length)\nend",
"def arc(x, y, radius, startAngle, endAngle, anticlockwise)\n drawCircle(x, y, radius) if startAngle == 0 && endAngle == Math::PI * 2\n\n arc = endAngle - startAngle\n\n # Calculate the start point of the path\n x1, y1 = calc_point(radius, startAngle, x, y)\n x2, y2 = calc_point(radius, endAngle, x, y)\n\n direction = anticlockwise ? SweepDirection.Counterclockwise : SweepDirection.Clockwise\n if anticlockwise\n large_arc = arc >= Math::PI ? false : true\n else\n large_arc = arc >= Math::PI ? true : false\n end\n\n drawArc(x1, y1, x2, y2, radius, large_arc, direction)\n end",
"def draw_line_markers\n return if @hide_line_markers\n\n @d = @d.stroke_antialias false\n\n if @left_axis_increment.nil? || @right_axis_increment.nil?\n # Try to use a number of horizontal lines that will come out even.\n #\n # TODO Do the same for larger numbers...100, 75, 50, 25\n if @marker_count.nil?\n marker_count\n normalize(true)\n end\n @left_increment = @left_spread / @marker_count if !@left_spread.nil?\n @right_increment = @right_spread / @marker_count if !@right_spread.nil?\n end\n \n if @has_left_data\n @increment_scaled = @graph_height.to_f / (@left_spread / @left_increment)\n elsif @has_right_data\n @increment_scaled = @graph_height.to_f / (@right_spread / @right_increment)\n end\n\n increment_scale = @increment_scaled\n @increment_scaled = @increment_scaled.ceil\n\n @scale_percentage = increment_scale/@increment_scaled\n \n# y = @graph_top + @graph_height - @marker_count * @increment_scaled\n# @d.fill 'white'\n# @d.rectangle( @graph_left, y, @graph_right, @graph_bottom)\n\n # Draw horizontal line markers and annotate with numbers\n (0..@marker_count).each do |index|\n y = @graph_top + @graph_height - index.to_f * @increment_scaled\n\n @d.fill(@marker_color)\n @d.line(@graph_left, y.to_i, @graph_right, y.to_i)\n\n# @d.fill('black')\n# @d.line(@graph_left, y, @graph_left+3, y) if !(@left_increment.nil? && @left_minimum_value.nil?)\n# @d.line(@graph_right-3, y, @graph_right, y) if !(@right_increment.nil? && @right_minimum_value.nil?)\n\n marker_label = index * @left_increment + @left_minimum_value.to_f if !(@left_increment.nil? && @left_minimum_value.nil?)\n right_marker_label = index * @right_increment + @right_minimum_value.to_f if !(@right_increment.nil? && @right_minimum_value.nil?)\n\n unless @hide_line_numbers\n @d.fill = @font_color\n @d.font = @font if @font\n @d.stroke('transparent')\n @d.pointsize = scale_fontsize(@marker_font_size)\n @d.gravity = EastGravity if !(@left_increment.nil? && @left_minimum_value.nil?)\n\n # Vertically center with 1.0 for the height\n @d = @d.annotate_scaled( @base_image,\n @graph_left - LABEL_MARGIN, 1.0,\n 0.0, y,\n label(marker_label), @scale) if !(@left_increment.nil? && @left_minimum_value.nil?)\n\n @d.gravity = WestGravity if !(@right_increment.nil? && @right_minimum_value.nil?)\n @d = @d.annotate_scaled( @base_image,\n 0.0, 1.0,\n @graph_right + LABEL_MARGIN, y,\n label(right_marker_label, :right), @scale) if !(@right_increment.nil? && @right_minimum_value.nil?)\n end\n end\n\n # # Submitted by a contibutor...the utility escapes me\n # i = 0\n # @additional_line_values.each do |value|\n # @increment_scaled = @graph_height.to_f / (@maximum_value.to_f / value)\n #\n # y = @graph_top + @graph_height - @increment_scaled\n #\n # @d = @d.stroke(@additional_line_colors[i])\n # @d = @d.line(@graph_left, y, @graph_right, y)\n #\n #\n # @d.fill = @additional_line_colors[i]\n # @d.font = @font if @font\n # @d.stroke('transparent')\n # @d.pointsize = scale_fontsize(@marker_font_size)\n # @d.gravity = EastGravity\n # @d = @d.annotate_scaled( @base_image,\n # 100, 20,\n # -10, y - (@marker_font_size/2.0),\n # '', @scale)\n # i += 1\n # end\n\n @d = @d.stroke_antialias true\n end",
"def display_upper_semi_diamond(n)\n left_outline = n / 2\n right_outline = left_outline\n\n (n / 2).times do\n row = ' ' * n\n row[left_outline] = '*'\n row[right_outline] = '*'\n\n puts row\n left_outline -= 1\n right_outline += 1\n end\nend",
"def draw_line(x1, y1, x2, y2)\n if (x2-x1).abs > 0.95 * @max_width || (y2-y1).abs > 0.95 * @max_height\n return\n end\n\n\n x1 = scale(x1)\n y1 = scale(y1)\n x2 = scale(x2)\n y2 = scale(y2)\n\n strokeWeight(1)\n\n stroke(255)\n line(x1, y1, x2, y2)\n #stroke(0xff, 0xff, 0xff)\n #ellipse(x2, y2, 2, 2)\n end",
"def test_step_on_line\n h_step = [[2,1],[2,3],[2,5]]\n l_step = [[1,4],[2,3],[3,2]]\n r_step = [[1,2],[2,3],[3,4]]\n\n assert @chess._is_step_on_line(h_step, \"horizonal\")\n assert @chess._is_step_on_line(l_step, \"leftdown\")\n assert @chess._is_step_on_line(r_step, \"rightdown\")\n\n b_step = [[0,3],[3,0]]\n t_step = [[2,3],[3,2],[3,4]]\n assert !@chess._is_step_on_line(b_step, \"boundary\")\n assert !@chess._is_step_on_line(t_step, \"triangle\")\n end",
"def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end",
"def rayon(x1,y1,x2,y2,type = 'objet')\n return '' if x1 == x2\n return '' if y1 == y2 && (x2.abs > 1000 || x1.abs > 1000)\n a = (y2-y1)/(x2-x1)\n return '' if a > 100\n# puts [x1,x2,y1,y2,a].join(\"\\t\")\n b = y1 - a*x1\n hneg = -a*LARGEUR+b\n hpos = a*LARGEUR+b\n hneg_sign = hneg.abs/hneg\n hpos_sign = hpos.abs/hpos\n gauche = ((hneg).abs > HAUTEUR && a!=0) ? \"(#{arrondi((hneg_sign*HAUTEUR - b)/a)},#{arrondi(hneg_sign*HAUTEUR)})\" : \"(-#{LARGEUR},#{arrondi(-a*LARGEUR+b)})\"\n milieu = ''\n droite = ((hpos).abs > HAUTEUR && a!=0) ? \"(#{arrondi((hpos_sign*HAUTEUR - b)/a)},#{arrondi(hpos_sign*HAUTEUR)})\" : \"(#{LARGEUR},#{arrondi(a*LARGEUR+b)})\"\n return \"\n \\\\draw [thick #{type == 'objet' || type == 'miroir' ? (type == 'miroir' ? ',<<-' : ',>>-') : ', dashed'}] #{gauche} -- (0,#{arrondi(b)});\n \\\\draw [thick #{type == 'objet' || type == 'miroir' ? ', dashed' : ',->>'}] (0,#{arrondi(b)}) -- #{droite};\n \"\n end",
"def to_bezier_path\n path = to_path\n spiro = false\n flat_path = path.nodes.map do |n|\n spiro = true if spiro || [:g2, :g4, :left, :right].include?(n.type)\n [n.x, n.y, n.type]\n end\n if spiro\n flat_spline_path = Spiro.spiros_to_splines(flat_path, @closed)\n if flat_spline_path.nil?\n fail \"Spiro failed, try different coordinates or using G2 nodes.\"\n else\n path = Path.new(*flat_spline_path.map do |n|\n N.new(n[0], n[1], n[2])\n end, closed: @closed, **@options)\n end\n end\n path\n end",
"def is_pathway?(x, y)\n @maze[x][y] == '_' or is_exit?(Cell.new(x, y, []))\n end",
"def line_to_segment(a, b, c)\n raise 'Invalid line (a or b must be nonzero)' if a == 0 && b == 0\n\n if a == 0\n y = c.to_f / b\n [0.0, y, 1.0, y]\n elsif b == 0\n x = c.to_f / a\n [x, 0.0, x, 1.0]\n else\n [0.0, c.to_f / b, 1.0, (c - a).to_f / b]\n end\n end",
"def path(current)\n output = \" \"\n path = [[current.x, current.y]]\n while current.parent != nil\n path << [current.parent.x, current.parent.y]\n current = current.parent\n end\n path.reverse!\n path.each do |space|\n output += \"#{space} \"\n @board.update_board(space)\n end\n output\n end",
"def cpline_to(x, y, w = nil)\n return line_to(x, y) unless w\n command = absolute? ? 'C' : 'c'\n args = [@last.x + w, @last.y, x - w, y, x, y]\n @path_builder << \"#{command}#{to_path(args)}\"\n @last.x = (absolute? ? 0 : @last.x) + x\n @last.y = (absolute? ? 0 : @last.y) + y\n @last.bx = x - w\n @last.by = y\n end",
"def draw_paths; end",
"def angle_from_input\n\n return if @path.size < 2\n return unless @active_controller.is_a? Symbol\n\n i = @active_controller == :start ? 0 : 1\n corner = @path[-i]\n ref_vector = @path[-i] - @path[1 - 3 * i]\n input_vector = corner - @ip.position\n return unless input_vector.valid?\n return if input_vector.parallel? Z_AXIS\n return if input_vector.parallel? ref_vector\n\n angle = -(MyGeom.angle_in_plane input_vector, ref_vector)\n angle -= GRAPHICAL_ANGLES[i]\n angle = ((angle+90.degrees)%180.degrees)-90.degrees\n\n @end_angles[i] = angle\n\n end",
"def line(x1, y1, x2, y2)\n CGContextAddLines(@ctx, [NSPoint.new(x1, y1), NSPoint.new(x2, y2)], 2)\n CGContextDrawPath(@ctx, KCGPathStroke) # apply stroke\n endpath\n\n end",
"def nested_params( outer_sidelen, spacing_ratio, nth_from_outer, x_start, y_start )\n hypot = spacing_ratio * nth_from_outer * outer_sidelen\n x = x_start + hypot * Math.sin( Math::PI/3.0 )\n y = y_start + hypot * Math.cos( Math::PI/3.0 )\n [ x, y, outer_sidelen - hypot ]\nend",
"def nested_params( outer_sidelen, spacing_ratio, nth_from_outer, x_start, y_start )\n hypot = spacing_ratio * nth_from_outer * outer_sidelen\n x = x_start + hypot * Math.sin( Math::PI/3.0 )\n y = y_start + hypot * Math.cos( Math::PI/3.0 )\n [ x, y, outer_sidelen - hypot ]\nend",
"def print_employer_graphics_box(box)\n\n # Horizontal lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n self.line_width = 0.01.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.125.in\n stroke_line([x, y], [x + 1.25.in, y])\n y -= 0.125.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n\n # Vertical lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n stroke_line([x, y], [x, y - 4.75.in])\n stroke_line([x + 2.1.in, y], [x + 2.1.in, y - 0.25.in])\n stroke_line([x + 2.7.in, y], [x + 2.7.in, y - 0.25.in])\n stroke_line([x + 3.75.in, y], [x + 3.75.in, y - 4.75.in])\n y -= 0.25.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 0.25.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 0.125.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n y -= 0.125.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 2.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.5.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 1.25.in])\n y -= 0.5.in\n stroke_line([x + 1.in, y], [x + 1.in, y - 0.75.in])\n y -= 0.75.in\n stroke_line([x + 0.3.in, y], [x + 0.3.in, y - 0.25.in])\n stroke_line([x + 1.4.in, y], [x + 1.4.in, y - 0.375.in])\n stroke_line([x + 2.6.in, y], [x + 2.6.in, y - 0.375.in])\n y -= 0.375.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.375.in])\n\n # Text (top to bottom, left to right).\n x = box[:x]\n y = box[:y]\n self.vms_text_box(\"Employers State, Local, or File Copy\", x + 0.1, y, 1.9, 0.25, 7, :bold, :left, :center)\n self.vms_text_box(\"22222\", x + 2.1, y + 0.015, 0.6, 0.25, 10, :normal, :center, :center, 'SF Mono')\n self.vms_text_box(\"2018\", x + 2.7, y, 0.5, 0.25, 12, :bold, :center, :center, 'Whitney Bold')\n self.vms_text_box(\"OMB No.\\n1545-0008\", x + 3.2, y, 0.55, 0.25, 6, :normal, :center, :center)\n y -= 0.25\n self.vms_text_box(\"<strong>a</strong> Employee's soc. sec. no.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>1</strong> Wages, tips, other comp.\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>2</strong> Federal income tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>3</strong> Social security wages\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>4</strong> Social security tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>b</strong> Employer ID number (EIN)\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>5</strong> Medicare wages and tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>6</strong> Medicare tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>c</strong> Employer's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>d</strong> Control number\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>e</strong> Employee's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"Suff.\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :right, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>7</strong> Social security tips\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>8</strong> Allocated tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>9</strong> Verification code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>10</strong> Dependent care benefits\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>11</strong> Nonqualified plans\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12a</strong> Code (See inst. for box 12)\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>13</strong> Statutory employee\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>14</strong> Other\", x + 1.05, y - 0.02, 1.4, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12b</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Retirement plan\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12c</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Third-party sick pay\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12d</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.5\n self.vms_text_box(\"<strong>15</strong> State Employer's ID Number\", x + 0.05, y - 0.02, 1.3, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>16</strong> State wages, tips, etc.\", x + 1.45, y - 0.02, 1.1, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>17</strong> State income tax\", x + 2.65, y - 0.02, 1.05, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>18</strong> Local wages, tips, etc.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>19</strong> Local income tax\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>20</strong> Locality name\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.375\n self.vms_text_box(\"Form W-2 Wage and Tax Statement\\nFor Privacy Act and Paperwork Reduction\\nAct Notice, see separate instructions.\", x, y - 0.04, 3.75, 0.375, 6, :bold, :left, :top)\n self.vms_text_box(\"Dept. of the Treasury -- IRS\", x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n y -= box[:bottom_right_offset]\n self.vms_text_box(box[:bottom_right], x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n\n end",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def calculate_area\n\t\t\tif @num_sides.is_a?(Fixnum) \n\t\t\tangle = (Math::PI * 2)/@num_sides\n\t\t\t# add *(r**2) if you want radius\n\t\t\tsolved = (0.5)*@num_sides*Math.sin(angle)\n\t\t\t@solved = solved\n\t\tend\n\tend",
"def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def segment_to_line(x1, y1, x2, y2)\n raise 'Need two distinct points to define a segment' if x1 == x2 && y1 == y2\n\n # Vertical/horizontal/oblique lines\n if y1 == y2\n [0.0, 1.0, y1]\n elsif x1 == x2\n [1.0, 0.0, x1]\n else\n [y1 - y2, x2 - x1, x2 * y1 - x1 * y2]\n end\n end",
"def get_intersecting_line entity, connnectLine\n entity_x = entity.get_x\n entity_y = entity.get_y\n\n edges = []\n\n #Top edge\n edges << (Line2D::Double.new entity_x, entity_y, entity_x + ENTITY_WIDTH, entity_y)\n #Bottom edge\n edges << (Line2D::Double.new entity_x, entity_y + ENTITY_HEIGHT, entity_x + ENTITY_WIDTH, entity_y + ENTITY_HEIGHT)\n #Left edge\n edges << (Line2D::Double.new entity_x, entity_y, entity_x, entity_y + ENTITY_HEIGHT)\n #Right edge\n edges << (Line2D::Double.new entity_x + ENTITY_WIDTH, entity_y, entity_x + ENTITY_WIDTH, entity_y + ENTITY_HEIGHT)\n\n edges.each do |e|\n return e if connnectLine.intersects_line e\n end\n\n end",
"def draw_line(start_x, start_y, end_x, end_y, image)\n line = Magick::Draw.new\n line.polyline(start_x, start_y, end_x, end_y)\n line.draw(image)\nend",
"def content_line_stroke(row_within_cell, vert_scrollbar)\n line_stroke(\n settings.border.style.left_vert,\n settings.border.style.middle_vert,\n settings.border.style.right_vert,\n ) do\n if settings.scrollbar.vert?\n PADDING * dimensions.inner_grid_width + vert_scrollbar[row_within_cell]\n else\n PADDING * dimensions.inner_grid_width\n end\n end\n end",
"def is_same_line on_line, off_line\n\tif on_line == off_line\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend",
"def line_point_distance(line_start, line_end, point)\n top = ((line_end.y - line_start.y) * point.x) -\n ((line_end.x - line_start.x) * point.y) +\n (line_end.x * line_start.y) - \n (line_end.y * line_start.x)\n bottom = ((line_end.y - line_start.y) ** 2 +\n (line_end.x - line_start.x) ** 2) ** 0.5\n return (top / bottom).abs\n end",
"def diamond_enum_sol(n, full:true)\n step_one_to_n_to_one(n).each do |i|\n line = full || i == 1 ? '*' * i : '*' +' ' * (i - 2) + '*'\n puts line.center(n)\n end\nend",
"def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def draw_alt_line\n @dim.times do |i|\n if i.even?\n print draw_x\n else\n if @type == \"allx\"\n print draw_x\n elsif @type == \"alt\"\n print draw_dot\n end\n end\n end\n end",
"def lattice_paths(grid_size)\n grid_dimension = grid_size + 1\n grid = Array.new(grid_dimension * grid_dimension) { 1 }\n (grid_size - 1).downto(0) do |x|\n (grid_size - 1).downto(0) do |y|\n pos = (y * grid_dimension) + x\n grid[pos] = grid[pos + 1] + grid[pos + grid_dimension]\n end\n end\n grid[0]\nend",
"def diamond_outline(num)\n puts ''\n outer_spacer = num / 2\n inner_spacer = 0\n lines = 0\n while lines < num / 2\n if outer_spacer == num / 2\n puts ' ' * outer_spacer + '*'\n inner_spacer += 1\n else\n unless outer_spacer < 0\n puts ' ' * outer_spacer + '*' + ' ' * inner_spacer + '*'\n inner_spacer += 2\n end\n end\n outer_spacer -= 1\n lines += 1\n end\n while lines < num\n if outer_spacer < num / 2\n puts ' ' * outer_spacer + '*' + ' ' * inner_spacer + '*'\n inner_spacer -= 2\n else\n puts ' ' * outer_spacer + '*'\n inner_spacer -= 1\n end\n outer_spacer += 1\n lines += 1\n end\n puts ''\nend",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def horizontal_line(y, options = {})\n with options do\n at = y + @bottom\n @pdf.stroke_horizontal_line left, @pdf.bounds.right - right, at: at\n end\n end",
"def horizontal_line y\n line = { x: 0, y: y, w: grid.width, h: 0 }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def horizontal_line y\n line = { x: 0, y: y, w: grid.width, h: 0 }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def compute_proper_normal(line)\n normals = compute_normals(line)\n ball_center_x = state.ball_old_x + (state.ball[:w] / 2)\n ball_center_y = state.ball_old_y + (state.ball[:h] / 2)\n v1 = vec2(line[:x2] - line[:x], line[:y2] - line[:y])\n v2 = vec2(line[:x2] - ball_center_x, line[:y2] - ball_center_y)\n cp = v1[:x] * v2[:y] - v1[:y] * v2[:x]\n cp < 0 ? normals[0] : normals[1]\n end",
"def draw_route\n # Delete all sprites in drawing of path\n @arrow_path.each{|a| a.dispose}\n @arrow_path = []\n \n return if @passed_positions.empty?\n start_pos = [@unit.x, @unit.y]\n new_pos = start_pos\n type = \"\"\n # Get direction from unit to first tile in path\n last_dir = case [@passed_positions[0].x - @unit.x, @passed_positions[0].y - @unit.y]\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n # Loop through path positions, evaluating two elements at a time\n for i in 0...@passed_positions.size\n p1 = @passed_positions[i]\n p1 = [p1.x, p1.y]\n p2 = (@passed_positions[i+1] == nil ? 0 : @passed_positions[i+1])\n if p2.is_a?(MoveTile)\n p2 = [p2.x, p2.y] \n # Figure out the direction taken to get from p1 to p2\n dir = [p2[0] - p1[0], p2[1] - p1[1]]\n dir = case dir\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n else\n dir = 0\n end\n # Evaluate the last direction taken to get to current spot\n case last_dir\n when 2\n new_pos[1] += 1\n type = case dir\n when 0 then \"d\"\n when 2 then \"v\"\n when 4 then \"ru\"\n when 6 then \"lu\"\n end\n when 4\n new_pos[0] -= 1\n type = case dir\n when 0 then \"l\"\n when 2 then \"ld\"\n when 4 then \"h\"\n when 8 then \"lu\"\n end\n when 6\n new_pos[0] += 1\n type = case dir\n when 0 then \"r\"\n when 2 then \"rd\"\n when 6 then \"h\"\n when 8 then \"ru\"\n end\n when 8\n new_pos[1] -= 1\n type = case dir\n when 0 then \"u\"\n when 4 then \"rd\"\n when 6 then \"ld\"\n when 8 then \"v\"\n end\n end\n last_dir = dir\n @arrow_path.push(Arrow_Sprite.new($spriteset.viewport1, type, new_pos))\n end\n end",
"def draw_vertical(start_line, end_line, start_char)\n start_line.upto(end_line) do |line_idx| \n @lines[line_idx][start_char] = PATH_CHAR \n end\n end",
"def incircle\n # Circle.new(self.incenter, self.inradius)\n end"
] |
[
"0.511261",
"0.4895138",
"0.47951463",
"0.47733837",
"0.47640806",
"0.47473344",
"0.4678335",
"0.46684912",
"0.46418127",
"0.4598969",
"0.45607543",
"0.45571336",
"0.45404562",
"0.44949138",
"0.4469788",
"0.44570097",
"0.44404832",
"0.44040582",
"0.44034803",
"0.43955457",
"0.43897882",
"0.43755853",
"0.4373372",
"0.43700364",
"0.43551552",
"0.432494",
"0.43122032",
"0.4300809",
"0.42995504",
"0.42993328",
"0.4281311",
"0.426827",
"0.42604813",
"0.42595345",
"0.42543516",
"0.4251594",
"0.42480597",
"0.42436123",
"0.42404163",
"0.42274186",
"0.42245173",
"0.42190862",
"0.4197146",
"0.41920623",
"0.41913512",
"0.41816515",
"0.41799775",
"0.417542",
"0.41625375",
"0.41588777",
"0.41585988",
"0.41524613",
"0.41479957",
"0.41448835",
"0.41399226",
"0.41382086",
"0.4134137",
"0.41322538",
"0.4131223",
"0.4116085",
"0.41152033",
"0.41121045",
"0.41090834",
"0.41040432",
"0.4102941",
"0.4099033",
"0.40973398",
"0.40964302",
"0.4095998",
"0.4093358",
"0.4092738",
"0.4090686",
"0.40840602",
"0.40839055",
"0.40838796",
"0.40830302",
"0.40811318",
"0.40786284",
"0.40685308",
"0.4063962",
"0.40613827",
"0.4049788",
"0.40495288",
"0.40489814",
"0.40460908",
"0.40450573",
"0.40449426",
"0.40262845",
"0.40245074",
"0.40216255",
"0.40164125",
"0.4013799",
"0.40070817",
"0.40060976",
"0.4003375",
"0.4003375",
"0.40019736",
"0.3988346",
"0.39864135",
"0.3985342"
] |
0.5554023
|
0
|
This method has the bulk of the logic: we create the list of path deltas to be applied when we walk the edge next.
|
def define_shifts(edge)
along_iterator, across_iterator = define_shift_iterators(edge)
shifts = []
shifts << across_iterator.next if edge.add_across_line?(center_out)
(1..edge.notch_count).to_a.each do |count|
shifts << along_iterator.next
shifts << across_iterator.next unless count == edge.notch_count
end
shifts << across_iterator.next if edge.add_across_line?(center_out)
shifts
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_edges(edges, l_act_edge)\n prev_edge = Edge.new\n\n prev_edge = edges;\n\n begin\n edges = prev_edge.next\n if (edges.delta_y > 1)\n edges.delta_y -= 1\n edges.x_int = edges.x_int - edges.delta_x\n prev_edge = edges\n else\n prev_edge.next = edges.next\n l_act_edge = prev_edge if (edges == l_act_edge)\n edges = nil # dispose edges\n end\n end while (prev_edge != l_act_edge)\n \n return l_act_edge\n end",
"def process_edges\n # Assume that one point will always be at the origin. The points can always be translated in such a way that this is true,\n # so it's a reasonable simplifying assumption.\n current_vertex_id = find_origin\n next_vertex_id = get_clockwise_neighbor(*get_neighboring_vertices(current_vertex_id))\n current_edge_id = find_edge_by_vertices(current_vertex_id, next_vertex_id)\n\n # Set the current vertex to be the lagging vertex of the current edge we're on.\n current_edge = @edges[current_edge_id]\n\n (@edges.size).times do\n if current_edge.circular\n current_edge.set_radius(@vertices)\n\n # We are advancing clockwise. If a curve is anti-clockwise, then the curve is concave. Intuitively, a concave angle is\n # created when the path 'reverses direction.'\n if current_vertex_id == current_edge.clockwise_vertex_id\n current_edge.concave = false\n current_edge.convex = true\n current_edge.find_farthest_points(@vertices)\n else\n current_edge.concave = true\n current_edge.convex = false\n end\n end\n next_edge_id = get_other_edge(current_vertex_id, current_edge_id)\n next_edge = @edges[next_edge_id]\n\n current_edge_id = next_edge_id\n current_edge = @edges[current_edge_id]\n current_vertex_id = current_edge.get_other_vertex(current_vertex_id)\n end\n end",
"def next_paths\n Operations.list.map do |operation|\n new_value = Operations.send(operation, @current_value)\n operation_history = @operation_history + [operation]\n Path.new(new_value, @target_value, operation_history: operation_history)\n end\n end",
"def lesstrips_dfs(start, finish, max_distance, distance, visited, path, paths, cycles)\n adj_vertices(visited.last, adj_lists).each do |vertex|\n print \"Visited stack: #{visited}, Next vertex: #{vertex}\\n\"\n totald = distance + dist(visited.last, vertex)\n\n if visited.last == finish && cycles != \"NO CYCLES EXIST\"\n\n # try adding cycles\n\n visited_before_cycles = visited\n # picks expanded cycles that begin with finish vertex\n ec = expanded_cycles(cycles).select{|c| c.first == finish}\n\n # keep adding cycles till we reach max distance\n ec.each do |cycle1|\n visited, paths, break_loop = try_cycles(visited, cycle1, paths, 0, max_distance)\n visited1 = visited\n\n ec.each do |cycle2|\n begin\n visited, paths, break_loop = try_cycles(visited, cycle2, paths, 0, max_distance)\n end until break_loop\n visited = visited1\n end\n\n visited = visited_before_cycles\n end\n\n elsif !visited.include?(vertex) && totald != \"NO SUCH ROUTE\" && totald < max_distance\n visited << vertex\n path = visited\n distance = totald\n\n if vertex == finish\n paths << path\n print \"\\n*** Path: #{path}, Length: #{path_length(path)}\\n\\n\"\n visited.pop\n break\n end\n\n lesstrips_dfs(start, finish, max_distance, distance, visited, path, paths, cycles)\n visited.pop\n visited.pop if visited.size.between?(2, 3)\n visited = [start] if visited == []\n end\n end\n paths.size\n end",
"def add_edge(edge)\n # pp @access_paths\n # pp edge\n added = false\n return added if @edges.include?(edge)\n visited_path = @access_paths.each_with_index.select{|p,idx| !(p & edge).empty? }\n if visited_path.count == 2\n # if the two vertexes are visited in 2 paths\n # We'll combine the 2 paths\n new_path =[]\n to_del_idx =[]\n visited_path.each do |p|\n idx = p[1]\n v_path = p[0]\n new_path = new_path + v_path\n to_del_idx << idx\n end\n @access_paths.delete_if.with_index{|p,idx| to_del_idx.include?(idx)}\n @access_paths << new_path\n @edges << edge unless @edges.include?(edge)\n added = true\n elsif visited_path.count == 1\n v_path = visited_path[0][0]\n # binding.pry\n if (v_path & edge).count() == 2\n # binding.pry\n # add edge only when it does not create cycle\n puts \"Refuse to add edge #{edge.to_s} as it create cycle\"\n else\n # v_path = visited_path[0][1]\n vertext = edge - v_path\n v_path = v_path + vertext\n idx = visited_path[0][1]\n @access_paths.delete_at(idx)\n @access_paths << v_path\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n elsif visited_path.count == 0\n @access_paths << edge\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n # puts \"added is #{added}\"\n\n return added\n\tend",
"def paths_to_deltas(points)\n [points].flatten.map { |p| p.tap { p[:path] = DELTA + p[:path] } }\n end",
"def trim_and_extend_path(visited_nodes) \n extended_path = []\n \n subpath = visited_nodes[0..(visited_nodes.length - 3)]\n \n extension_point = subpath.detect { |node| unvisited_neighbours_of(node, visited_nodes).length > 0 }\n \n if extension_point \n extension_index = subpath.index(extension_point)\n puts \" - got extension point: #{extension_index} out of #{visited_nodes.length}\"\n \n unvisited_nodes = self.nodes - visited_nodes\n reduced_adjacencies = self.adjacencies.select { |node, connections| unvisited_nodes.include?(node) }\n\n outside_cycle_finder = CycleFinder.new(unvisited_nodes, reduced_adjacencies) \n\n first_node = unvisited_neighbours_of(extension_point, visited_nodes).first \n unvisited_path = outside_cycle_finder.grow_basic_path([ first_node ])\n \n v_j = (visited_nodes & connected_to(unvisited_path.last)).detect do |node|\n j = visited_nodes.index(node)\n (j > extension_index + 1) && (j < visited_nodes.length) && \n connected?(visited_nodes[j + 1], visited_nodes[extension_index + 1])\n end\n \n if v_j\n end_index = visited_nodes.index(v_j)\n \n extended_path += visited_nodes[0..extension_index]\n extended_path += unvisited_path\n extended_path += visited_nodes[(extension_index + 1)..end_index].reverse\n extended_path += visited_nodes[(end_index + 1)..(visited_nodes.length - 1)]\n end\n end\n\n if extended_path.length > visited_nodes.length\n puts \" - path extended by #{extended_path.length - visited_nodes.length}\"\n trim_and_extend_path(extended_path)\n else\n puts \" - failed to extend, returning #{visited_nodes.length}\"\n visited_nodes\n end \n end",
"def collect_edge! #:yields: source, target, edge\n _clear_cache\n @pathway.relations.each do |rel|\n newedge = yield rel.node[0], rel.node[1], rel.relation\n rel.edge = newedge\n @pathway.append(rel, false)\n end\n self\n end",
"def map_paths(orig = @orig, dest = @dest, path = [])\n\n\t\t# we have to duplicate each path array to its own object\n\t\t# to ensure it isn't contaminated by another iteration\n\t\tpath = path.dup\n\t\tpath << orig\n\n\t\tif orig == dest\n\t\t\tif !@successful_paths.include?(path)\n\t\t\t\t@successful_paths << path\n\t\t\t\treturn\n\t\t\tend\n\t\telse\n\t\t\t# get connections\n\t\t\tconnections = orig.connected\n\t\t\t# remove previous stops from possible connections list\n\t\t\tconnections = connections - path\n\t\t\tconnections.each do |c|\n\t\t\t\tmap_paths(c, dest, path)\n\t\t\tend\n\t\tend\n\tend",
"def restructure_path(visited_nodes, target_nodes) \n candidate_nodes = target_nodes.map do |target_node|\n following_node = visited_nodes[visited_nodes.index(target_node) + 1]\n \n unvisited_neighbours_of(following_node, visited_nodes).map { |neighbour|\n [ [target_node, neighbour], unvisited_neighbours_of(neighbour, visited_nodes).length ]\n }\n end.flatten(1)\n \n if candidate_nodes.length > 0 \n maximal_unvisited_count = candidate_nodes.map(&:last).max\n \n pivot_node, additional_node = candidate_nodes.rassoc(maximal_unvisited_count).first\n pivot_index = visited_nodes.index(pivot_node)\n \n visited_nodes = visited_nodes[0..pivot_index] + visited_nodes[(pivot_index + 1)..-1].reverse\n visited_nodes << additional_node\n end\n \n visited_nodes = grow_basic_path(visited_nodes)\n end",
"def each_edge_in_path(node1, node2)\n path = self.path(node1, node2)\n source = path.shift\n path.each do |target|\n edge = self.get_edge(source, target)\n yield source, target, edge\n source = target\n end\n self\n end",
"def update_discharge_circuits_path \n \n self.downstream_maximum.each do |downstream|\n rs_fds = self.flow_element_downstreams.where(:path => downstream.path)\n path_ar = {}\n rs_fds.each do |fd|\n path_ar[fd.downstream_condition_basis] = fd.id\n end\n \n downstream.flow_element_downstream_circuit_pipings.each do |dcp|\n dcp.downstream_maximum_path_id = path_ar['maximum']\n dcp.downstream_normal_path_id = path_ar['normal'] \n dcp.downstream_minimum_path_id = path_ar['minimum']\n dcp.save \n end\n end \n \n end",
"def all_paths_util(u, d)\n # Mark the current node as visited and store in path\n @visited[u] = true\n @path << u\n\n # If current vertex is same as destination, then store it\n # current path[]\n if u == d\n @all_paths << @path.dup\n else\n # If current vertex is not destination\n # Recur for all the vertices adjacent to this vertex\n @graph[u].each do |i|\n if @visited[i] == false\n all_paths_util(i, d)\n end\n end\n end\n # Remove current vertex from path[] and mark it as unvisited\n @path.pop()\n @visited[u]= false\n end",
"def generate_diff\n a, b = @previous.lines, @current.lines\n trace = compute_exploring_graph(a, b)\n diff = []\n\n backtrack(trace, a.size, b.size) do |prev_x, prev_y, x, y|\n if x == prev_x # Forward move\n diff.unshift(Fizzy::Diff::Line.new(:ins, nil, b.size, b.pop))\n elsif y == prev_y # Downward move\n diff.unshift(Fizzy::Diff::Line.new(:del, a.size, nil, a.pop))\n else # Diagonal move\n diff.unshift(Fizzy::Diff::Line.new(:eql, a.size, b.size, [a.pop, b.pop].last))\n end\n end\n\n diff\n end",
"def changed_paths\n @changed_paths ||= ( self[:changed_paths].null? ? nil :\n self[:changed_paths].to_h.tap { |by_path|\n by_path.each_key { |k| by_path[k] = by_path[k].to_h }\n }\n )\n end",
"def rearrange(node)\n idx = @path.index(node) + 1\n # cost = @cost - distance(x, y) - distance(x, e)\n cost = @cost - @@graph.distance(node, @path[idx]) + @@graph.distance(node, path.last)\n new_path = @path[0, idx] + @path[idx, @path.length].reverse\n LKPath.new(new_path, cost)\n end",
"def calculate_internal_deltas\n prev_deltas = @deltas.last\n (@activation_nodes.length-2).downto(1) do |layer_index|\n layer_deltas = []\n @activation_nodes[layer_index].each_index do |j|\n error = 0.0\n @structure[layer_index+1].times do |k|\n error += prev_deltas[k] * @weights[layer_index][j][k]\n end\n layer_deltas[j] = (@derivative_propagation_function.call(\n @activation_nodes[layer_index][j]) * error)\n end\n prev_deltas = layer_deltas\n @deltas.unshift(layer_deltas)\n end\n end",
"def move_diffs\n \n end",
"def attract\n @edges.each do |edge|\n delta_x = edge.end.position.x - edge.beginning.position.x\n delta_y = edge.end.position.y - edge.beginning.position.y\n\n norm = normal(delta_x, delta_y)\n\n if 0 < norm && 1.5 * @optimal_distance < norm\n attraction = attractive_force(norm)\n if edge.end.disposition.nil? # wtf?\n edge.end.disposition = Coordinates.new(0, 0)\n else\n edge.end.disposition.x -= (delta_x * norm) / attraction\n edge.end.disposition.y -= (delta_y * norm) / attraction\n end\n edge.beginning.disposition.x += (delta_x * norm) / attraction\n edge.beginning.disposition.y += (delta_y * norm) / attraction\n end\n end\n end",
"def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvisited << [board_node_by_location(x),step]\n end\n end\n visited << unvisited.shift\n end\n return visited\nend",
"def trips_dfs(start, finish, stops, visited, path, paths, cycles)\n adj_vertices(visited.last, adj_lists).each do |vertex|\n print \"Visited stack: #{visited}, Next vertex: #{vertex}\\n\"\n s = visited.size # stops, including added vertex\n\n if visited.last == finish && cycles != \"NO CYCLES EXIST\"\n\n # try adding cycles if we hit finish vertex too early\n\n visited_before_cycles = visited\n # picks expanded cycles that begin with finish vertex\n ec = expanded_cycles(cycles).select{|c| c.first == finish}\n\n # keep adding cycles till we reach stops\n ec.each do |cycle1|\n visited, paths, break_loop = try_cycles(visited, cycle1, paths, stops, 0)\n visited1 = visited\n\n ec.each do |cycle2|\n begin\n visited, paths, break_loop = try_cycles(visited, cycle2, paths, stops, 0)\n end until break_loop\n visited = visited1\n end\n\n visited = visited_before_cycles\n end\n\n elsif !visited.include?(vertex) && dist(visited.last, vertex) != \"NO SUCH ROUTE\" && s <= stops\n visited << vertex\n path = visited\n\n if vertex == finish && s == stops\n paths << path\n print \"\\n*** Path: #{path}, Stops: #{s}, Length: #{path_length(path)}\\n\\n\"\n visited.pop\n break\n end\n\n trips_dfs(start, finish, stops, visited, path, paths, cycles)\n visited.pop\n visited.pop if visited.size.between?(2, 3) && stops <= 1\n visited = [start] if visited == []\n end\n end\n paths.size\n end",
"def propagate_backward\n @Delta = []\n\n # l = L\n @Delta[@L] = @Y - @D\n\n # l = (L-1)..1\n [*(1...@L)].reverse.each do |l|\n f_u = Matrix.columns( @U[l].t.to_a.map { |u| @layers[l].activate_(u) } )\n w_d = @layers[l+1].W.t * @Delta[l+1]\n @Delta[l] = @layers[l].J.times.map do |j|\n @N.times.map do |n|\n f_u[j, n] * w_d[j, n]\n end\n end.tap { |ary| break Matrix[*ary] }\n end\n end",
"def path_rearrange(path,node)\n index = path.index(node)\n # If the index is 0, the cycle is going to be same so just return path\n return path if index == 0\n # Path 0 3 2 1 0\n # Node 2\n # Arranged path = 2 1 0 3 2\n new_path = path.slice(index, path.length-index)\n new_path.push(path.slice(1,index))\n return new_path\n end",
"def reverse_delete(result)\n edges = result[0]\n hitList = result[1]\n\n hitList.each do |k, dist|\n edges[k[0]].delete(k[-1])\n edges[k[-1]].delete(k[0])\n\n unless path_exists?(edges, k[0], k[-1]) #check if connection still path\n p \"path does not exist, reconnecting #{k[0]} to #{k[-1]} \"\n edges[k[0]][k[-1]] = dist\n edges[k[-1]][k[0]] = dist\n end\n end\n\n edges\n end",
"def update_paths!\n paths = Hash[*roots.map { |r| \n r.self_and_descendants.map { |n| [n.id, { 'path' => n.send(:build_path) }] } }.flatten]\n update paths.keys, paths.values\n end",
"def paths_with_complexity_increase\n path_complexity_history.select do |_, complexity_history|\n _, head_complexity = complexity_history.first\n _, previous_complexity = complexity_history.first(2).last\n\n head_complexity > previous_complexity\n end\n end",
"def calculate_backward_path_tree(parent_Tnode, from_node, root_node)\n \tcur_Tnode = TreeNode.new(from_node)\n\tparent_Tnode.addChildren(cur_Tnode)\n\t$path_tracker.push(cur_Tnode)\n from_node.getBackwardEdges.each do |e|\n\t\tif e.getFromNode != nil\n\t\t\tif $path_tracker.include?(e.getFromNode)\n\t\t\telse\n\t\t\t\tif root_node.getIndex > e.getFromNode.getIndex\n\t\t\t\t\tcalculate_backward_path_tree(cur_Tnode, e.getFromNode, root_node)\n\t\t\t\tend\n\t\t\tend\n\t\telsif e.getFromNode == nil\n\t\t\t#do nothing\n\t\tend\n\tend\n\t$path_tracker.pop\nend",
"def flat_edgelist\n ni = Hash.new\n @nodes.each_with_index { |n,i| ni[n]=i+1 }\n sa = []\n da = []\n @links.each_value do |l| \n sa << ni[l.src]\n da << ni[l.dest]\n end\n sa + da\n end",
"def decode_path(goal_node)\n path = []\n until goal_node.nil?\n path.unshift goal_node\n goal_node = goal_node.previous\n end\n return path\nend",
"def all_paths\n derivatives_for_reference\n rescue StandardError => e\n logger.error(e.message)\n raise e\n end",
"def splice_alternate_paths(outage)\n raise \"not a symmetric outage!\" unless outage.symmetric\n\n if outage.direction == Direction.FORWARD\n # TODO: use other data for finding ingresses\n return if outage.tr.empty? # spooftr\n return if outage.historical_tr.empty?\n current_as_path = outage.tr.compressed_as_path # spooftr?\n old_as_path = outage.historical_tr.compressed_as_path\n\n divergent_as = Path.first_point_of_divergence(old_as_path, current_as_path)\n return if divergent_as.nil?\n\n ingress = outage.historical_tr.ingress_router_to_as(divergent_as)\n return if ingress.nil?\n\n # ping ingress from s and d to reach reachbilitity\n @logger.debug { \"splice_alternate_paths() issuing pings\" }\n pingable_ips = @isolation_issuer.check_pingability_from_other_vps!([outage.src, outage.dst_hostname], [ingress])\n return unless pingable_ips.include? ingress.ip\n\n @logger.debug { \"splice_alternate_paths() ingress router reachable\" }\n\n src_trace_to_ingress = @isolation_issuer.issue_normal_traceroutes(outage.src, ingress.ip)[ingress.ip]\n @logger.debug { \"normal trace: #{src_trace_to_ingress}\" }\n return unless src_trace_to_ingress.valid?\n # TODO: normal revtr rather than spoofed\n dst_revtr_from_ingress = issue_revtr(outage.dst_hostname, ingress.ip, [], false)\n @logger.debug { \"dst revtr: #{dst_revtr_from_ingress}\" }\n return unless dst_revtr_from_ingress.valid?\n\n outage.spliced_paths << SplicedPath.new(outage.src, outage.dst_hostname, ingress, src_trace_to_ingress, dst_revtr_from_ingress)\n\n # TODO check if path is policy-compliant\n else\n # src = outage.dst_hostname\n # dst = outage.src_ip\n end\n end",
"def getPaths (paths, pathToMe, from, ttl)\n if (pathToMe.contains(self)) \n return\n end\n\n ttl = ttl-1 # ?\n if (ttl == 0) \n return # Kill it off if the path is too long\n end\n\n pathIncludingMe = pathToMe.copy #or clone() per java orig?\n\t\n # if this is the start node 'from' will be nil\n if (from != nil) \n pathIncludingMe.push(from)\n end\n pathIncludingMe.addElement(self) \t# new path with me in it\n paths.add(pathIncludingMe) \t\t# add it to the other paths\n\n edges.each do |e| \n edge = e.pop\n if (edge == from) \n continue \n end\n\n otherEnd = edge.getOtherNode(self);\n\n # add paths for edges\n otherEnd.getPaths(paths, pathIncludingMe, edge, ttl);\n end\n end",
"def get_ants\n puts \"ANT FARM!\"\n ants = Array.new #ants could probably just be an array of hashes, since we don't yet need a full object...\n \n #make 100 ants\n num_ants = 100\n (0...num_ants).each do |i|\n ant = Ant.new(i)\n ants.push(ant)\n end\n \n edges_to_check = Set.new\n edges_by_node = @nodes.merge(@nodes) {|k| []}\n @edges.each do |e_id, edge|\n edges_to_check.add(e_id)\n edges_by_node[edge.a.id].push(e_id)\n edges_by_node[edge.b.id].push(e_id)\n end\n\n journeys = [[START]] #last item of journey array is the current island\n journeys.each do |path| #go through each journey on the path \n island = path[-1] #the last item is where we're moving from\n #grab all the edges connected to that path that are new or involve new terminals\n new_edge_ids = edges_by_node[island]\n new_edge_ids.each do |e_id|\n if edges_to_check.include?(e_id) #if new path to take\n new_path = path[0...-1] + [e_id, (@edges[e_id].a.id == island ? @edges[e_id].b.id : @edges[e_id].a.id)]\n # puts \"new path\",new_path.to_s\n journeys.push(new_path)\n edges_to_check.delete(e_id)\n end\n end\n end\n\n \n #check validity, and mark bad paths by maing them negative\n journeys.each do |path|\n path.slice!(-1) #remove the island from the path\n path.each_with_index do |e_id,i|\n if @validity[e_id] < 0 #if is not valid\n path[i] *= -1\n #path.slice!(i..-1) #remove the rest of the path, since we won't need it?\n end\n end\n end\n\n puts 'journeys: '+journeys.to_s, 'number of journeys: '+journeys.length.to_s \n\n #divide the journeys among the ants\n ants.each_with_index {|ant,i| ant.plan = journeys[(i+1)%journeys.length]}\n \n #puts \"ants we made\", ants\n return ants\n end",
"def recursive_traverse(node, current_state)\n Log.debug \"visiting #{node.name}\"\n current_state.timelines.first << node.name\n if node.downstream.empty?\n Log.debug \"#{node.name} has no downstream nodes. Reached end of timeline\"\n return current_state\n elsif node.downstream.size == 1\n Log.debug \"#{node.name} only one downstream node. Moving to it now.\"\n return recursive_traverse node.downstream.first, current_state\n else\n Log.debug \"#{node.name} has #{node.downstream.size} downstream nodes. Investigating merge options.\"\n\n timeline_forks = node.downstream.collect { |down|\n downstream_fork_states = recursive_traverse(down, TimelineState.new).timelines\n raise \"Downstream partial merge detected. This type of merge is not yet supported\" unless downstream_fork_states.size == 1\n downstream_fork_states.first\n }\n common_elems = timeline_forks.inject { |sum, nex| sum & nex }\n\n common_elem = common_elems.first\n base_forks = timeline_forks.select { |f| f.first.equal? common_elem }\n if common_elem.nil?\n current_state.state = 'No merge is possible'\n\n timelines = timeline_forks.collect { |f|\n (current_state.timelines + f).flatten\n }\n\n current_state.timelines = timelines\n\n elsif base_forks.empty?\n current_state.state = 'Partial merge is possible'\n\n common_elem_index = timeline_forks.first.find_index common_elem\n agreed_tail_arry = timeline_forks.first.slice(common_elem_index, timeline_forks.first.size - 1)\n\n disputed_events_array = timeline_forks.collect { |f|\n term = f.find_index common_elem\n f.slice(0, term)\n }\n\n # could iterate over permuations of parallel events here to list all possible timelines, but outside of problem description\n possible_timelines = disputed_events_array.collect { |p|\n (current_state.timelines + p + agreed_tail_arry).flatten\n }\n\n current_state.timelines = possible_timelines\n\n elsif base_forks.size == 1\n current_state.state = 'Merge is possible'\n Log.debug 'Full merge possible'\n\n longest_merge_array = timeline_forks.sort_by(&:size).last\n current_state.timelines = [(current_state.timelines + longest_merge_array).flatten]\n else\n raise 'Only one base fork should be found!'\n end\n\n end\n current_state\n end",
"def dag_longpath(source, sink, weight_edge_graph, graph)\n <<-DOC\n The backtracking method can be generalized to construct a longest path in any DAG. Whenever we compute S(b) as\n S(b) = max (all predecessors a of node b) {S(a) + weight_of_edge_from_a_to_b }\n we simply need to store a predecessor of b that was used in the computation of sb so that we can backtrack later on. \n You are now ready to use backtracking to find the longest path in an arbitrary DAG.\n DOC\n topo_graph = Marshal.load(Marshal.dump(graph))\n topo_nodes = topological_ordering(topo_graph)\n # puts topo_nodes.join(\" \")\n\n puts graph\n keys = graph.keys\n values = graph.values.flatten.uniq\n # puts keys.join(\" \")\n # puts values.join(\" \")\n nodes_with_indegree_zero = keys - values\n puts nodes_with_indegree_zero.join(\" \")\n\n puts weight_edge_graph.join(\" \")\n nodes_with_indegree_zero.each do |node|\n unless node == source\n topo_nodes.delete(node) \n weight_edge_graph.delete_if {|entry| /^#{node}->/.match(entry)}\n end\n end\n\n # nodes_to_consider = [source]\n # next_node = source\n # index = 1\n # loop do\n # break if next_node == sink\n # if graph[next_node]\n # graph[next_node].each do |node|\n # # puts node\n # nodes_to_consider << node unless nodes_to_consider.include?(node)\n # end\n # end\n # next_node = nodes_to_consider[index]\n # index += 1\n # end\n # puts \"nodes_to_consider: \" + nodes_to_consider.join(\" \")\n # topo_nodes.keep_if {|node| nodes_to_consider.include?(node)}\n puts \"topo nodes: \" + topo_nodes.join(\" \")\n\n puts weight_edge_graph.join(\" \")\n incoming_nodes = {}\n incoming_nodes[topo_nodes[0]] = [{\"pred_node\" => nil, \"weight\" => 0}]\n\n\n best_pred = {}\n topo_nodes.each do |node|\n # incoming_nodes[node] = [{\"pred_node\" => nil, \"weight\" => 0}]\n best_pred[node] = {\"pred_node\" => nil, \"weight\" => 0}\n end\n\n # puts weight_edge_graph.join(\" \")\n (1..(topo_nodes.length-1)).each do |i|\n node = topo_nodes[i]\n puts \"Node: \" + node\n all_weights = []\n weight_edge_graph.each do |entry| \n # puts \"Entry: \" + entry\n # puts best_pred\n if /(\\d+)->#{node}:(\\d+)/.match(entry) \n incoming_nodes[node] = [] unless incoming_nodes[node]\n pred_node_matched = /(\\d+)->#{node}:(\\d+)/.match(entry)[1]\n pred_node_weight = /(\\d+)->#{node}:(\\d+)/.match(entry)[2].to_i\n # puts /(\\d+)->#{node}:(\\d+)/.match(entry)[1]\n # puts /(\\d+)->#{node}:(\\d+)/.match(entry)[2]\n incoming_nodes[node] << {\"pred_node\" => pred_node_matched, \"weight\" => pred_node_weight}\n all_weights << (pred_node_weight + best_pred[pred_node_matched][\"weight\"])\n end\n end\n # puts all_weights.join(\" \")\n if incoming_nodes[node] \n # puts incoming_nodes[node]\n incoming_nodes[node].each do |pred_node_entry|\n # puts all_weights.join(\" \")\n if ((best_pred[pred_node_entry[\"pred_node\"]][\"weight\"] + pred_node_entry[\"weight\"]) == all_weights.max)\n best_pred[node][\"weight\"] = all_weights.max\n best_pred[node][\"pred_node\"] = pred_node_entry[\"pred_node\"]\n end\n end\n end\n end\n # puts incoming_nodes\n # puts best_pred\n length = best_pred[sink][\"weight\"]\n path = [sink]\n node = sink\n loop do\n puts node\n break if node == source\n node = best_pred[node][\"pred_node\"]\n path << node\n end\n return length, path.reverse\n end",
"def calc_path\n endpoint = grid.target\n while endpoint\n search.path[endpoint] = true\n endpoint = search.came_from[endpoint]\n end\n end",
"def backtrack\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # current x, y, target x, y and resulting path\n cx, cy, x, y, result = @tx, @ty, 0, 0, []\n # find the way back from destination to start\n loop do\n # change current coordinates\n cx, cy = cx - x, cy - y\n # stop if reached corrected start position\n break if cx == @sx && cy == @sy\n # add movement command\n pix.times {result.unshift(Cache::TDirs[@closed[cx, cy]])}\n # track back next node\n x, y = Cache::DirOffsets[@closed[cx, cy]]\n end\n # modify found path if pixel movement is being used\n modify(result) if pix > 1\n # return result\n return result\n end",
"def paths\n end_verts = ends\n paths = []\n vertices.each do |v|\n end_verts.each do |e|\n x = path?(v.id, e.id)\n if x.is_a?(Array)\n x[1] << v.data\n paths << x[1]\n end\n end\n end\n end_verts.each { |e| paths << e.data }\n paths\n end",
"def tangent_loop\n\t edges.map {|e| e.direction }.tap do |tangents|\n\t\t# Generating a bisector for each vertex requires an edge on both sides of each vertex.\n\t\t# Obviously, the first and last vertices each have only a single adjacent edge, unless the\n\t\t# Polyline happens to be closed (like a Polygon). When not closed, duplicate the\n\t\t# first and last direction vectors to fake the adjacent edges. This causes the first and last\n\t\t# edges to have bisectors that are perpendicular to themselves.\n\t\tif closed?\n\t\t # Prepend the last direction vector so that the last edge can be used to find the bisector for the first vertex\n\t\t tangents.unshift tangents.last\n\t\telse\n\t\t # Duplicate the first and last direction vectors to compensate for not having edges adjacent to the first and last vertices\n\t\t tangents.unshift(tangents.first)\n\t\t tangents.push(tangents.last)\n\t\tend\n\t end\n\tend",
"def create_paths_for_clearings\n CLEARING_ADJACENCY_LINKS.each do |clearing, adjacents|\n adjacents.each do |adj|\n clearings[clearing].add_path(clearings[adj])\n end\n end\n end",
"def traverse_graph(start_node_name, definitions, file_name)\n json_result = []\n all_paths = find_all_paths_from_node(start_node_name)\n all_paths = remove_subarrays(all_paths)\n\n all_paths.each do |path|\n p \"path: #{path}\"\n next if path.length < 2\n\n (0..path.length - 1).each do |i|\n break if i == path.length - 1\n break if @adj_matrix[path[i]].eql? nil\n break if @adj_matrix[path[i]][path[i + 1]].eql? nil\n\n @adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function')\n begin\n definitions.send(@adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function'))\n @adj_matrix[path[i]][path[i + 1]]['value'] = true\n rescue RuntimeError => e\n puts \"ERROR going from #{path[i]} to #{path[i + 1]}\"\n puts e.message.to_s\n # unless @adj_matrix[path[i]][path[i + 1]]['value'] = false\n # appended_error = @adj_matrix[path[i]][path[i + 1]]['label'].concat(\" \\nError: #{e.message}\")\n # @adj_matrix[path[i]][path[i + 1]]['label'] = appended_error\n # end\n @adj_matrix[path[i]][path[i + 1]]['value'] = false\n end\n\n temp = {}\n temp['source'] = path[i]\n temp['destination'] = path[i + 1]\n temp['label'] = @adj_matrix[path[i]][path[i + 1]]['label']\n temp['value'] = @adj_matrix[path[i]][path[i + 1]]['value']\n json_result.push(temp)\n end\n build_model(json_result, file_name)\n end\n build_model(json_result, file_name)\n end",
"def paths\n @trail.paths.dup\n end",
"def eulerian_path(graph)\n # We can just use the eulerian cycle problem by just choosing the \n # first node which has greater outdegree than indegree\n\n node = graph.keys[0]\n in_degrees = {}\n graph.values.flatten.each do |val|\n in_degrees[val] = 0 unless in_degrees.has_key?(val)\n in_degrees[val] += 1\n end\n # puts in_degrees.to_s\n graph.each do |k,v|\n if in_degrees.has_key?(k) and v.length > in_degrees[k]\n node = k\n break\n end\n unless in_degrees.has_key?(k)\n node = k\n break\n end\n end\n stack = [node]\n cycle = []\n while (not stack.empty?)\n node = stack[-1]\n if graph.has_key?(node)\n new_node = graph[node][0]\n # puts \"New node:\" + new_node\n stack << new_node\n if graph[node].length > 1\n graph[node].delete(new_node)\n else\n graph.delete(node)\n end\n else\n cycle.unshift(stack.pop)\n # puts stack.join(\" \")\n end\n end\n\n return cycle \n end",
"def detect_cycle_in_graph(edges)\nend",
"def find_level_dependencies_graph\n long_distance_dependents = Array.new\n @lvl_deps = @dd_deps.deep_clone\n @levels.sort.reverse.each do |pair|\n level, components = pair\n components.each do |component|\n long_distance_dependents.clear\n @dd_deps[component].each do |dependent|\n long_distance_dependents << dependent if level_of(dependent) < level-1\n end\n @lvl_deps[component] -= long_distance_dependents\n end\n end\n end",
"def unused_paths(start_node, end_node, graph)\n graph - shortest_path(start_node, end_node, graph)\n end",
"def reconstruct_path(came_from, current)\n while came_from.include?(current)\n current = came_from[current]\n current.path!\n end\n @start.start!\n @end.end!\n end",
"def seek_from_node(starting_node)\n puts \"seek started from node #{starting_node.inspect}...\"\n \n # -- PART I -- (starting from one node for now...) \n visited_nodes = grow_basic_path([ starting_node ])\n \n puts \"got basic path of length #{visited_nodes.length}, moving on to IIa)...\"\n \n # -- PART II a) --\n if visited_nodes.length < nodes.length\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n \n while target_nodes.length > 0\n puts \"TNL: #{target_nodes.length}\"\n visited_nodes = restructure_path(visited_nodes, target_nodes)\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n end\n end\n \n puts \"...done, moving on to IIb)...\"\n \n # -- PART II b) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes)\n end\n \n puts \"...done, moving on to IIc)...\"\n \n # -- PART II c) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes.reverse)\n end\n \n # -- PART III --\n results = {}\n \n if visited_nodes.length < nodes.length \n results[:path] = visited_nodes\n else\n results[:tour] = visited_nodes\n \n cycle_starts = connected_to(visited_nodes.first).map do |node|\n visited_nodes[visited_nodes.index(node) - 1]\n end\n cycle_ends = connected_to(visited_nodes.last)\n \n (cycle_starts & cycle_ends).each do |node|\n index = visited_nodes.index(node)\n \n circuit = visited_nodes[0..index] + [ visited_nodes.last ]\n circuit += visited_nodes[(index + 1 - visited_nodes.length)..-2].reverse\n \n results[:cycles] ||= []\n results[:cycles] << circuit\n end\n end\n \n results\n end",
"def each_edge #:yields: source, target, edge\n @pathway.relations.each do |rel|\n yield rel.node[0], rel.node[1], rel.relation\n end\n self\n end",
"def trace_path_back(node)\n node.path_values.reverse\n end",
"def fill_path_weights\r\n\r\n #for each vertex, each level, find the shortest path to every node from that node and then add that data to path_weights\r\n hashkeys = @vertices.keys\r\n hashkeys.each do |n|\r\n @current_world.rooms.each {\r\n |key, value|\r\n vertex = Vertex.new(key,value)\r\n @vertices[key] = vertex\r\n }\r\n\r\n vertex = @vertices[n]\r\n return_shortest_path(vertex)\r\n vertices2 = @vertices.clone\r\n @path_weights[vertex.title]=vertices2\r\n end\r\n end",
"def paths\n trail.paths.dup\n end",
"def solve\n graph = Graph.create(words, WordNode)\n graph.connect_nodes(:one_char_diff)\n\n end_node = graph.nodes_hash[end_word]\n start_node = graph.nodes_hash[start_word]\n start_node.cost = 0\n\n heap = Containers::Heap.new { |a, b| (a.cost <=> b.cost) == -1 }\n graph.nodes_hash.each do |k, v|\n heap.push v\n end\n\n puts heap.size\n # puts \"is empty?#{heap.empty?}\"\n until heap.empty? do\n current_node = heap.pop\n puts current_node.value, current_node.cost\n # puts current_node == end_node\n # puts current_node.value, end_node.value\n return graph.path(end_node) if current_node == end_node\n\n current_node.connected_nodes.each do |node|\n\n # puts node.visited\n unless node.visited\n cost = current_node.cost + 1\n if cost < node.cost\n node.cost = cost\n node.parent = current_node\n # puts \"changed parent\"\n # puts node.parent\n end\n end\n end\n\n current_node.visited = true\n end\n end",
"def dfs_tree_postorder(start, edges)\n require 'set'\n queue = [[start,nil]]\n visited = Set[start]\n bq = []\n while queue.size > 0\n f = queue.pop\n bq << f\n ts = edges[f[0]].keys.reject{ |t| visited.member?(t) }\n ts.each{ |t| visited << t; queue << [t,f[0]] }\n end\n bq.reverse_each{ |f| yield(*f) }\nend",
"def process_path(expression)\n add_debug(\"process_path\", expression.inspect)\n\n pathitem = expression[:pathitem]\n pathtail = expression[:pathtail]\n \n direction_list = [expression[:direction], expression[:directiontail]].flatten.compact\n\n pathtail.each do |pred|\n direction = direction_list.shift\n bnode = RDF::Node.new\n if direction == :reverse\n add_triple(\"process_path(reverse)\", bnode, pred, pathitem)\n else\n add_triple(\"process_path(forward)\", pathitem, pred, bnode)\n end\n pathitem = bnode\n end\n pathitem\n end",
"def watch_appropriate_nodes\n remaining_paths.last( threshold + 1 ).reverse_each do |path|\n next if watched_paths.include? path\n watched_paths << path\n finish_node(path) unless zk.exists?(path, :watch => true)\n end\n end",
"def longest_path_1(edges)\nend",
"def make_paths\n visited = {}\n path = []\n return path if @nmap.empty? || @nnmap.empty?\n\n # 0 is false\n @nmap.each do |k, _|\n visited[k] = 0\n end\n\n # for each node that is not an end node to an end node\n @nnmap.each do |s, _|\n # if s is an end node\n @paths << [s] if @ends.include? s\n\n # for each end node as desintation\n @ends.each do |d|\n get_allpaths(s, d, visited, path)\n end\n end\n @paths.sort_by(&:length).reverse\n end",
"def update_relationship_graph(resources)\n rel_graph = catalog.relationship_graph\n inserted_edges = []\n resources.map {|res| res.builddepends}.flatten.each do |dep|\n unless !!rel_graph.edge?(dep.source, dep.target)\n rel_graph.add_edge dep\n inserted_edges << dep\n end\n end\n\n begin\n rel_graph.report_cycles_in_graph\n rescue Puppet::Error => err\n debug 'There are cycles in graph (see error below). Need to remove recently added edges'\n inserted_edges.each {|edge| rel_graph.remove_edge! edge }\n raise\n end\n end",
"def trace_path_back(end_node)\n path = []\n\n current_node = end_node\n until current_node.nil?\n path << current_node\n current_node = current_node.parent\n end\n\n path\n end",
"def lesstrips(start, finish, max_distance)\n total_paths, distance = 0, 0\n path, paths = [], []\n visited = [start]\n cycles = all_cycles # all cycles in graph\n puts \"MAX DISTANCE = #{max_distance}\\n\"\n total_paths += lesstrips_dfs(start, finish, max_distance, distance, visited, path, paths, cycles)\n puts \"\\n==> Total paths from #{start} to #{finish}, with distance < #{max_distance}: #{total_paths}\\n\"\n total_paths\n end",
"def back_paths!\n path_ids = session[:path_ids]\n new_path_ids = path_ids.split( \"|\" )\n new_path_ids.pop\n \n path_names = session[:path_names] \n new_path_names = path_names.split( \"|\" )\n new_path_names.pop\n \n update_paths!( new_path_ids.join( \"|\" ), new_path_names.join( \"|\" ) )\n end",
"def trace_path(direction)\n result = []\n current_position = position\n while valid_position?(current_position)\n current_position = current_position.zip(direction).map(&:sum)\n break if valid_position?(current_position)\n\n result << current_position\n \n break unless board.empty?(current_position)\n end\n result\n end",
"def each_relation_edge(rg)\n rg.nodes.each { |node|\n [:src,:dst].each { |rg_level|\n next unless node.get_block(rg_level)\n node.successors(rg_level).each { |node2|\n if node2.type == :exit || node2.get_block(rg_level)\n yield IPETEdge.new(node,node2,pml_level(rg_level))\n end\n }\n }\n }\n end",
"def propagate(deco, edge)\n deco\n end",
"def enum_moves\n @scratch = dup_maze(@maze)\n @locs.each_with_index do |loc, robot|\n @cost = 1\n leading_edge = [loc]\n loop do\n next_edge = []\n leading_edge.each do |x, y|\n next_edge.concat search_from(x, y, robot)\n end\n break if next_edge.empty?\n leading_edge = next_edge\n @cost += 1\n end\n end\n\n @moves\n end",
"def get_path(double_array, path_cost, path_time)\n double_array.each do |path|\n correct_path = []\n cost = 0\n time = 0\n count = 0\n until count == path.size - 1\n correct_edge = @edge_array.find { |i| \n i.source == path[count] && i.destination == path[count+1] \n }\n cost += correct_edge.cost\n time += correct_edge.time\n count += 1\n end\n if cost == path_cost && time == path_time\n return path\n end\n end\n end",
"def apply(remaining_path, enum, resolved_path)\n Enumpath.log('Applying remaining path recursively to enum') { { 'remaining path': remaining_path } }\n yield(remaining_path, enum, resolved_path)\n keys(enum).each do |key|\n value = Enumpath::Resolver::Simple.resolve(key, enum)\n next unless recursable?(value)\n\n Enumpath.log('Applying remaining path recursively to key') do\n { key: key, 'remaining path': ['..'] + remaining_path }\n end\n yield(['..'] + remaining_path, value, resolved_path + [key])\n end\n end",
"def path(source, target, meta)\n # retrieve the path to the target node, using the meta hash\n # that was constructed at each iteration of the `each` iteration\n predecessor = target\n result_path = []\n\n # follow the leads from the back\n until predecessor == source\n result_path << predecessor.number\n predecessor = meta[predecessor]\n end\n\n # add the source, since now `predecessor == source` is true\n result_path << source.number\n result_path.reverse.join(\", \")\nend",
"def move_diffs\n\n end",
"def find_alternative_paths\n reset\n \n @pairs.reverse!\n find_paths\n @pairs.reverse!\n\n @pairs.map{|pair| pair.path}\n end",
"def make_adjlists(layout)\n layout.each do |edge|\n start = edge.village1\n ending = edge.village2\n color = edge.color\n type = edge.type_transit\n layout.each do |surround| \n if surround.village1 == ending && surround.village2 != start\n if surround.color == color || surround.type_transit == type\n edge.add_adjlist(surround)\n end\n end\n end\n end\nend",
"def update_content_paths\n\n # Checking if the parent id has changed for the current content have to change the content paths table only if parent id is changed\n new_parent_id = ContentData.get_parent_id(self.id)\n\n # Getting the old parent data from the content path table\n old_parent_id = 0\n old_parent = ContentPath.where(:descendant => self.id, :depth => 1)\n # If there are any parents found with the getting the old parent id\n if old_parent.length > 0\n old_parent_id = old_parent.first.ancestor\n end\n\n # If the parent id is changed then update the content path structure\n if new_parent_id != old_parent_id\n\n # Refer to the article \"http://www.mysqlperformanceblog.com/2011/02/14/moving-subtrees-in-closure-table/\" for the logic\n # Detach the node from the old parent \n delete_query = \"DELETE a FROM content_paths AS a JOIN content_paths AS d ON a.descendant = d.descendant LEFT JOIN content_paths AS x ON x.ancestor = d.ancestor AND x.descendant = a.ancestor WHERE d.ancestor = '\"+self.id.to_s+\"' AND x.ancestor IS NULL\"\n ActiveRecord::Base.connection.execute(delete_query)\n\n # Attach the node to the new parent\n insert_query = \"INSERT INTO content_paths (ancestor, descendant, depth) SELECT supertree.ancestor, subtree.descendant, supertree.depth+subtree.depth+1 FROM content_paths AS supertree JOIN content_paths AS subtree WHERE subtree.ancestor = '\"+self.id.to_s+\"' AND supertree.descendant = '\"+new_parent_id.to_s+\"'\"\n ActiveRecord::Base.connection.execute(insert_query)\n\n ## The code for changing the childrens data of the edited node with the new parent data\n ## Getting the data of the new parent\n new_parent_data = Content.find(new_parent_id)\n\n ## Board is at the top level no need to change the children data\n if self.type == 'Board'\n\n ## Content year parent is changed update all the children with the current board id\n elsif self.type == 'ContentYear'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id)\n end\n\n ## Subject parent is changed update all the children with the curent board id and content year id\n elsif self.type == 'Subject'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id)\n end\n\n ## Chapter parent is changed update all the children with the current board id , content year id and subject id\n elsif self.type == 'Chapter'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id, :subject_id => self.subject_id)\n end\n\n ## Topic parent is changed update all the children with the current board id, content year id, subject id and chapter id\n elsif self.type == 'Topic'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id, :subject_id => self.subject_id, :chapter_id => self.chapter_id)\n end\n\n ## Subtopic parent is changed update all the children with the current board id, content year id, subject id, chapter id and topic id\n elsif self.type == 'SubTopic'\n if self.children.map(&:descendant).length > 1\n Content.where(:id => self.children.map(&:descendant)).update_all(:board_id => self.board_id, :content_year_id => self.content_year_id, :subject_id => self.subject_id, :chapter_id => self.chapter_id, :topic_id => self.topic_id)\n end\n end\n\n ## End of code for changing the childrens data\n\n end\n end",
"def get_paths(source, target, iterate_only_if=nil, &result_filter)\n iterate_only_if = result_filter if iterate_only_if.nil?\n queue=[[0, source]]\n result=[]\n while queue.any?\n node = queue.shift\n @graph.each_adjacent(node.last) do |edge, weight|\n nnode = node.dup\n nnode[0]= node[0] + weight\n nnode << edge\n nlevel = nnode.length - 2\n if edge == target\n if result_filter.call(nnode[0], nlevel)\n result << nnode\n end\n end\n\n if iterate_only_if.call(nnode[0], nlevel)\n queue << nnode\n end\n end\n end\n result\n end",
"def augment_path!()\n # Find smallest uncovered element\n e_min = nil\n @cost_matrix.each_with_index{|row,r|\n next if @rows_covered[r]\n row.each_with_index{|e,c|\n next if @cols_covered[c]\n next if e == IMPOSSIBLE\n e_min ||= e\n e_min = e if e < e_min\n }\n }\n\n # Add min element to each covered row\n @rows_covered.each_with_index{|status,r|\n next if !status\n @cost_matrix[r].map!{|e| e + e_min}\n }\n\n # Subtract min element from each uncovered column\n @cols_covered.each_with_index{|status,c|\n next if status\n @cost_matrix.set_col!(c, @cost_matrix.col(c).map{|e| e - e_min})\n }\n return 4\n end",
"def all_paths_source_target(graph)\n current_path = []\n results = []\n\n dfs(graph, results, 0, current_path)\n return results\nend",
"def find_paths_backward(&block)\n find_paths do\n follow { |n| n.in }\n instance_eval(&block)\n end \n end",
"def update_List_ptr(scan, l_act_edge)\n while (l_act_edge.next.y_top >= scan)\n l_act_edge=l_act_edge.next\n end\n \n return l_act_edge\n end",
"def descend\n next_descend = path\n while next_descend != PathExpression.EMPTY\n dir, next_descend = Optimizers.descend(path)\n yield dir\n end\n end",
"def path( peer )\n inter1 = self.intersection( peer.pos.to_gpos )\n inter2 = peer.intersection( self.pos.to_gpos )\n inter1.to_a + inter2.to_a\n end",
"def calculate_route\n\t\t@cl = init_loc\n\t\t@steps << cl\n\n\t\twhile not at_rightmost_side?\n\t\t\t@cl = next_step\n\t\t\t@steps << cl\n\t\tend \t\t\n\tend",
"def edges\n @structure.reduce([]) do |acc, node|\n acc + node[1].map { |dest| [node[0], dest] }\n end\n end",
"def path_finder \n until queue.empty? \n current_node = queue.shift()\n generate_neighbours(current_node)\n current_node.neighbour_nodes.each do |neighbour|\n track_visited(current_node, neighbour)\n correct_node?(neighbour) ? (return neighbour.visited) : (queue << neighbour)\n end\n end\n end",
"def topsort\n degree = {}\n zeros = []\n result = []\n\n # Collect each of our vertices, with the number of in-edges each has.\n @vertices.each do |name, wrapper|\n edges = wrapper.in_edges\n zeros << wrapper if edges.length == 0\n degree[wrapper.vertex] = edges\n end\n\n # Iterate over each 0-degree vertex, decrementing the degree of\n # each of its out-edges.\n while wrapper = zeros.pop do\n result << wrapper.vertex\n wrapper.out_edges.each do |edge|\n degree[edge.target].delete(edge)\n zeros << @vertices[edge.target] if degree[edge.target].length == 0\n end\n end\n\n # If we have any vertices left with non-zero in-degrees, then we've found a cycle.\n if cycles = degree.find_all { |vertex, edges| edges.length > 0 } and cycles.length > 0\n message = cycles.collect { |vertex, edges| edges.collect { |e| e.to_s }.join(\", \") }.join(\", \")\n raise Puppet::Error, \"Found dependency cycles in the following relationships: %s; try using the '--graph' option and open the '.dot' files in OmniGraffle or GraphViz\" % message\n end\n\n return result\n end",
"def nodes_downward\n LinkEnumerator.new :down, self\n end",
"def path_directions(path)\n directions = []\n return directions if path.size < 2\n (0...path.size-1).each do |i|\n diff = path[i].to_i - path[i+1].to_i\n if diff.abs >= w\n if diff > 0\n directions << 'up'\n else\n directions << 'down'\n end\n else\n if diff < 0\n directions << 'right'\n else\n directions << 'left'\n end\n end\n end\n directions\n end",
"def each_adjacent(node)\n # TODO Return costs from cost function.\n # Yield nodes corresponding to substitution, insertion, and deletion\n # operations if the edges have not been deleted from the graph.\n i = node[0]\n j = node[1]\n # Move diagonally to yield a substitution.\n if i < @cols.length-1 and j < @rows.length-1 and\n not @deleted.include?([i+1, j+1])\n col_item = @cols[i+1]\n row_item = @rows[j+1]\n yield [[i+1, j+1], @weighted.call(:substitue, [col_item, row_item])]\n end\n # Move vertically to yield an insertion.\n if j < @rows.length-1 and not @deleted.include?([i, j+1])\n yield [[i, j+1], @weighted.call(:insert, @rows[j+1])]\n end\n # Move horizontally to yield a deletion.\n if i < @cols.length-1 and not @deleted.include?([i+1,j])\n yield [[i+1, j], @weighted.call(:insert, @cols[i])]\n end\n end",
"def next_step_from(paths)\n paths.map do |path|\n possible_neighbours(path.most_recent_step.coordinate, @max_x, @max_y) \n .map { |c| coord_to_step_on_path(c, path) }\n .reject { |p| p == nil }\n end\n .flatten\n end",
"def node_update_path(node_id)\n node_ids = []\n visit_path_to_root node_id do |path_node_id|\n node_ids << path_node_id\n node_ids << sibling(path_node_id) unless path_node_id == root_node_id\n end\n node_ids\n end",
"def path_to(node)\n return unless @visited.include?(node)\n path = []\n while(node != @node) do\n path.unshift(node) \n node = @edge_to[node]\n end\n path.unshift(@node)\n end",
"def find_paths(current_node, target_node, current_path=[])\n \tcurrent_path.push(current_node)\n \tif current_node == target_node\n \t\t@found_paths.push(current_path.dup)\n \telse\n \t\t@adjacency_list[current_node].each do |child|\n \t\t\tfind_paths(child, target_node, current_path)\n \t\tend\n \tend\n \tcurrent_path.pop\n end",
"def resolve_dependencies(prev_deps, curr_deps)\n added = curr_deps - prev_deps\n deleted = prev_deps - curr_deps\n split_dependencies(added, deleted)\n end",
"def path_states\n @__cache__[:path] ||= @superstate ? [*@superstate.path_states, self] : [self] # recursion\n end",
"def dfs_helper(start_node)\n\n ret_list = [start_node.value]\n # Your code here\n start_node.visited = true\n start_node.edges.each do |edge|\n unless edge.node_to.visited\n ret_list += dfs_helper(edge.node_to)\n end\n end\n return ret_list\n end",
"def calculate_path_size\n t0 = Time.now\n path_sizes = {0 => 0.0, 1 => 0.0, 2 => 0.0, 4 => 0.0, 10 => 0.0, Float::INFINITY => 0.0}\n\n # Retrieves all routes provenient from the same trip\n sibling_routes = AlternateRoute.where(:trip_id => @route.trip_id)#.where(\"state != 'discarded'\")\n\n # Get segment-based mileage for all sibling routes\n sibling_routes_mileage = calculate_routes_mileage(sibling_routes)\n\n # Remove the main route from sibling routes group\n sibling_routes = (sibling_routes.map{|r| r.id} - [@route.id])\n\n # Generate frequencies of each route segment over alternate routes\n frequencies = {}\n appearances = Segment.where(:osm_way_id => @segment_ids).group_by {|s| s.osm_way_id}\n appearances.each do |k, v|\n frequencies[k] = v.map{|e| e.alternate_route_id}.uniq - [nil]\n end\n\n @route.segments.each do |segment|\n segment_length = segment.length\n\n impedance = segment_length/sibling_routes_mileage[@route.id]\n\n # Get all sibling routes where the current segment is used\n ocurrences = frequencies[segment.osm_way_id] & sibling_routes\n #ocurrences = AlternateRoute.joins(:segments).where(:id => sibling_routes).where(\"segments.osm_way_id = ?\", segment.osm_way_id).references(:segments).pluck(:id).uniq\n\n path_sizes.keys.each do |gamma|\n sums = {0 => 1.0, 1 => 1.0, 2 => 1.0, 4 => 1.0, 10 => 1.0, Float::INFINITY => 1.0}\n\n ocurrences.each do |route|\n if gamma == Float::INFINITY\n # if (sibling_routes_mileage[@route.id]/sibling_routes_mileage[route]) > 1.0\n if (sibling_routes_mileage.values.min/sibling_routes_mileage[route]) > 1.0\n sums[gamma] = 0.0\n end\n else\n # sums[gamma] += (sibling_routes_mileage[@route.id]/sibling_routes_mileage[route])**gamma\n # sums[gamma] += (sibling_routes_mileage.values.min/sibling_routes_mileage[route])**gamma\n sums[gamma] += (sibling_routes_mileage.values.min/sibling_routes_mileage[route])**gamma**@route.systems_suggested\n end\n end\n\n if gamma == Float::INFINITY\n path_sizes[gamma] += (impedance * sums[gamma])\n else\n path_sizes[gamma] += (impedance * (1.0/sums[gamma]))\n end\n end\n end\n puts \"[#{@route.id}] Completed in #{(Time.now - t0)* 1000.0} ms\"\n puts \"[#{@route.id}] Path Size: #{path_sizes}\"\n path_sizes\n end",
"def get_edge_list\n e_list = []\n\n @edges.each do |e|\n e_list << [e.value, e.node_from.value, e.node_to.value]\n end\n\n e_list\n end",
"def path_layers limit=100\n layers = []\n\n remaining = @nodes.dup\n\n loop do\n raise 'Exceeded threshold of 100, graph contains loop!' if limit == 0\n break if remaining.empty?\n layer = []\n DirectedAdjacentGraph.reverse(remaining).each_pair do |dest_val, dest_node|\n if dest_node.empty?\n layer.push dest_val\n remaining.delete dest_val\n end\n end\n layers.push layer\n limit -= 1\n end\n\n layers\n end",
"def propagate_properties\n queue = []\n visited = []\n\n queue.push self.id\n #visited.push self.id\n\n while not queue.empty?\n answer_id = queue.shift\n\n answer = Answer.find(answer_id)\n\n puts \">>> #{answer.id}\"\n\n for similar_answer in answer.similar_answers do\n unless visited.include?(similar_answer)\n changed = Answer.propagate_properties_to_neigh(answer,similar_answer)\n if changed\n queue.push similar_answer\n end\n end\n end\n visited.push answer_id\n puts \"<<< #{answer.id}\"\n end\n true\n end",
"def topological_sort(vertices)\n #Kahn's Algorithm\n #queue keeps the nodes that have not been sorted yet\n #whatever is popped off the stack goes to sorted and is done\n queue = []\n sorted = []\n\n #loop through vertices\n vertices.each do |vertex|\n #find vertices with no dependencies and push to queue\n queue << vertex if vertex.in_edges.empty?\n end\n\n #pop off from queue and check the out edges of each\n #after pop, delete the vertex all its out edges\n #push that vertex into the sorted array\n #look at each of the destination nodes and push them onto queue if no in edges\n #do this until the queue is empty\n until queue.empty?\n curr_node = queue.shift\n\n sorted << curr_node\n to_vertices = []\n\n #grabs all the vertices connected to the out edges of the curr_node\n curr_node.out_edges.reverse.each do |out_edge|\n # until curr_node.out_edges.empty?\n\n\n # p out_edge.to_vertex.value\n to_vertices << out_edge.to_vertex\n\n #destroy the edge after using it up\n #destroy not working like how I thought it would, maybe save destroy for after\n\n # out_edge.destroy!\n out_edge.destroy!\n end\n\n #need to check if these vertices are connected to anything after\n #curr_node's out edge deletion\n to_vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n #check all vertices connected by curr_node's out_edges\n #if those\n end\n\n if sorted.length == vertices.length\n return sorted\n else\n return []\n end\n\n \n # easy_read = []\n # sorted.each do |vertex|\n # easy_read << vertex.value\n # end\n # p easy_read\n\n\n\n #Tarjan's Algorithm\nend",
"def calculate_edges\n es = [{:left_table=>self[:model].table_name, :left_key=>self[:left_primary_key_column]}]\n self[:through].each do |t|\n es.last.merge!(:right_key=>t[:left], :right_table=>t[:table], :join_type=>t[:join_type]||self[:graph_join_type], :conditions=>(t[:conditions]||[]).to_a, :block=>t[:block])\n es.last[:only_conditions] = t[:only_conditions] if t.include?(:only_conditions)\n es << {:left_table=>t[:table], :left_key=>t[:right]}\n end\n es.last.merge!(:right_key=>right_primary_key, :right_table=>associated_class.table_name)\n edges = es.map do |e| \n h = {:table=>e[:right_table], :left=>e[:left_key], :right=>e[:right_key], :conditions=>e[:conditions], :join_type=>e[:join_type], :block=>e[:block]}\n h[:only_conditions] = e[:only_conditions] if e.include?(:only_conditions)\n h\n end\n reverse_edges = es.reverse.map{|e| {:table=>e[:left_table], :left=>e[:left_key], :right=>e[:right_key]}}\n reverse_edges.pop\n calculate_reverse_edge_aliases(reverse_edges)\n final_reverse_edge = reverse_edges.pop\n final_reverse_alias = final_reverse_edge[:alias]\n\n h = {:final_edge=>edges.pop,\n :final_reverse_edge=>final_reverse_edge,\n :edges=>edges,\n :reverse_edges=>reverse_edges,\n :predicate_key=>qualify(final_reverse_alias, edges.first[:right]),\n :associated_key_table=>final_reverse_edge[:alias],\n }\n h.each{|k, v| cached_set(k, v)}\n h\n end",
"def removeFutureEdges4(currentComp,rootTx,depMgr,txDepRegistry)\n logger = depMgr.logger\n logger.debug \"#{currentComp}.vc.removeFutureEdge4 \"\n outDepRegistry = depMgr.outDepRegistry\n inDepRegistry = depMgr.inDepRegistry\n \n outFutureDeps = outDepRegistry.getDependencesViaType(FUTURE_DEP)\n outFutureOneRoot = Set.new # HashSet<Dependence>\n \n outFutureDeps.each{|dep|\n \n if dep.rootTx == rootTx && dep.srcCompObjIdentifier != dep.targetCompObjIdentifier\n outFutureOneRoot << dep\n end\n }\n \n inFutureFlag = false\n \n futureDeps = inDepRegistry.getDependencesViaType(FUTURE_DEP)\n \n futureDeps.each{|dep|\n if dep.rootTx == rootTx && dep.srcCompObjIdentifier != dep.targetCompObjIdentifier\n inFutureFlag = true\n break\n end\n } \n \n willNotUseFlag = true\n \n outFutureOneRoot.each{|dep|\n \n if !inFutureFlag\n localTxs = depMgr.getTxs() #Map<String , TxContext>\n \n localTxs.each{|key,txCtx|\n \n if txCtx.isFakeTx\n next\n end\n \n fDeps = txDepRegistry.getLocalDep(txCtx.currentTx).futureComponents #Set<String>\n \n fDeps.each{|fdep|\n \n if fdep == dep.targetCompObjIdentifier && txCtx.getProxyRootTxId(depMgr.scope) == rootTx\n willNotUseFlag = false\n break\n end\n }\n \n if !willNotUseFlag\n break\n end\n \n }\n \n if willNotUseFlag\n logger.debug \"#{currentComp}.vc.removeFutureEdges4 will not use in future\"\n scope = depMgr.scope\n \n if scope!=nil && !scope.subComponents[dep.srcCompObjIdentifier].include?(dep.targetCompObjIdentifier)\n next\n end\n \n outDepRegistry.removeDependenceViaDep(dep)\n logger.debug \"after removeDep,outDepRegistry = #{outDepRegistry}\"\n payload = ConsistencyPayloadCreator.createPayload4(dep.srcCompObjIdentifier, dep.targetCompObjIdentifier, dep.rootTx,DepOperationType::NOTIFY_FUTURE_REMOVE)\n # notify testing\n logger.debug \"#{currentComp}.vc.removeFutureEdges4 payload #{payload}\"#\n #syncPost(dep.srcCompObjIdentifier, dep.targetCompObjIdentifier , \"algorithm_type\" , \"dependence_msg\", payload)\n depNotify(dep.srcCompObjIdentifier,dep.targetCompObjIdentifier,payload)\n else\n logger.debug \"#{currentComp}.removeFutureEdges4 , willNotUseFlag = false\"\n end\n end\n \n }\n \n return true\n end"
] |
[
"0.62411374",
"0.62360907",
"0.6047809",
"0.5985783",
"0.5910766",
"0.5830609",
"0.5825539",
"0.5752207",
"0.5711932",
"0.5674154",
"0.5651939",
"0.5651901",
"0.56508017",
"0.5612326",
"0.559967",
"0.55041397",
"0.54917574",
"0.54699093",
"0.54525536",
"0.54443985",
"0.54124105",
"0.54029715",
"0.53883064",
"0.53679484",
"0.5356658",
"0.5345808",
"0.53374386",
"0.5326025",
"0.5312041",
"0.5309008",
"0.52960324",
"0.52880955",
"0.52864903",
"0.5285511",
"0.5280113",
"0.527568",
"0.5267195",
"0.52359045",
"0.5234293",
"0.5224441",
"0.5215092",
"0.5193546",
"0.5189174",
"0.51885045",
"0.5187456",
"0.5178692",
"0.5161294",
"0.5158525",
"0.51442987",
"0.5134385",
"0.5132355",
"0.51310456",
"0.5130925",
"0.51293236",
"0.5124124",
"0.5122725",
"0.5121423",
"0.51138633",
"0.51120573",
"0.51072705",
"0.51054937",
"0.5091318",
"0.5089722",
"0.50881",
"0.5082488",
"0.5068195",
"0.505802",
"0.5056813",
"0.5050866",
"0.5044747",
"0.5042534",
"0.5039884",
"0.5039648",
"0.5036045",
"0.5035743",
"0.5028198",
"0.5025104",
"0.5015894",
"0.50107306",
"0.50070906",
"0.50055796",
"0.500524",
"0.5004963",
"0.50016755",
"0.49969998",
"0.4990899",
"0.4989726",
"0.49768102",
"0.49661505",
"0.4965868",
"0.4963233",
"0.49629453",
"0.49573705",
"0.49456912",
"0.49456277",
"0.4943732",
"0.49431247",
"0.49422187",
"0.49414027",
"0.49298763",
"0.49251056"
] |
0.0
|
-1
|
Pass a module with filter methods which should be available to all liquid views. Good for registering the standard library
|
def register_filter(mod)
StrainerFactory.add_global_filter(mod)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def register_filter(mod); end",
"def liquid_view_filters\n []\n end",
"def register_filter(mod)\n Strainer.global_filter(mod)\n end",
"def global_filter; end",
"def liquid_filters\n [\n DesignResourceFilter,\n AttributeFilter\n ]\n end",
"def filters\n end",
"def strict_filters; end",
"def filter_methods; end",
"def filters; end",
"def filters; end",
"def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end",
"def add_filters(filters); end",
"def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"def before_filter; end",
"def named_filter; end",
"def filters\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n list = [\n {\n :display => 'This source does not define any filter',\n :value => 'invalid'\n }\n ]\n filters_module = (RUBY_VERSION < '1.9') ? 'Filters' : :Filters\n if (@source.constants.include?(filters_module))\n list.clear\n @source::Filters.constants.each do |filter_name|\n filter = \"#{@source.name}::Filters::#{filter_name}\".constantize \n list << { \n :display => \"#{filter_name}: #{filter::NAME}\", \n :value => filter_name \n }\n end\n end\n \n render :json => list\n }\n end\n end",
"def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end",
"def before_filter(&block)\n @before_filter = block\n end",
"def filters\n @filters ||= FiltersProvider.new\n end",
"def apply_filter\n end",
"def filters_for_user(user)\n user.present? ? filters_with_external : public_filters\n end",
"def filter_pipeline\n @filter_pipeline ||= HTML::Pipeline.new([TypogrubyFilter])\n end",
"def validate_filter()\n filter_module = (RUBY_VERSION < '1.9') ? params[:filter] : params[:filter].to_sym\n if (params.key?(:filter) && @source::Filters::constants.include?(filter_module))\n @filter = \"#{@source.name}::Filters::#{params[:filter]}\".constantize\n else\n redirect_to root_path\n end\n end",
"def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end",
"def ensure_filters\n # private_methods returns the list of private methods accessible to obj. If the all parameter is set to\n # false, only those methods in the receiver will be listed.\n private_methods(false).grep(/\\Afilter_by_/)&.each { |filter| send(filter) }\n end",
"def filter(&callable)\n filters << callable\n end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def each_module_filter(opts, name, entry)\n\t\treturn false\n\tend",
"def filter\n end",
"def liquid_method_missing(method); end",
"def strict_filters=(_arg0); end",
"def filter(name, **options)\n define_method(name) { options }\n end",
"def filter\n super\n end",
"def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end",
"def url_helpers_module; end",
"def define_filter(name, &block)\n filters[name.to_sym] = block\n nil\n end",
"def global_filter=(_arg0); end",
"def filter(name, &block)\n warn [\n \"NOTE: The fixed `filter` class method is deprecated.\",\n \"This will be removed in 0.22. Use the API for modifers instead.\"\n ].join\n registry.filter(name, &block)\n end",
"def custom_filters(scope)\n scope\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def module_info(opts)\n opts = check_params(opts,[:filter])\n super(opts)\n end",
"def filter_rspamd\n end",
"def advanced_filters_provided?\n true\n end",
"def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end",
"def filters\n @filters ||= {}\n end",
"def test_add_filter\n flunk\n end",
"def index\n @filter_methods = FilterMethod.all\n end",
"def liquid_renderer; end",
"def apply_filters(methods)\n filters.inject(methods) { |methods, filter| filter.apply(methods, self) }\n end",
"def filter(type, &b)\n @app.filters[type] << b\n end",
"def add_terms_filters\n add_work_type_filter\n add_user_filter\n add_pseud_filter\n add_collection_filter\n end",
"def add_filter\n @filter = true \n end",
"def initialize(filter_type)\n @filter_type = filter_type\n begin\n filter_module = self.class.const_get(filter_type.to_s.gsub(/^([a-z])/) {|e| $1.upcase })\n self.extend(filter_module)\n rescue NameError\n raise FilterNotFoundError\n end\n end",
"def or_filters_provided?\n true\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def before method_or_filter, options={}, &block\n _add_filter(:before, method_or_filter, options, block)\n end",
"def filter_by_extension\n if item[:extension] == \"haml\"\n filter :haml\n else\n filter :erb\n filter :kramdown, coderay_line_numbers: :table\n end\nend",
"def install_helpers # :nodoc:\n mod = @module\n ActionView::Base.class_eval do\n include mod\n end\n end",
"def get_filter(filter_name)\n \n java_import (Filter_package_name + filter_name.to_s)\n\n Module.const_get(filter_name).new\n \n end",
"def filters\n [\n HTML::Pipeline::SanitizationFilter,\n\n Gitlab::Markdown::EmojiFilter,\n\n Gitlab::Markdown::UserReferenceFilter,\n Gitlab::Markdown::IssueReferenceFilter,\n Gitlab::Markdown::ExternalIssueReferenceFilter,\n Gitlab::Markdown::MergeRequestReferenceFilter,\n Gitlab::Markdown::SnippetReferenceFilter,\n Gitlab::Markdown::CommitRangeReferenceFilter,\n Gitlab::Markdown::CommitReferenceFilter,\n Gitlab::Markdown::LabelReferenceFilter,\n ]\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def include_helpers(scope); end",
"def filter(*args); Typelib.filter_function_args(args, self) end",
"def filters\n self.class.filters\n end",
"def render_with_filters\n render action: :formatted_xml_erb\n end",
"def run_filters\n set_user\n authorize\n end",
"def _filter_display\n @apotomo_emit_raw_view = true\n render :view => '_filters'\n end",
"def modules_for_helpers(args); end",
"def before_filter(filter_name, options)\n [options[:only]].flatten.each do |action|\n add_filter(filter_name, action)\n end\n end",
"def allowed_filters\n []\n end",
"def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end",
"def all_application_helpers; end",
"def stradivari_filter(stradivari_filter_options)\n raise NotImplementedError\n end",
"def add_filter(filter_symbol)\n filters << filter_symbol\n end",
"def before_filter(method_name, options = {})\n raise StandardError, \"List of filters must be a whitelist\" unless options.has_key?(:only)\n raise StandardError, \"List of filters must be an array\" unless options[:only].kind_of?(Array)\n filters[method_name] = options[:only]\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def before_filter(&block)\n @before_filter = block\n end",
"def filtered_methods\n @filtered_methods ||= []\n end",
"def preserve_default_filters!\n\n config.preserve_default_filters!\n\n end",
"def global_filter(&block)\n @filters[nil] = block\n end",
"def filter(options={})\n raise NotImplementedError\n end",
"def gantt_filter\n render(:partial => \"tasks/filter\", \n :locals => { \n :redirect_action => \"gantt\",\n :hide_grouping => true,\n :hide_colors => true,\n :hide_icons => true,\n :hide_organize => true,\n :hide_hide_dependencies => true\n })\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def process_before_filter name\n filter = find_method name, @current_class\n\n if filter.nil?\n Brakeman.debug \"[Notice] Could not find filter #{name}\"\n return\n end\n\n method = filter[:method]\n\n if ivars = @tracker.filter_cache[[filter[:controller], name]]\n ivars.each do |variable, value|\n env[variable] = value\n end\n else\n processor = Brakeman::AliasProcessor.new @tracker\n processor.process_safely(method.body_list, only_ivars(:include_request_vars))\n\n ivars = processor.only_ivars(:include_request_vars).all\n\n @tracker.filter_cache[[filter[:controller], name]] = ivars\n\n ivars.each do |variable, value|\n env[variable] = value\n end\n end\n end",
"def render_with_liquid?; end",
"def render_with_liquid?; end",
"def filterable?; @filterable; end",
"def filter!; end",
"def define_action_helpers; end",
"def filters\n [\n GoHiring::SlackMarkdown::Filters::MergeMethodFilter,\n GoHiring::SlackMarkdown::Filters::HeaderFilter,\n GoHiring::SlackMarkdown::Filters::EmptyBlockFilter,\n GoHiring::SlackMarkdown::Filters::BlockBreakerFilter\n ]\n end",
"def after_filter; end",
"def acceptable_filter_scopes\n []\n end",
"def add_filter_accessors\n @filters.each do |filter|\n singleton_class.class_eval do\n define_method(filter.field_name) { @attributes[filter.field_name] }\n define_method(\"#{filter.field_name}=\") { |value| @attributes[filter.field_name] = value }\n end\n end\n end",
"def middleware; end",
"def filter\n @filter ||= if Platform.linux?\n linux_filter\n elsif Platform.os_x?\n os_x_filter\n else\n raise \"Only works on Linux or OS X\"\n end\n end"
] |
[
"0.73041373",
"0.70516306",
"0.6754991",
"0.6663812",
"0.64085996",
"0.63994825",
"0.63458514",
"0.6318249",
"0.6304594",
"0.6304594",
"0.6298182",
"0.62399083",
"0.6151061",
"0.61330354",
"0.60169584",
"0.59143984",
"0.5905858",
"0.5815468",
"0.58137256",
"0.5809609",
"0.5801294",
"0.5791578",
"0.5790407",
"0.57745206",
"0.5735191",
"0.5726869",
"0.57192487",
"0.5709176",
"0.5703791",
"0.5703467",
"0.5701097",
"0.5665393",
"0.5664678",
"0.5661191",
"0.56491035",
"0.5626282",
"0.5611787",
"0.56082296",
"0.55911684",
"0.55758184",
"0.55758184",
"0.5571027",
"0.55502677",
"0.5533506",
"0.5531866",
"0.5502379",
"0.5489836",
"0.5487261",
"0.5485339",
"0.5482845",
"0.5470645",
"0.5453562",
"0.5452326",
"0.54480064",
"0.5428702",
"0.5428276",
"0.5428276",
"0.54170626",
"0.54148465",
"0.5414834",
"0.54126984",
"0.5411878",
"0.5401217",
"0.5401217",
"0.5401217",
"0.5398111",
"0.53876716",
"0.53871095",
"0.5373724",
"0.5361135",
"0.53541523",
"0.53536147",
"0.53497595",
"0.5340547",
"0.53324455",
"0.53307575",
"0.53093284",
"0.53044415",
"0.5292798",
"0.52916765",
"0.52916765",
"0.52777284",
"0.52702075",
"0.52651256",
"0.52542144",
"0.5238275",
"0.5232376",
"0.52300495",
"0.5229059",
"0.52278274",
"0.52278274",
"0.5226484",
"0.5224887",
"0.5215369",
"0.5214473",
"0.5210867",
"0.5201793",
"0.51945686",
"0.5193708",
"0.5184471"
] |
0.6782252
|
2
|
creates a new Template object from liquid source code To enable profiling, pass in profile: true as an option. See Liquid::Profiler for more information
|
def parse(source, options = {})
new.parse(source, options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse(source)\n template = Template.new\n template.parse(source)\n template\n end",
"def precompiled_template(locals = {})\n @src\n end",
"def precompiled_template(locals = {})\n @src\n end",
"def prepare_liquid_template(template)\n end",
"def template\n Liquid::Template.parse(template_content(template_name))\n end",
"def create_template(filename, _context=nil)\n template = @templateclass.new(nil, @init_opts_for_template)\n template.timestamp = Time.now()\n cache_filename = cachename(filename)\n _context = hook_context(Context.new) if _context.nil?\n if !@cache\n input = read_template_file(filename, _context)\n template.convert(input, filename)\n elsif !test(?f, cache_filename) || File.mtime(cache_filename) < File.mtime(filename)\n #$stderr.puts \"*** debug: load original\"\n input = read_template_file(filename, _context)\n template.convert(input, filename)\n store_cachefile(cache_filename, template)\n else\n #$stderr.puts \"*** debug: load cache\"\n template.filename = filename\n load_cachefile(cache_filename, template)\n end\n return template\n end",
"def compile(file)\n Liquid::Template.parse load(file)\n end",
"def precompiled_template(locals)\n @engine.precompiled\n end",
"def precompiled_template(locals)\n @engine.precompiled\n end",
"def init_template(page_template, template_file)\n tmpl = Liquid::Template.new\n tmpl.assigns['page_title'] = 'Page title'\n tmpl.assigns['template'] = page_template\n tmpl.registers[:file_system] = ThemeRunner::FileSystem.new(File.dirname(template_file))\n tmpl\n end",
"def liquid_for(markup)\n Liquid::Template.file_system = IncludeTemplateFileSystem.new(@design)\n Liquid::Template.register_tag('navigation', NavigationTag)\n Liquid::Template.register_tag('resource_link', ResourceLinkTag)\n Liquid::Template.register_tag('resource_image', ResourceImageTag)\n Liquid::Template.register_tag('search', SearchBlock)\n Liquid::Template.parse(markup)\n end",
"def prepare_template(name)\n if @loader.needs_compile?(name)\n lua = @compiler.compile(name, @loader.load_template(name))\n @loader.save_compiled(name, lua)\n end\n end",
"def compile\n @tests.each do |test_hash|\n Liquid::Template.new.parse(test_hash[:liquid])\n Liquid::Template.new.parse(test_hash[:layout])\n end\n end",
"def initialize_template(record)\n source = record.body\n identifier = \"Page - #{record.id} - #{record.path.inspect}\"\n handler = ActionView::Template.registered_template_handler(record.handler)\n\n details = {\n format: Mime[record.format],\n updated_at: record.updated_at,\n virtual_path: virtual_path(record.path, record.partial)\n }\n\n ActionView::Template.new(source, identifier, handler, details)\n end",
"def compile(template_source)\n # if RUBY_VERSION >= '1.9'\n # template_source=template_source.sub(/\\A#coding:.*\\n/, '') \n # end\n # ::ERB.new(\"<% __in_erb_template=true %>#{template_source}\", nil, \"-\", '@output_buffer')\n\n Erubis::Eruby.new(template_source.utf_or_die!)\n \n end",
"def template\n @template ||= Template.new name: script_name, out_file: root_ruby_file, type: type\n end",
"def template(*args)\n Template.new(*args)\n end",
"def parse_snippet_template(template_name)\n source = if template_name.include?('{{')\n template_name\n else\n snippet = services.snippet_finder.find(template_name)\n if snippet\n snippet.liquid_source\n else\n Locomotive::Common::Logger.warn \"[Liquid][Nav] unable to find the #{template_name} snippet\"\n nil\n end\n end\n\n source ? ::Liquid::Template.parse(source) : nil\n end",
"def initialize (template); @template = template; end",
"def initialize_template(record)\n source = record.body || \"\"\n virtual_path = \"pages/#{I18n.locale}_#{record.name}_#{record.permalink}\"\n handler = ActionView::Template.registered_template_handler('erb')\n details = {\n :format => Mime['html'],\n :updated_at => record.updated_at,\n :virtual_path => virtual_path\n }\n ActionView::Template.new(source, \"DbPageTemplate - #{virtual_path}\", handler, details)\n end",
"def initialize(template, options = {})\n @options = {\n :suppress_eval => false,\n :attr_wrapper => \"'\",\n :locals => {},\n :autoclose => ['meta', 'img', 'link', 'script', 'br', 'hr'],\n :filters => {\n 'sass' => Sass::Engine,\n 'plain' => Haml::Filters::Plain,\n 'preserve' => Haml::Filters::Preserve }\n }\n\n if !NOT_LOADED.include? 'redcloth'\n @options[:filters].merge!({\n 'redcloth' => RedCloth,\n 'textile' => Haml::Filters::Textile,\n 'markdown' => Haml::Filters::Markdown\n })\n end\n if !NOT_LOADED.include? 'bluecloth'\n @options[:filters]['markdown'] = Haml::Filters::Markdown\n end\n\n @options.rec_merge! options\n\n unless @options[:suppress_eval]\n @options[:filters].merge!({\n 'erb' => ERB,\n 'ruby' => Haml::Filters::Ruby\n })\n end\n @options[:filters].rec_merge! options[:filters] if options[:filters]\n\n @precompiled = @options[:precompiled]\n\n @template = template.strip #String\n @to_close_stack = []\n @output_tabs = 0\n @template_tabs = 0\n @index = 0\n\n # This is the base tabulation of the currently active\n # flattened block. -1 signifies that there is no such block.\n @flat_spaces = -1\n\n begin\n # Only do the first round of pre-compiling if we really need to.\n # They might be passing in the precompiled string.\n do_precompile if @precompiled.nil? && (@precompiled = String.new)\n rescue Haml::Error => e\n e.add_backtrace_entry(@index, @options[:filename])\n raise e\n end\n end",
"def read(path)\n @template.class.new(path, localized_look_in).read.strip\n end",
"def template(template_name, locals = {})\n StringIO.new(template_to_s(template_name, locals))\n end",
"def template(template_name, locals = {})\n StringIO.new(template_to_s(template_name, locals))\n end",
"def template\n with_template_factory do |template_factory|\n template = template_factory.build('Test', {})\n puts Graphics::Debugger.new(template).debug\n end\n end",
"def initialize(template, source, highline)\n @template = template\n @source = source\n @highline = highline\n end",
"def template_for file, page = true, klass = ERB\n template = @template_cache[file]\n\n return template if template\n\n if page then\n template = assemble_template file\n erbout = 'io'\n else\n template = file.read\n template = template.encode @options.encoding\n\n file_var = File.basename(file).sub(/\\..*/, '')\n\n erbout = \"_erbout_#{file_var}\"\n end\n\n if RUBY_VERSION >= '2.6'\n template = klass.new template, trim_mode: '-', eoutvar: erbout\n else\n template = klass.new template, nil, '-', erbout\n end\n @template_cache[file] = template\n template\n end",
"def prep_template(language,frame_binding)\n\n template=@localized_templates[language]\n @language=language\n eval(\"@language='#{language}'\",frame_binding)\n \n unless template\n local_template_text=@raw_template.result(frame_binding)\n local_template_text=local_template_text.gsub(@ltag,\"<%\")\n local_template_text=local_template_text.gsub(@rtag,\"%>\")\n\n template=compile(local_template_text)\n @localized_templates[language]=template unless is_development?\n end\n template\n \n end",
"def prepare\n loader = Twig::Loader::Array.new({ file => data })\n\n if options['paths']\n loader = Twig::Loader::Chain.new([\n loader,\n Twig::Loader::Filesystem.new(options['paths'])\n ])\n elsif !@@loader.nil?\n loader = Twig::Loader::Chain.new([\n loader,\n @@loader\n ])\n end\n @engine = Twig::Environment.new(loader, {\n 'debug' => !!@@debug,\n 'auto_reload' => !!@@auto_reload,\n 'charset' => 'UTF-8',\n 'strict_variables' => false,\n 'autoescape' => 'html', #'filename',\n 'cache' => false,\n 'optimizations' => -1\n })\n end",
"def template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/#{TEMPLATE_EXTNAME}$/, \"\")\n\n source = File.expand_path(find_in_source_paths(source.to_s))\n context = config.delete(:context) || instance_eval(\"binding\")\n\n create_file destination, nil, config do\n content = CapturableERB.new(::File.binread(source), nil, \"-\", \"@output_buffer\").result(context)\n content = yield(content) if block\n content\n end\n end",
"def stub_template_parsing\n template_stub = Object.new\n Liquid::Template.stubs(:parse).with do |params|\n template_stub.stubs(:render).returns(params)\n end.returns(template_stub)\n end",
"def parse_template(path)\n render(File.read(path))\n end",
"def parse( source, inherited_state=nil )\n\t\tstate = nil\n\n\t\tif inherited_state\n\t\t\tinherited_state.template = @template\n\t\t\tstate = inherited_state\n\t\telse\n\t\t\tstate = Inversion::Parser::State.new( @template, self.options )\n\t\tend\n\n\t\tself.log.debug \"Starting parse of template source (%0.2fK, %s)\" %\n\t\t\t[ source.bytesize/1024.0, source.encoding ]\n\n\t\tt0 = Time.now\n\t\tlast_pos = last_linenum = last_colnum = 0\n\t\tsource.scan( TAG_PATTERN ) do |*|\n\t\t\tmatch = Regexp.last_match\n\t\t\tstart_pos, end_pos = match.offset( 0 )\n\t\t\tlinenum = match.pre_match.count( \"\\n\" ) + 1\n\t\t\tcolnum = match.pre_match.length - (match.pre_match.rindex(\"\\n\") || -1)\n\n\t\t\t# Error on <?...?] and vice-versa.\n\t\t\tunless match[:tagend] == MATCHING_BRACKETS[match[:tagstart]]\n\t\t\t\traise Inversion::ParseError,\n\t\t\t\t\t\"malformed tag %p: mismatched start and end brackets at line %d, column %d\" %\n\t\t\t\t\t[ match[0], linenum, colnum ]\n\t\t\tend\n\n\t\t\t# Check for nested tags\n\t\t\tif match[0].index( TAG_OPEN, 2 )\n\t\t\t\traise Inversion::ParseError, \"unclosed or nested tag %p at line %d, column %d\" %\n\t\t\t\t\t[ match[0], linenum, colnum ]\n\t\t\tend\n\n\t\t\t# self.log.debug \" found a tag at offset: %d (%p) (line %d, col %d)\" %\n\t\t\t# [ start_pos, abbrevstring(match[0]), linenum, colnum ]\n\n\t\t\t# If there were characters between the end of the last match and\n\t\t\t# the beginning of the tag, create a text node with them\n\t\t\tunless last_pos == start_pos\n\t\t\t\ttext = match.pre_match[ last_pos..-1 ]\n\t\t\t\t# self.log.debug \" adding literal text node: %p\" % [ abbrevstring(text) ]\n\t\t\t\tstate << Inversion::Template::TextNode.new( text, last_linenum, last_colnum )\n\t\t\tend\n\n\t\t\t# self.log.debug \" creating tag with tagname: %p, body: %p\" %\n\t\t\t# [ match[:tagname], match[:body] ]\n\n\t\t\ttag = Inversion::Template::Tag.create( match[:tagname], match[:body], linenum, colnum )\n\t\t\tif tag.nil?\n\t\t\t\tunless state.options[ :ignore_unknown_tags ]\n\t\t\t\t\traise Inversion::ParseError, \"Unknown tag %p at line %d, column %d\" %\n\t\t\t\t\t\t[ match[:tagname], linenum, colnum ]\n\t\t\t\tend\n\n\t\t\t tag = Inversion::Template::TextNode.new( match[0], linenum, colnum )\n\t\t\tend\n\n\t\t\t# self.log.debug \" created tag: %p\" % [ tag ]\n\t\t\tstate << tag\n\n\t\t\t# Keep offsets for the next match\n\t\t\tlast_pos = end_pos\n\t\t\tlast_linenum = linenum + match[0].count( \"\\n\" )\n\t\t\tlast_colnum = match[0].length - ( match[0].rindex(\"\\n\") || -1 )\n\t\tend\n\n\t\t# If there are any characters left over after the last tag\n\t\tremainder = source[ last_pos..-1 ]\n\t\tif remainder && !remainder.empty?\n\t\t\t# self.log.debug \"Remainder after last tag: %p\" % [ abbrevstring(remainder) ]\n\n\t\t\t# Detect unclosed tags\n\t\t\tif remainder.index( \"<?\" ) || remainder.index( \"[?\" )\n\t\t\t\traise Inversion::ParseError,\n\t\t\t\t\t\"unclosed tag after line %d, column %d\" % [ last_linenum, last_colnum ]\n\t\t\tend\n\n\t\t\t# Add any remaining text as a text node\n\t\t\tstate << Inversion::Template::TextNode.new( remainder, last_linenum, last_colnum )\n\t\tend\n\t\tself.log.debug \" done parsing: %0.5fs\" % [ Time.now - t0 ]\n\n\t\treturn state.tree\n\tend",
"def initialize( * )\n\t\tsuper\n\t\t@template = self.load_template\n\tend",
"def compile\n compile_body\n compile_head\n \n builder = ScriptBuilder.new @template\n builder.build_for_page @filename\n end",
"def template_source\n @template_source ||= @options[:template_content] || read_file(template_file)\n end",
"def initialize()\n #@source = aSourceTemplate\n #@representation = compile(aSourceTemplate)\n end",
"def generate\n template = Template.new\n template.add('timestamp', Time.now.to_s)\n template.add('lib_dir', @lib_dir)\n template.add('bin_dir', @bin_dir)\n template.parse(TEMPLATE)\n end",
"def _parse(template_file)\n\t\tif(!@contents)\n\t\t\t@contents = SifterTemplate.new(self, template_file)\n\t\telse\n\t\t\t@contents.template_file = template_file\n\t\tend\n\n\t\treturn @contents._parse()\n\tend",
"def initialize(template, attributes={})\n @template = case template\n when ERB\n # matching w/wo the coding effectively checks @src\n # across ruby versions (encoding appears in 1.9)\n if template.instance_variable_get(:@src) !~ /^(#coding:US-ASCII\\n)?_erbout =/\n raise ArgumentError, \"Templater does not work with ERB templates where eoutvar != '_erbout'\"\n end\n template\n when String then ERB.new(template, nil, \"<>\")\n else raise ArgumentError, \"cannot convert #{template.class} into an ERB template\"\n end\n \n src = @template.instance_variable_get(:@src)\n @template.instance_variable_set(:@src, \"self.\" + src) \n\n super(attributes)\n end",
"def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end",
"def initialize()\n @template = \"call load_file() or load_url() to load a template\"\n @loadOK = false \n end",
"def load_template!\n feed = self\n eval(File.read(@file))\n end",
"def new_template_file(template_file, template_data_hash)\n TemplateFile.new(template_file, template_data_hash)\n end",
"def initialize(template_text,options={})\n @renderer_extension_modules=[]\n\n @name=options[:template_name]\n @templates_root_dir= options[:templates_directory]# || \"#{::Rails.root.to_s}/app/views\"\n\n @output_buffer=\"\"\n #unique tag for escaping post and pre processing tags\n @ltag=\"!@@@##$$1212\"\n @rtag=\"!723465hjf3!@#\"\n\n @default_language=options[:default_language] || \"en\"\n\n\n @escape_tags= options[:tags_to_escape] || []\n @runtime_tags= options[:runtime_tags] || []\n\n\n #escape blocks that will be run at view time\n @template_text=template_text.clone\n @escape_tags.each do |etag|\n escape_tag_content( etag,@template_text)\n\n \n end\n\n# raise \"need templates directory\" unless options[:templates_directory]\n\n #escape all normal dynamic blocks for preprocessing\n @template_text=@template_text.gsub(\"<%\",@ltag).gsub(\"%>\",@rtag).gsub(\"<$\",\"<%\").gsub(\"$>\",\"%>\")\n \n #turn the setup block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<##\",\"<% set_setup_proc{ \").gsub(\"##>\",\"} %>\")\n\n #turn the key block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<!!KEY\",\"<% set_key_proc{ \").gsub(\"!!KEY>\",\"} %>\")\n\n\n @raw_template=compile(@template_text)\n #this hold variations of the template after it has been localized\n #into different languages, but before rendering\n @localized_templates={}\n @setup_proc=nil\n @key_proc=nil\n @render_base=options[:render_base]\n @template_name=options[:template_name]\n #this tag will be used to create non cachable dynamic blocks\n\n\n if options.has_key?(:helpers) && options[:helpers]!=nil\n options[:helpers].each do |helper|\n include helper\n end\n end\n \n end",
"def read_template_file(template_path)\n File.read(@path + '/' + template_path + '.liquid')\n end",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def liquid_block(block)\n Liquid::Template.parse(block).render(@context)\n end",
"def stack_template_load(stack)\n if(stack.persisted?)\n result = request(\n :endpoint => stack.custom.fetch(:manifest, stack.custom.get(:update, :manifest))\n )\n cache_template = stack.template = template_data_format(result[:body])\n stack.custom = stack.custom.merge(result[:body])\n if(stack.custom['expandedConfig'])\n stack.custom['expandedConfig'] = YAML.load(stack.custom['expandedConfig']).to_smash\n end\n if(stack.custom['layout'])\n stack.custom['layout'] = YAML.load(stack.custom['layout']).to_smash\n end\n stack.valid_state\n cache_template\n else\n Smash.new\n end\n end",
"def template_source\n raise NotImplementedError\n end",
"def initialize(template)\n @template = template\n end",
"def template\n @template ||= File.read(template_full_path)\n end",
"def load\n template_data = response_data['template']\n\n @data = response_data['data']\n @template = Template.new(\n template_data['src'], template_data['type'], template_data['key']\n )\n\n super\n end",
"def compiled_source\n set_strict_locals = strict_locals!\n source = encode!\n code = @handler.call(self, source)\n\n method_arguments =\n if set_strict_locals\n \"output_buffer, #{set_strict_locals}\"\n else\n \"local_assigns, output_buffer\"\n end\n\n # Make sure that the resulting String to be eval'd is in the\n # encoding of the code\n source = +<<-end_src\n def #{method_name}(#{method_arguments})\n @virtual_path = #{@virtual_path.inspect};#{locals_code};#{code}\n end\n end_src\n\n # Make sure the source is in the encoding of the returned code\n source.force_encoding(code.encoding)\n\n # In case we get back a String from a handler that is not in\n # BINARY or the default_internal, encode it to the default_internal\n source.encode!\n\n # Now, validate that the source we got back from the template\n # handler is valid in the default_internal. This is for handlers\n # that handle encoding but screw up\n unless source.valid_encoding?\n raise WrongEncodingError.new(source, Encoding.default_internal)\n end\n\n if Template.frozen_string_literal\n \"# frozen_string_literal: true\\n#{source}\"\n else\n source\n end\n end",
"def create_template_source(template, render_symbol)\n body = compile(template)\n\n self.template_args[render_symbol] ||= {}\n locals_keys = self.template_args[render_symbol].keys | template.locals.keys\n self.template_args[render_symbol] = locals_keys.inject({}) { |h, k| h[k] = true; h }\n\n locals_code = \"\"\n locals_keys.each do |key|\n locals_code << \"#{key} = local_assigns[:#{key}]\\n\"\n end\n\n \"def #{render_symbol}(local_assigns)\\nold_output_buffer = output_buffer;#{locals_code}#{body}\\nensure\\nself.output_buffer = old_output_buffer\\nend\"\n end",
"def compile template\n @program = Program.new(\n @options[:result_variable] || :_erbout,\n @options[:continue_result]\n )\n\n # convert \"% at beginning of line\" usage into <% normal %> usage\n if @options[:shorthand]\n i = 0\n contents, directives =\n template.split(/(#{DIRECTIVE_HEAD}#{DIRECTIVE_BODY}#{DIRECTIVE_TAIL})/mo).\n partition { (i += 1) & 1 == 1 } # even/odd partition\n\n # only process the content; do not touch the directives\n # because they may contain code lines beginning with \"%\"\n contents.each do |content|\n # process unescaped directives\n content.gsub! %r/^(#{SPACING})(#{SHORTHAND_HEAD}#{SHORTHAND_BODY})#{SHORTHAND_TAIL}/o, '\\1<\\2%>'\n\n # unescape escaped directives\n content.gsub! %r/^(#{SPACING})(#{SHORTHAND_HEAD})#{SHORTHAND_HEAD}/o, '\\1\\2'\n end\n\n template = contents.zip(directives).join\n end\n\n # convert single-line comment directives into nothing\n template.gsub!(/^#{SPACING}#{DIRECTIVE_HEAD}##{DIRECTIVE_BODY}#{DIRECTIVE_TAIL}#{SPACING}$/, '')\n\n # translate template into Ruby code\n @margins = []\n @crowns = []\n\n directive_matches = template.scan(/#{\n '((%s)%s(%s)%s(%s)(%s?))' % [\n SPACING,\n DIRECTIVE_HEAD,\n DIRECTIVE_BODY,\n DIRECTIVE_TAIL,\n SPACING,\n NEWLINE,\n ]\n }/mo)\n\n directive_matches.each do |match|\n # iteratively whittle the template\n before_content, after_content = template.split(match[0], 2)\n template = after_content\n\n # process the raw content before the directive\n process_content before_content\n\n # process the directive itself\n args = match + [after_content]\n process_directive(*args)\n end\n\n # process remaining raw content *after* last directive\n process_content template\n\n # handle missing ends\n if @options[:infer_end]\n @margins.each { emit_end }\n else\n warn \"There are at least #{@margins.length} missing '<% end %>' statements in the eRuby template.\" unless @margins.empty?\n end\n\n @program.compile\n end",
"def read_template( name )\n\t\tname = \"%s.erb\" % [ name ] unless name.to_s.end_with?( '.erb' )\n\t\ttemplate_path = DEVEIATE_DATADIR + name\n\t\ttemplate_src = template_path.read( encoding: 'utf-8' )\n\n\t\treturn ERB.new( template_src, trim_mode: '-' )\n\tend",
"def template engine, file, action = nil, context = nil\n\n scope = @node_instance || @node || Object.new\n proc = compile(action)\n return engine.new(file) unless proc &&\n instruction = scope.instance_exec(action, &proc)\n\n pool = compiler_pool\n locals = context.is_a?(Hash) ? context.keys : []\n key = '%s:%s:%s:%s' % [file, @node, action, ::Digest::MD5.hexdigest(locals.to_s)]\n\n pool[key] = engine.new(file).precompile(*locals) if instruction == :update\n \n template, offset = pool.get key do\n engine.new(file).precompile(*locals)\n end\n engine.new { [template, offset] }\n end",
"def template\n templater.template\n end",
"def process_template name, src, type, called_from = nil, file_name = nil\n case type\n when :erb\n result = ErbTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :haml\n result = HamlTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :erubis\n result = ErubisTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :slim\n result = SlimTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n else\n abort \"Unknown template type: #{type} (#{name})\"\n end\n\n # Each template which is rendered is stored separately\n # with a new name.\n if called_from\n name = (\"#{name}.#{called_from}\").to_sym\n end\n\n @tracker.templates[name].src = result\n @tracker.templates[name].type = type\n end",
"def load_template\n\t\traw = IO.read( __FILE__ ).split( /^__END__$/m, 2 ).last\n\t\treturn ERB.new( raw, nil, '<%>' )\n\tend",
"def template\n return @email unless @email.nil?\n \n #if self[:email].blank?\n #@template = Liquid::Template.parse(email)\n #self[:email] = Marshal.dump(@template)\n # save\n #else\n @email = Marshal.load(self[:email])\n #end\n \n #@email\n end",
"def use_template(klass)\n define_singleton_method(:source_location) { klass.source_location }\n end",
"def initialize(options) #:not-new:\n @options = options\n load_html_template\n end",
"def compile_template(template)\n return unless compile_template?(template)\n\n render_symbol = assign_method_name(template)\n render_source = create_template_source(template, render_symbol)\n line_offset = self.template_args[render_symbol].size + self.line_offset\n\n begin\n file_name = template.filename || 'compiled-template'\n ActionView::Base::CompiledTemplates.module_eval(render_source, file_name, -line_offset)\n rescue Exception => e # errors from template code\n if @view.logger\n @view.logger.debug \"ERROR: compiling #{render_symbol} RAISED #{e}\"\n @view.logger.debug \"Function body: #{render_source}\"\n @view.logger.debug \"Backtrace: #{e.backtrace.join(\"\\n\")}\"\n end\n\n raise ActionView::TemplateError.new(template, @view.assigns, e)\n end\n\n self.compile_time[render_symbol] = Time.now\n # logger.debug \"Compiled template #{file_name || template}\\n ==> #{render_symbol}\" if logger\n end",
"def template_for(file); end",
"def initialize(parent, template_file='', embed_flag=0, nobreak_flag=0)\n\t\t######## Members\n\t\t##\n\t\t# Holds top level object\n\t\t# \n\t\t# @var\tobject\n\t\t##\n\t\t@top = nil\n\n\t\t##\n\t\t# Holds template object\n\t\t# \n\t\t# @var\tobject\n\t\t##\n\t\t@template = nil\n\n\t\t##\n\t\t# Holds parent object\n\t\t# \n\t\t# @var\tobject\n\t\t##\n\t\t@parent = nil\n\n\t\t##\n\t\t# Holds child objects\n\t\t# \n\t\t# @var\tobject\n\t\t##\n\t\t@contents = nil\n\n\t\t##\n\t\t# Path to template file\n\t\t# \n\t\t# @var\tstring\n\t\t##\n\t\t@template_file = ''\n\n\t\t##\n\t\t# Path to directory includes template file\n\t\t# \n\t\t# @var\tstring\n\t\t##\n\t\t@dir_path = ''\n\n\t\t##\n\t\t# File pointer of template file\n\t\t# \n\t\t# @var\tresource\n\t\t##\n\t\t@fp = nil\n\n\t\t##\n\t\t# Buffer\n\t\t# \n\t\t# @var\tresource\n\t\t##\n\t\t@buffer = ''\n\n\t\t##\n\t\t# Line number in currently reading file\n\t\t# \n\t\t# @var\tint\n\t\t##\n\t\t@reading_line = 0\n\n\t\t##\n\t\t# Flag of preserving spaces in the line that includes control tags only\n\t\t# \n\t\t# @var\tbool\n\t\t##\n\t\t@preserve_spaces = false\n\n\t\t##\n\t\t# Embed flag\n\t\t# \n\t\t# @var\tint\n\t\t##\n\t\t@embed_flag = 0\n\n\t\t##\n\t\t# No-break flag\n\t\t# \n\t\t# @var\tint\n\t\t##\n\t\t@nobreak_flag = 0\n\n\t\treturn nil if(!parent)\n\n\t\tif(parent.is_a?(Sifter) || !parent.top)\n\t\t\t@top = parent\n\t\t\t@parent = nil\n\t\telse\n\t\t\t@top = parent.top\n\t\t\t@parent = parent\n\t\tend\n\n\t\t@template_file = template_file\n\t\t@dir_path = (/^(.*)\\//.match(template_file)? Regexp.last_match[1]: '.')\n\n\t\t@embed_flag = embed_flag\n\t\t@nobreak_flag = nobreak_flag\n\tend",
"def read_template_file(filename, _context)\n return File.read(filename) if !@preprocess\n _context ||= {}\n _context = hook_context(_context) if _context.is_a?(Hash) || _context._engine.nil?\n _buf = _context._buf\n _context._buf = \"\"\n begin\n return Preprocessor.new(filename).render(_context)\n ensure\n _context._buf = _buf\n end\n end",
"def generate_report(filename, template)\n file = File.read(filename)\n data_hash = JSON.parse(file)\n rpt_data = transform(data_hash)\n\n # Re http://stackoverflow.com/questions/1887845/add-method-to-an-instanced-object\n d = TemplateSource.new(rpt_data)\n\n template = File.read(template) if File.exist?(template)\n renderer = ERB.new(template, nil, '<>')\n renderer.result(d.get_binding)\nend",
"def template\n return @template if @template\n\n # If they sent any instance-level options use that instead of the class's.\n if @template_path || @template_extension || @template_name || @template_file\n @template = templateify(File.read(template_file))\n else\n @template = self.class.template\n end\n end",
"def precompile(source, options = {})\n source = ::Haml::Engine.new(source.dup).render\n js_escape!(source)\n \"_.template(\\\"#{source}\\\")\"\n end",
"def load_source(source=nil, source_vars=nil)\n load_source_for(Template, source, source_vars)\n end",
"def initialize(file)\n @file = file\n\n case ext = File.extname(file)\n when '.till', '.til'\n fname = file.chomp(ext)\n else\n fname = file\n end\n\n #@format = File.extname(fname)\n @location = File.dirname(File.expand_path(file))\n\n text = File.read(file).rstrip\n\n # front matter indicator\n if text =~ /\\A---/\n text = text.sub(/---.*?\\n/, '')\n meta, body = *text.split(/^---/)\n else\n meta = nil\n body = text\n end\n\n @content = body\n\n fm = meta ? YAML.load(meta) : {}\n\n self.filters = fm['filter'] || ['erb']\n\n self.format = fm['format'] || File.extname(fname)\n\n if fm['output']\n self.output = fm['output']\n else\n self.output = fname #.chomp(extension) #+ DEFAULT_CONVERSIONS[filters.last]\n end\n\n\n\n #@context = Context.new(@location) # prime context/scope\n end",
"def load_full_container_template(use_disk_cache = false)\n container_class.template(true)\n end",
"def template\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n @template\n end",
"def template(name); end",
"def get_template(template); end",
"def format(string)\n @pt = Template.new(string)\n end",
"def get_template(filename)\n File.read(filename)\nend",
"def copy_template\n FileUtils.mkdir_p(self.source) unless File.exists?(self.source)\n File.open(File.join(self.source, 'template.erb'), 'w') do |file|\n erb = File.read(File.join(generator_path, 'template.erb'))\n erb.gsub!('{{query}}', self.query) if self.query\n file.write(erb)\n end\n FileUtils.cp_r File.join(generator_path, '_assets'), self.source\n end",
"def call(template)\n Jason.compile(template.source)\n end",
"def initialize(template_string, options = {})\n self.template = template_string\n self.render_opts = if options[:blank]\n {}\n else\n { strict_variables: true }\n end\n end",
"def build_from_template(template, data = {}, layout = true)\n cont = File.read(template_file(template)).miga_variables(data)\n return cont unless layout\n\n build_from_template(\n 'layout.html',\n data.merge(content: cont, project_name: cli.load_project.name),\n false\n )\n end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def render(options = {})\n options.merge! :vendor_lua => @vendor_lua if @vendor_lua\n #debugger\n #puts \">> LAMINATE RENDER START. Disabling gc.\"\n #GC.disable\n # Compile template if needed\n name = @name.dup\n prepare_template(name)\n lua = @loader.load_compiled(name).dup\n\n @errors = []\n error_proc = Proc.new {|err| handle_error(err, lua, options)}\n\n State.new(options).run(error_proc) do |state|\n state.logger = logger\n state.eval(lua)\n # Included template functions. The trick is that we don't return to Ruby and eval the included template, because the\n # Lua binding doesn't like re-entering eval. So instead we bind a function '_load_template' which returns the template\n # code, and then we eval it inside Lua itself using 'loadstring'. Thus the template 'include' function is actually\n # a native Lua function.\n state.function '_load_template' do |template_name|\n prepare_template(template_name)\n load_template_innerds(template_name)\n end\n\n state.eval(\"return #{@compiler.lua_template_function(name)}()\")\n end\n end",
"def determine_template(options); end",
"def initialize(options) #:not-new:\n @options = options\n load_html_template\n @main_page_path = nil\n end",
"def load_template( templatepath )\n\t\treturn ERB.new( templatepath.read, nil, '%<>' ).freeze\n\tend",
"def compile(template_name, compiled_content)\n self.kramdown_source.compile(template_name, compiled_content)\n end",
"def load_full_container_template(use_disk_cache = false)\n puts \"\\tCaching container template ...\"\n container_class.template(true)\n end",
"def provider_template(template, options)\n require 'erb'\n require 'ostruct'\n ERB.new(File.read(template)).result(\n OpenStruct.new(options).instance_eval {binding}\n )\n end",
"def template(file = nil)\n @template ||= Corrupt::Template.new(file)\n end",
"def template(relative_source, relative_destination, template_options = {})\n create_file(relative_source, relative_destination, template_options) do |file|\n # Evaluate any assignments in a temporary, throwaway binding.\n vars = template_options[:assigns] || {}\n b = template_options[:binding] || binding\n vars.each { |k,v| eval \"#{k} = vars[:#{k}] || vars['#{k}']\", b }\n\n # Render the source file with the temporary binding.\n ERB.new(file.read, nil, '-').result(b)\n end\n end",
"def source\n @source ||= {}\n\n source = if self.template.respond_to?(:source)\n # liquid or haml file\n self.template.source\n else\n # simple string\n self.template\n end\n\n @source[Locomotive::Mounter.locale] = source\n end"
] |
[
"0.6989701",
"0.6673587",
"0.6640795",
"0.659774",
"0.6570216",
"0.64499366",
"0.63201684",
"0.6280336",
"0.6280336",
"0.6213447",
"0.61703104",
"0.6081682",
"0.60626763",
"0.60047144",
"0.5979331",
"0.5972156",
"0.5955563",
"0.5952048",
"0.5948702",
"0.5907529",
"0.58913994",
"0.5779332",
"0.57770556",
"0.57770556",
"0.5775814",
"0.5768158",
"0.5766937",
"0.57651657",
"0.57471085",
"0.5684628",
"0.56839794",
"0.56797427",
"0.5679329",
"0.567775",
"0.5671277",
"0.56707186",
"0.566682",
"0.5665852",
"0.5636012",
"0.5631516",
"0.56227696",
"0.56194735",
"0.5606403",
"0.55957973",
"0.55912584",
"0.55899924",
"0.5571311",
"0.5571311",
"0.55562705",
"0.55520463",
"0.5520885",
"0.5519537",
"0.55164397",
"0.5515493",
"0.5503809",
"0.5496696",
"0.5490621",
"0.5487579",
"0.5480985",
"0.54795825",
"0.54635",
"0.54381245",
"0.54302937",
"0.54288363",
"0.54278773",
"0.54126793",
"0.54072434",
"0.53967404",
"0.5396092",
"0.53917736",
"0.53760296",
"0.5370959",
"0.5369066",
"0.53592396",
"0.5358102",
"0.53571826",
"0.53551424",
"0.53541887",
"0.53532624",
"0.53488517",
"0.5339829",
"0.53315777",
"0.53216594",
"0.5317754",
"0.53060806",
"0.53060806",
"0.53060806",
"0.53060806",
"0.53060806",
"0.53060806",
"0.53060806",
"0.53031933",
"0.5295935",
"0.52954286",
"0.5294626",
"0.5294589",
"0.529433",
"0.5292671",
"0.52899164",
"0.5280562",
"0.5278935"
] |
0.0
|
-1
|
Parse source code. Returns self for easy chaining
|
def parse(source, options = {})
parse_context = configure_options(options)
tokenizer = parse_context.new_tokenizer(source, start_line_number: @line_numbers && 1)
@root = Document.parse(tokenizer, parse_context)
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse(source); end",
"def parse(source)\n Parser.parse(source)\n end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source)\n @parser.parse(@scanner.scan(source))\n end",
"def parse(source, options = {})\n new.parse(source, options)\n end",
"def parse\n IniParse::Generator.gen do |generator|\n @source.split(\"\\n\", -1).each do |line|\n generator.send(*Parser.parse_line(line))\n end\n end\n end",
"def parse_source(source)\n lines = source.lines.to_a\n starting_line_index = @line_number - 1\n ending_line_index = starting_line_index\n sexp = nil\n while !sexp && ending_line_index < lines.size\n begin\n snippet = lines.to_a[starting_line_index..ending_line_index].join\n sexp = parser.parse(snippet)\n return ParsedCode.new(sexp)\n rescue Racc::ParseError\n ending_line_index += 1\n raise if ending_line_index >= lines.size\n end\n end\n end",
"def parse(code = nil, options = nil, &block)\n Parsing::parse(code, options, &block)\n end",
"def parse(source)\n parser = Parser::CurrentRuby.new\n parser.diagnostics.all_errors_are_fatal = true\n parser.diagnostics.ignore_warnings = true\n source_buffer = Parser::Source::Buffer.new('script')\n source_buffer.source = source\n parser.parse(source_buffer)\n end",
"def parse\n buffer = Parser::Source::Buffer.new(origin, 1)\n buffer.source = code\n ast, comments = parser.parse_with_comments(buffer)\n\n # See https://whitequark.github.io/parser/Parser/Source/Comment/Associator.html\n comment_map = Parser::Source::Comment.associate(ast, comments)\n TreeDresser.new.dress(ast, comment_map) || AST::Node.new(:empty)\n end",
"def parse src\n @src = src\n @src.push false\n\n @footnotes = []\n @labels = {}\n\n # @i: index(line no.) of src\n @i = 0\n\n # stack for current indentation\n @indent_stack = []\n\n # how indented.\n @current_indent = @indent_stack.join(\"\")\n\n # RDoc::RD::BlockParser for tmp src\n @subparser = nil\n\n # which part is in now\n @in_part = nil\n @part_content = []\n\n @in_verbatim = false\n\n @yydebug = true\n\n document = do_parse\n\n unless @footnotes.empty? then\n blankline = document.parts.pop\n\n document.parts << RDoc::Markup::Rule.new(1)\n document.parts.concat @footnotes\n\n document.parts.push blankline\n end\n\n document\nend",
"def parse(source)\n @root = Document.new(tokenize(source))\n self\n end",
"def parse\n parse_file\n self\n end",
"def parse(source, options = T.unsafe(nil)); end",
"def parse(source, options = T.unsafe(nil)); end",
"def parse(source, options = {})\n opts = Lines.parse_default_options.merge(options.to_hash)\n @parser.parse(source.to_str, opts)\n end",
"def parse_with_comments(source); end",
"def parse_code(code)\n p Parser::CurrentRuby.parse(code)\n end",
"def parse(source)\n buffer = ::Parser::Source::Buffer.new('(string)')\n buffer.source = source\n\n @parser.reset\n @parser.parse(buffer)\n end",
"def parse_codespan; end",
"def parse(code, version=1.8)\n config = version == 1.8 ? CONFIG_18 : CONFIG_19\n PARSER.parse \"<code>\", source(code), config\n end",
"def parse(code, version=1.8)\n config = version == 1.8 ? CONFIG_18 : CONFIG_19\n PARSER.parse \"<code>\", source(code), config\n end",
"def parse(source)\n call(source)\n rescue ::Slim::Parser::SyntaxError => e\n # Convert to our own exception type to isolate from upstream changes\n error = SlimLint::Exceptions::ParseError.new(e.error,\n e.file,\n e.line,\n e.lineno,\n e.column)\n raise error\n end",
"def parse(code, file = '(ruby-lint)', line = 1)\n buffer = ::Parser::Source::Buffer.new(file, line)\n buffer.source = code\n ast = internal_parser.parse(buffer)\n\n internal_parser.reset\n\n return AST::Node.new(:root, [ast])\n end",
"def parse(source_buffer)\n @lexer.source_buffer = source_buffer\n @source_buffer = source_buffer\n\n do_parse || nil # Force `false` to `nil`, see https://github.com/ruby/racc/pull/136\n ensure\n # Don't keep references to the source file.\n @source_buffer = nil\n @lexer.source_buffer = nil\n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def parse inline\n @inline = inline\n @src = StringScanner.new inline\n @pre = \"\".dup\n @yydebug = true\n do_parse.to_s\nend",
"def parse(data)\n sections, docs, code = [], [], []\n lines = data.split(\"\\n\")\n\n # The first line is ignored if it is a shebang line. We also ignore the\n # PEP 263 encoding information in python sourcefiles, and the similar ruby\n # 1.9 syntax.\n lines.shift if lines[0] =~ /^\\#\\!/\n lines.shift if lines[0] =~ /coding[:=]\\s*[-\\w.]+/ &&\n [ \"python\", \"rb\" ].include?(@options[:language])\n\n # To detect both block comments and single-line comments, we'll set\n # up a tiny state machine, and loop through each line of the file.\n # This requires an `in_comment_block` boolean, and a few regular\n # expressions for line tests. We'll do the same for fake heredoc parsing.\n in_comment_block = false\n in_heredoc = false\n single_line_comment, block_comment_start, block_comment_mid, block_comment_end =\n nil, nil, nil, nil\n if not @options[:comment_chars][:single].nil?\n single_line_comment = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:single])}\\\\s?\")\n end\n if not @options[:comment_chars][:multi].nil?\n block_comment_start = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*$\")\n block_comment_end = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_one_liner = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_start_with = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)$\")\n block_comment_end_with = Regexp.new(\"\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n if @options[:comment_chars][:multi][:middle]\n block_comment_mid = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:middle])}\\\\s?\")\n end\n end\n if not @options[:comment_chars][:heredoc].nil?\n heredoc_start = Regexp.new(\"#{Regexp.escape(@options[:comment_chars][:heredoc])}(\\\\S+)$\")\n end\n lines.each do |line|\n # If we're currently in a comment block, check whether the line matches\n # the _end_ of a comment block or the _end_ of a comment block with a\n # comment.\n if in_comment_block\n if block_comment_end && line.match(block_comment_end)\n in_comment_block = false\n elsif block_comment_end_with && line.match(block_comment_end_with)\n in_comment_block = false\n docs << line.match(block_comment_end_with).captures.first.\n sub(block_comment_mid || '', '')\n else\n docs << line.sub(block_comment_mid || '', '')\n end\n # If we're currently in a heredoc, we're looking for the end of the\n # heredoc, and everything it contains is code.\n elsif in_heredoc\n if line.match(Regexp.new(\"^#{Regexp.escape(in_heredoc)}$\"))\n in_heredoc = false\n end\n code << line\n # Otherwise, check whether the line starts a heredoc. If so, note the end\n # pattern, and the line is code. Otherwise check whether the line matches\n # the beginning of a block, or a single-line comment all on it's lonesome.\n # In either case, if there's code, start a new section.\n else\n if heredoc_start && line.match(heredoc_start)\n in_heredoc = $1\n code << line\n elsif block_comment_one_liner && line.match(block_comment_one_liner)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_one_liner).captures.first\n elsif block_comment_start && line.match(block_comment_start)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n elsif block_comment_start_with && line.match(block_comment_start_with)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_start_with).captures.first\n elsif single_line_comment && line.match(single_line_comment)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.sub(single_line_comment || '', '')\n else\n code << line\n end\n end\n end\n sections << [docs, code] if docs.any? || code.any?\n normalize_leading_spaces(sections)\n end",
"def parse(source)\n template = Template.new\n template.parse(source)\n template\n end",
"def parse_codespan\n start_line_number = @src.current_line_number\n result = @src.scan(CODESPAN_DELIMITER)\n simple = (result.length == 1)\n saved_pos = @src.save_pos\n\n if simple && @src.pre_match =~ /\\s\\Z|\\A\\Z/ && @src.match?(/\\s/)\n add_text(result)\n return\n end\n\n # assign static regex to avoid allocating the same on every instance\n # where +result+ equals a single-backtick. Interpolate otherwise.\n if result == '`'\n scan_pattern = /`/\n str_sub_pattern = /`\\Z/\n else\n scan_pattern = /#{result}/\n str_sub_pattern = /#{result}\\Z/\n end\n\n if (text = @src.scan_until(scan_pattern))\n text.sub!(str_sub_pattern, '')\n unless simple\n text = text[1..-1] if text[0..0] == ' '\n text = text[0..-2] if text[-1..-1] == ' '\n end\n @tree.children << Element.new(:codespan, text, nil, {\n codespan_delimiter: result,\n location: start_line_number\n })\n\n else\n @src.revert_pos(saved_pos)\n add_text(result)\n end\n end",
"def parse_codeblock; end",
"def parse(source)\n IniParse::Parser.new(source.gsub(/(?<!\\\\)\\\\\\n/, '')).parse\n end",
"def parse text\n raise \"No parser defined for #{self.class}\"\n end",
"def parse_codeblocks(html); end",
"def parse str\n begin\n @str=str\n @tokens=Lexer.new.tokenize(str)\n @tokens=@tokens.reject!{|tok| tok.is_a? [:comment,:newline]}\n ast=parse_module()\n #pp ast\n rescue Exception => e\n puts \"PARSING ERROR : #{e}\"\n puts \"in C source at line/col #{showNext.pos}\"\n puts e.backtrace\n abort\n end\n end",
"def parse_lang_for_codeblock(source); end",
"def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end",
"def parse(text); end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parse!\n set :line => @line\n @context.run_with_current(&self.class.get_parsable)\n self\n end",
"def parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.lineno = 1\n self.start_of_current_line_pos = 0\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.lineno = 1\n self.start_of_current_line_pos = 0\n self.state ||= nil\n\n do_parse\n end",
"def initialize(source)\n self.source = source\n self.fields = []\n self.lines = []\n self.parse!\n end",
"def parse(source, path = T.unsafe(nil)); end",
"def compile(source)\n ast = transformer.apply(parser.parse(source))\n ast.compile\n end",
"def compile_to_ruby_source_as parser_class_name\r\n result = \"class #{parser_class_name} < Dhaka::CompiledParser\\n\\n\"\r\n result << \" self.grammar = #{grammar.name}\\n\\n\"\r\n result << \" start_with #{start_state.id}\\n\\n\"\r\n states.each do |state|\r\n result << \"#{state.compile_to_ruby_source}\\n\\n\"\r\n end\r\n result << \"end\"\r\n result\r\n end",
"def parse_with_comments(source_buffer); end",
"def parse_with_comments(source_buffer); end",
"def parse_with_comments(source_buffer); end",
"def initialize(_src)\n\t\t@tokenizer = Lexer.new(_src)\n\t\t@token = nil\n\t\t@blocklevel = 0\n\t\t@node = nil\n\t\t@sav = nil\n\tend",
"def parse()\n #This is a stub, used for indexing\n end",
"def parse(source)\n raise \"Attempt to continue parsing using finalized parser\" if @finished\n\n source.each_char() { |char|\n if @mode == :read_comment\n if char == \"\\n\"\n @mode = :find_name\n end\n elsif @in_escape == true\n buffer(case char\n when 'n' then \"\\n\"\n when 'r' then \"\\r\"\n when 'a' then \"\\a\"\n when 'b' then \"\\b\"\n when 'f' then \"\\f\"\n when 't' then \"\\t\"\n when '0' then \"\\0\"\n else char\n end, true)\n @in_escape = false\n else\n case char\n when ' ', \"\\t\"\n if @mode == :read_name\n parsedName(grab_and_reset_buffer())\n @mode = :find_value\n elsif ! ((@consume_whitespace && @last_char == char) || @mode == :find_name || @mode == :find_value)\n buffer char\n end\n\n when '{'\n case @mode\n when :read_name, :find_value\n parsedName(grab_and_reset_buffer()) if @mode == :read_name\n parsedNodeOpening()\n @depth += 1\n\n when :read_value, :find_name\n parsedValue(grab_and_reset_buffer()) if @mode == :read_value\n if @depth == 0 && @nameless_roots\n @depth += 1\n parsedName('')\n parsedNodeOpening()\n else\n raise error_string('Invalid character { - expected name.')\n end\n\n else\n raise error_string('Invalid character { - expected name.')\n end\n\n @mode = :find_name\n\n when '}'\n case @mode\n when :read_name, :find_value\n parsedName(grab_and_reset_buffer()) if @mode == :read_name\n parsedValue('')\n\n when :read_value\n parsedValue(grab_and_reset_buffer())\n end\n\n if @depth == 0\n raise error_string(\"Unexpected } - no matching {.\")\n end\n\n @depth -= 1\n @mode = :find_name\n\n parsedNodeClosing()\n\n when \"\\n\", '#', ';'\n case @mode\n when :read_name, :find_value\n parsedName(grab_and_reset_buffer()) if @mode == :read_name\n parsedValue('')\n when :read_value\n parsedValue(grab_and_reset_buffer())\n end\n\n @mode = char == '#' ? :read_comment : :find_name\n\n when \"\\\\\"\n @in_escape = true\n\n else\n if @mode == :find_name\n @mode = :read_name\n elsif @mode == :find_value\n @mode = :read_value\n end\n\n buffer(char)\n\n end\n end\n\n @last_char = char\n\n if char == \"\\n\"\n @line += 1\n @column = 1\n else\n @column += 1\n end\n }\n end",
"def parse(code)\n class_and_fields = split_by_line(code, 0)[:line]\n # input result to fields array\n return class_and_fields\n end",
"def parse\n self.data = BdlFile.strip_comments self.data\n save!\n tokenize\n Instruction.create_references!\n end",
"def source\n Source.new(contents.each_line, self)\n end",
"def parse_content(content); end",
"def parse(filename)\n Parser::CurrentRuby.parse(File.open(filename, \"r\").read)\n end",
"def parse(data)\n new.parse(data)\n end",
"def parse &block\n @parser ||= case @source_data.vendor_name\n when VENDOR_CAPTERRA\n SdParser::CapterraParser.new(@source_data.data,\n @source_data.data_type)\n when VENDOR_SOFTADV\n SdParser::SoftwareadviceParser.new(@source_data.data,\n @source_data.data_type)\n end\n \n @parsed_data = @parser.parse &block\n \n @parsed_data\n end",
"def parse(params) new(params).parse end",
"def parse\n raise NotImplementedError\n end",
"def compile\n lexer = Bolverk::ASM::Lexer.new(@stream)\n tokens = lexer.scan\n\n parser = Bolverk::ASM::Parser.new(tokens)\n parse_tree = parser.parse\n\n generator = Bolverk::ASM::Generator.new(parse_tree)\n source = generator.generate\n\n return source\n end",
"def parsed\n return @parsed if instance_variable_defined? :@parsed\n\n if source =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n { metadata: YAML.load($1), content: $' }\n else\n { metadata: {}, content: source }\n end\n end",
"def parse(javascript, filename = nil)\n @tokens = TOKENIZER.raw_tokens(javascript)\n @position = 0\n @filename = filename\n ast = do_parse\n apply_comments(ast)\n end",
"def parse(fileName, options={autoVerNs: false})\n @options = options\n @sources = Sources.new(fileName)\n while (@currentSource=@sources.next)\n @currentSource.parse self\n end\n resolveVerify\n self\n end",
"def parse(html)\n Parser.new(self.lex(html)).parse()\n end",
"def source\n @source ||= begin\n file, line_no = source_location\n raise \"no file provided by source_location: #{self}\" if file.nil?\n raise \"no line number provided for source_location: #{self}\" if line_no.nil?\n tokens = Ripper.lex File.read(file)\n tokens_on_line = tokens.select {|pos, lbl, str| pos[0].eql?(line_no) }\n starting_token = tokens_on_line.detect do |pos, lbl, str|\n TOKEN_PAIRS.keys.include?([lbl, str]) &&\n _actually_starting_a_proc?(tokens, [pos, lbl, str])\n end\n starting_token_type = [starting_token[1], starting_token[2]]\n ending_token_type = TOKEN_PAIRS[starting_token_type]\n source_str = \"\"\n remaining_tokens = tokens[tokens.index(starting_token)..-1]\n nesting = -1\n starting_nesting_token_types = if [TLAMBDA, LBRACE].include?(starting_token_type)\n [TLAMBDA, LBRACE]\n else\n [starting_token_type]\n end\n\n while token = remaining_tokens.shift\n token = [token[1], token[2]] # strip position\n source_str << token[1]\n nesting += 1 if starting_nesting_token_types.include? token\n is_ending_token = token.eql?(ending_token_type)\n break if is_ending_token && nesting.eql?(0)\n nesting -= 1 if is_ending_token\n end\n source_str\n end\n end",
"def parse_text(source, rs = nil)\n rs ||= RenderState.new\n \n # check\n case rs.header_id_type\n\t\t\twhen HeaderIDType::MD5, HeaderIDType::ESCAPE\n\t\t\telse\n rs.warnings << \"illegal header id type - #{rs.header_id_type}\"\n\t\t\tend\n \n # Create a StringScanner we can reuse for various lexing tasks\n @scanner = StringScanner::new( '' )\n \n # Make a copy of the string with normalized line endings, tabs turned to\n # spaces, and a couple of guaranteed newlines at the end\n \n text = detab(source.gsub( /\\r\\n?/, \"\\n\" ))\n text += \"\\n\\n\"\n @log.debug \"Normalized line-endings: %p\" % text\n \n #text = Utilities::prePaling(text) #Insert by set.minami 2013-04-27\n #Insert by set.minami 2013-04-03\n text = transform_block_quotes(text, rs)\n nrange = []\n departure = 1\n preproc = Marshal.load(Marshal.dump(text))\n text.clear\n stack = []\n html_text_number = 0\n# Utilities::initNumberStack\n\n preproc.lines { |line|\n html_text_number += 1\n begin\n line.gsub!(/^\\{nrange:(.*?)(;\\d+)??\\}/){ |match|\n #depNum = $2.delete(';').to_i\n #departure = if depNum > 0 then depNum else 1 end\n if /h(\\d)\\-h(\\d)/i =~ $1\n nrange.push($1)\n nrange.push($2)\n if nrange.size > 2 then\n nrange.pop\n nrange.pop\n raise \"Syntax Error!\" \n end\n end\n next\n }\n @log.debug line \n #calculate numbering\n range = nrange[1].to_i - nrange[0].to_i\n if range == 0 then range = 1 end\n if range < 0 then \n p \"AoBane Syntax Error:Header range is WRONG!\" +\n \"@ l.#{html_text_number}\";exit(-1)\n raise FatalError,\"AoBane Syntax Error:Header range is WRONG!\"\n end\n if line =~ /^(%{1,#{range}})(.*?)\\n/ then\n text << Utilities.\n calcSectionNo(nrange.min,range,$1.size,departure,$2,stack) +\n \"\\n\"\n else\n text << line\n end\n @log.debug nrange.minmax\n rescue => e\n @log.warn \"AoBane Syntax WARNING l.#{html_text_number}:#{line.chomp} haven't adopted\" \n @log.warn e \n end\n }\n\n text.gsub!(/\\*\\[(.*?)\\]\\((.*?)(\\|.*?)*(\\/.*?)*\\)/){|match|\n '<font color=\"' +\n if $2.nil? then '' else $2 end\t+'\" ' +\n 'face=\"' +\n if $3.nil? then '' else $3.delete('|') end + '\" ' +\n 'size=\"' +\n if $4.nil? then '' else $4.delete('/') end + '\">' +\n $1 + '</font>'\n }\n #Insert by set.minami 2013-04-21\n text = Utilities::abbrPreProcess(text)\n #Insert by set.minami 2013-04-01\n text.gsub!(/\\\\TeX\\{(.+?)\\\\TeX\\}/){\n begin\n $1.to_mathml\n rescue => e\n puts 'math_ml Error: ' + $1\n puts e\n end\n }\n\n text = Utilities::preProcFence(text,0).join(\"\\n\") #Insert by set.minami 2013-04-27\n #Insert by set.minami 2013-03-30 \n #Insert by set.minami\n\n\t\t\t# Filter HTML if we're asked to do so\n\t\t\tif self.filter_html\n\t\t\t\t#text.gsub!( \"<\", \"<\" )\n\t\t\t\t#text.gsub!( \">\", \">\" )\n\t\t\t\t@log.debug \"Filtered HTML: %p\" % text\n\t\t\tend\n\n\t\t\t# Simplify blank lines\n\t\t\ttext.gsub!( /^ +$/, '' )\n\t\t\t@log.debug \"Tabs -> spaces/blank lines stripped: %p\" % text\n\n\n\t\t\t# Replace HTML blocks with placeholders\n\t\t\ttext = hide_html_blocks( text, rs )\n\t\t\t@log.debug \"Hid HTML blocks: %p\" % text\n\t\t\t@log.debug \"Render state: %p\" % rs\n\n\n\t\t\t# Strip footnote definitions, store in render state\n\t\t\ttext = strip_footnote_definitions( text, rs )\n\t\t\t@log.debug \"Stripped footnote definitions: %p\" % text\n\t\t\t@log.debug \"Render state: %p\" % rs\n\n\n\t\t\t# Strip link definitions, store in render state\n\t\t\ttext = strip_link_definitions( text, rs )\n\t\t\t@log.debug \"Stripped link definitions: %p\" % text\n\t\t\t@log.debug \"Render state: %p\" % rs\n\n\t\t\t# Escape meta-characters\n\t\t\ttext = escape_special_chars( text )\n\t\t\t@log.debug \"Escaped special characters: %p\" % text\n\n\t\t\t# Transform block-level constructs\n\t\t\ttext = apply_block_transforms( text, rs )\n\t\t\t@log.debug \"After block-level transforms: %p\" % text\n\n\t\t\t# Now swap back in all the escaped characters\n\t\t\ttext = unescape_special_chars( text )\n\t\t\t@log.debug \"After unescaping special characters: %p\" % text\n\n\t\t\t# Extend footnotes\n\t\t\tunless rs.footnotes.empty? then\n\t\t\t\ttext << %Q|<div class=\"footnotes\"><hr#{EmptyElementSuffix}\\n<ol>\\n|\n\t\t\t\trs.found_footnote_ids.each do |id|\n\t\t\t\t\tcontent = rs.footnotes[id]\n\t\t\t\t\thtml = apply_block_transforms(content.sub(/\\n+\\Z/, '') + %Q| <a href=\"#footnote-ref:#{id}\" rev=\"footnote\">↩</a>|, rs)\n\t\t\t\t\ttext << %Q|<li id=\"footnote:#{id}\">\\n#{html}\\n</li>|\n\t\t\t\tend\n\t\t\t\ttext << %Q|</ol>\\n</div>\\n|\n\t\t\tend\n\n\t\t\t# Display warnings\n\t\t\tif @display_warnings then\n\t\t\t\tunless rs.warnings.empty? then\n\t\t\t\t\thtml = %Q|<pre><strong>[WARNINGS]\\n|\n\t\t\t\t\thtml << rs.warnings.map{|x| Util.escape_html(x)}.join(\"\\n\")\n\t\t\t\t\thtml << %Q|</strong></pre>|\n\n\t\t\t\t\ttext = html + text\n\t\t\t\tend\n\t\t\tend\n\n #Insert by set.minami 2013-04-21\n text = Utilities::abbrPostProcess(text)\n #Insert by set.minami 2013-03-30\n text = Utilities::insertTimeStamp(text)\n text = Utilities::postProcFence(text) #Insert by set.minami 2013-04-27\n\n text = Utilities::transformSpecialChar(text) #Insert by set.minami 2013-04-27\n\n return text\n end",
"def initialize(source = nil)\n parsed_tag = process_source(source)\n\n build_tag(parsed_tag) if parsed_tag\n end",
"def get_parse(s);end",
"def parser (tokens)\n\n\t# create the new, concrete syntax tree\n\t# making it global to reduce headaches (hopefully XD )\n\t$cst = ConcreteSyntaxTree.new\n\t\n\t# define some other useful, global vars\n\t$tokens = tokens\n\t$index = 0\n\t\n\t# have to ask alan about this\n\tif $tokens.length <= 1\n\t\tputs \"Insufficient code present! There is only #{$tokens.length} token here!\"\n\t\texit\n\tend\t\n\t\n\t\n\t# Engine to full burn!!!\n\t#parse(\"Program\", program)\n\tprogram\n\t\n\t\n\tbegin\n\t\tif $tokens.length != $index\n\t\t\traise EOFDetectionError.new(\"early\", $tokens[$index - 1].lineno, $tokens[$index - 1].pos)\n\t\tend\n\trescue EOFDetectionError\n\tend\n\t\t\n\t\n\t\n\treturn $cst\nend",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def make_ast(code)\n YARD::Parser::Ruby::RubyParser.new(code, nil).parse.ast\n end",
"def parse\n begin\n @parser.parse(@source, @file, 0)\n @feature = @builder.ast\n return nil if @feature.nil? # Nothing matched\n \n # The parser used the following keywords when parsing the feature\n # @feature.language = @parser.i18n_language.get_code_keywords.map {|word| word }\n \n rescue Gherkin::Lexer::LexingError, Gherkin::Parser::ParseError => e\n e.message.insert(0, \"#{@file}: \")\n raise e\n end\n \n self\n end",
"def execute!\n line_n = 0\n level = 0\n classes = []\n @source.each_line do |line|\n line_n += 1\n line.chomp!\n # indentify scopes\n level = line_level line\n\n # ignore comments!\n next if @comment_lines.include? line_n\n\n [\n [@class_regex, 'c'],\n [@proto_meths, 'p'],\n [@func_regex, 'f'],\n [@var_regex, 'v'],\n [@block, 'b']\n ].each do |regex, kind|\n mt = item_for_regex line, regex, level, :source => line, :line => line_n, :kind => kind\n unless mt.nil?\n # TODO: one token should not fit for multiple regex\n classes.push mt if kind == 'c'\n next if kind == 'f' # wait for later to determine whether it is a class method\n @tree << mt\n end\n end\n\n # instance variable or iterator (for/in)?\n token = line.match(@token_regex )\n token ||= line.match(@iterator_regex)\n\n # we have found something!\n if not token.nil?\n # should find token through the tree first\n token_name = token[1]\n existing_token = @tree.find {|o| o[:name] == token_name}\n if existing_token\n o = existing_token\n else\n o = {\n :name => token_name,\n :level => level,\n :parent => '',\n :source => line,\n :line => line_n\n }\n end\n\n # Remove edge cases for now\n\n # - if a line containes a line like: element.getElement('type=[checkbox]').lol()\n token_match_in_line = false\n token_match_in_line = line.match token_name\n unless token_match_in_line.nil?\n offset = token_match_in_line.offset 0\n str_before = line.slice 0, offset[0]\n str_after = line.slice offset[1], line.size\n [str_before, str_after].map do |str|\n # if there are unmatch quotes, our token is in a string\n token_match_in_line = ['\"', '\\''].any? { |q| str.scan(q).size % 2 == 1 }\n end\n end\n\n if token_match_in_line\n @tree = @tree.reject {|c| c[:name] == o[:name]}\n next\n end\n\n # - scope access and comparison in if x == 'lol'\n is_in_comparison = line =~ /::|==/\n\n # - objects with blank parent (parser bug?)\n has_blank_parent = o[:parent] =~ /\\.$/\n\n # - multiple consecutive assignments\n is_previous_not_the_same = !(@tree.last and @tree.last[:name] == o[:name] and @tree.last[:level] == o[:level])\n\n if !token_match_in_line and is_in_comparison.nil? and (has_blank_parent.nil? or is_previous_not_the_same)\n unless o[:kind]\n o[:kind] = line =~ /[:=]{1}.*[-=]\\s?\\>/ ? 'f' : 'v'\n end\n o[:parent] = scope_path o\n o[:parent] = @fake_parent if o[:parent].empty?\n\n # treat variable and function with a class as parent as property\n if ['f', 'v', 'o'].include? o[:kind]\n # TODO: process func params\n maybe_parent_class = classes.find {|c| c[:name] == o[:parent] }\n if maybe_parent_class\n o[:kind] = 'p'\n end\n end\n\n @tree << o unless @tree.include? o\n end\n end\n end\n\n @tree = comb_kinds @tree\n\n @tree = trim_tree @tree\n\n # P.S when found a token, first lookup in the tree, thus the duplicate won't appear\n # so there is no need of uniq_tree\n self # chain!\n end",
"def parse\n\t\t\tGlyph.info \"Parsing: #{@context[:source][:name]}\" if Glyph.debug? && @context[:info] && @context[:source][:name]\n\t\t\t@tree = @parser.parse\n\t\t\t@document = Glyph::Document.new @tree, @context\n\t\t\t@document.inherit_from @context[:document] if @context[:document]\n\t\t\t@tree\n\t\tend",
"def parse(string = nil)\n if self.file =~ /\\.rb$/\n main = parse_ruby_file\n else\n self.string = string if string\n begin\n @yydebug = false\n main = yyparse(@lexer,:scan)\n rescue Racc::ParseError => except\n error = Puppet::ParseError.new(except)\n error.line = @lexer.line\n error.file = @lexer.file\n error.set_backtrace except.backtrace\n raise error\n rescue Puppet::ParseError => except\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue Puppet::Error => except\n # and this is a framework error\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue Puppet::DevError => except\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue => except\n error = Puppet::DevError.new(except.message)\n error.line = @lexer.line\n error.file = @lexer.file\n error.set_backtrace except.backtrace\n raise error\n end\n end\n # Store the results as the top-level class.\n return Puppet::Parser::AST::Hostclass.new('', :code => main)\n ensure\n @lexer.clear\n end",
"def parse(data); end",
"def initialize\r\n @code = ''\r\n @tags = []\r\n end",
"def parsed; end",
"def parsed; end",
"def initialize src, indent=:auto\n @src = -\"#{src}\"\n @tokens = nil\n _tokenize indent\n end",
"def parse_block_source(example)\n @debug = false\n\n # Source code for rspec is living on the metadata[:block].source location\n unless defined?(example.metadata) && defined?(example.metadata[:block]) && defined?(example.metadata[:block].source)\n @source = ''\n return\n end\n\n unless example.metadata[:source_override].nil?\n @source = example.metadata[:source_override]\n return\n end\n \n source = example.metadata[:block].source.strip\n\n segments = source.match(EXTRACT_CONTENT_REX)\n\n unless defined?(segments) && defined?(segments[:content])\n @source = ''\n return\n end\n @source = remove_wasted_indentation(segments[:content])\n @source\n end",
"def parse_source(raw)\n if raw =~ /^(.*title:\\s.*?)\\n\\n(.*)/m then\n begin\n @data = YAML.load($1)\n @content = $2\n rescue Exception => e\n raise \"Parse Exception: #{e.message}\"\n end\n end\n end",
"def markup_code\n return '' unless @token_stream\n\n src = RDoc::TokenStream.to_html @token_stream\n\n # dedent the source\n indent = src.length\n lines = src.lines.to_a\n lines.shift if src =~ /\\A.*#\\ *File/i # remove '# File' comment\n lines.each do |line|\n if line =~ /^ *(?=\\S)/\n n = $&.length\n indent = n if n < indent\n break if n == 0\n end\n end\n src.gsub!(/^#{' ' * indent}/, '') if indent > 0\n\n add_line_numbers(src) if options.line_numbers\n\n src\n end",
"def initialize source, include_vars = false\n @include_vars = include_vars\n @source = source\n\n @fake_parent = 'window'\n\n # tree maps the ... tree :-)\n @tree = []\n\n # regexes\n @block = /^\\s*(if\\s+|unless\\s+|switch\\s+|loop\\s+|do\\s+|for\\s+)/\n @class_regex = /\\s*class\\s+(?:@)?([\\w\\.]*)/\n @func_regex = /^\\s*(?<name>[a-zA-Z0-9_]+)\\s?[=:]\\s?(?<params>\\([@a-zA-Z0-9_]*\\))?\\s?[=-]>/\n @proto_meths = /^\\s*(?<parent>[A-Za-z]+)::(?<name>[@a-zA-Z0-9_]*)/\n @var_regex = /([@a-zA-Z0-9_]+)\\s*[:=]\\s*[^-=]*$/\n @token_regex = /([@a-zA-Z0-9_]+)\\s*[:=]/\n #@iterator_regex = /^\\s*for\\s+([a-zA-Z0-9_]*)\\s*/ # for in/of\n @iterator_regex = /^\\s*for\\s+(?<name>[a-zA-Z0-9_]+)\\s+(in|of)(?<parent>.)*/ # use named captures too specify parent variable in iterator\n @comment_regex = /^\\s*#/\n @start_block_comment_regex = /^\\s*###/\n @end_block_comment_regex = /^.*###/\n @oneline_block_comment_regex = /^\\s*###.*###/\n @comment_lines = mark_commented_lines\n end",
"def build_parser\n code = ''\n\n %w[opal/ruby/nodes opal/ruby/parser opal/ruby/ruby_parser].each do |src|\n full = File.join OPAL_PATH, 'opal_lib', src + '.rb'\n compiled = compile_source full\n code += \"opal.register('#{src}.rb', #{compiled});\"\n end\n\n code += build_stdlib 'racc/parser.rb', 'strscan.rb', 'dev.rb'\n code += \"opal.require('dev');\"\n\n code\n end",
"def start\n parse!\n run\n end",
"def run(source_code, filename: nil)\n return if source_code.empty?\n @results += process_ast(source_code, yield, filename: filename)\n end"
] |
[
"0.8080453",
"0.7659636",
"0.74575233",
"0.74575233",
"0.74575233",
"0.73705333",
"0.7295878",
"0.70985526",
"0.70657474",
"0.7049437",
"0.6974573",
"0.6964625",
"0.6756798",
"0.6689205",
"0.66773313",
"0.6665027",
"0.6665027",
"0.6647752",
"0.66167814",
"0.6578629",
"0.6575981",
"0.65492374",
"0.65402794",
"0.65402794",
"0.6455731",
"0.63814783",
"0.63620275",
"0.6327687",
"0.6327687",
"0.6327687",
"0.6321725",
"0.6303753",
"0.6283295",
"0.6262742",
"0.625099",
"0.6236211",
"0.6235555",
"0.62037146",
"0.61956894",
"0.61946464",
"0.61898094",
"0.61897576",
"0.6178719",
"0.6178719",
"0.6178719",
"0.6178719",
"0.6165371",
"0.6155148",
"0.6151154",
"0.6151154",
"0.6143248",
"0.61082137",
"0.61001474",
"0.60862476",
"0.6084435",
"0.6084435",
"0.6084435",
"0.60684735",
"0.60595095",
"0.60533386",
"0.6053074",
"0.6044",
"0.6031714",
"0.6027017",
"0.6014998",
"0.5983948",
"0.597958",
"0.59794027",
"0.59720033",
"0.5970531",
"0.5968386",
"0.59598315",
"0.5954332",
"0.5946123",
"0.5942811",
"0.59374124",
"0.5936871",
"0.59359235",
"0.59138185",
"0.5892787",
"0.5892787",
"0.5892787",
"0.5892787",
"0.58831775",
"0.58689994",
"0.58549017",
"0.5836363",
"0.58359814",
"0.5835343",
"0.5827692",
"0.5820443",
"0.5820443",
"0.58161277",
"0.58124685",
"0.5802505",
"0.5795816",
"0.5794232",
"0.57910556",
"0.57762676",
"0.57731175"
] |
0.6411166
|
25
|
Render takes a hash with local variables. if you use the same filters over and over again consider registering them globally with Template.register_filter if profiling was enabled in Templateparse then the resulting profiling information will be available via Templateprofiler Following options can be passed: filters : array with local filters registers : hash with register variables. Those can be accessed from filters and tags and might be useful to integrate liquid more with its host application
|
def render(*args)
return '' if @root.nil?
context = case args.first
when Liquid::Context
c = args.shift
if @rethrow_errors
c.exception_renderer = Liquid::RAISE_EXCEPTION_LAMBDA
end
c
when Liquid::Drop
drop = args.shift
drop.context = Context.new([drop, assigns], instance_assigns, registers, @rethrow_errors, @resource_limits)
when Hash
Context.new([args.shift, assigns], instance_assigns, registers, @rethrow_errors, @resource_limits)
when nil
Context.new(assigns, instance_assigns, registers, @rethrow_errors, @resource_limits)
else
raise ArgumentError, "Expected Hash or Liquid::Context as parameter"
end
output = nil
case args.last
when Hash
options = args.pop
output = options[:output] if options[:output]
static_registers = context.registers.static
options[:registers]&.each do |key, register|
static_registers[key] = register
end
apply_options_to_context(context, options)
when Module, Array
context.add_filters(args.pop)
end
# Retrying a render resets resource usage
context.resource_limits.reset
if @profiling && context.profiler.nil?
@profiler = context.profiler = Liquid::Profiler.new
end
context.template_name ||= name
begin
# render the nodelist.
@root.render_to_output_buffer(context, output || +'')
rescue Liquid::MemoryError => e
context.handle_error(e)
ensure
@errors = context.errors
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def render_with(**locals)\n render_with_template(locals: locals)\n end",
"def render_with_liquid?; end",
"def render_with_liquid?; end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def liquid_view_filters\n []\n end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def render_template(context, options); end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil)); end",
"def _render_template(options); end",
"def _render_template(options); end",
"def render(options = {})\n template.render options\n end",
"def liquid_renderer; end",
"def render\n context = Context.new(location) # prime context/scope\n result = content\n\n filters.each do |filter|\n if filter == 'html' # TODO: +next+ if html format and html filter ?\n engine = Tilt[format]\n else\n engine = Tilt[filter]\n end\n raise \"unknown filter #{filter}\" unless engine\n result = Dir.chdir(location) do\n engine.new{result}.render(context)\n end\n end\n @result = result\n end",
"def render(*args) \n return '' if @root.nil? \n \n context = case args.first\n when Liquor::Context\n args.first\n when Hash\n Context.new([args.first, assigns], instance_assigns, registers, @rethrow_errors)\n when nil\n Context.new(assigns, instance_assigns, registers, @rethrow_errors)\n else\n raise ArgumentError, \"Expect Hash or Liquor::Context as parameter\"\n end\n \n options = nil\n case args.last\n when Hash\n options = args.last\n \n if options[:registers].is_a?(Hash)\n self.registers.merge!(options[:registers]) \n end\n\n if options[:filters]\n context.add_filters(options[:filters])\n end\n \n if options[:layout]\n raise ArgumentError, \"Expected Liquor::Template as layout argument\" unless options[:layout].is_a? Liquor::Template\n end \n \n when Module\n context.add_filters(args.last) \n when Array\n context.add_filters(args.last) \n end\n \n begin \n # render the nodelist.\n # for performance reasons we get a array back here. join will make a string out of it\n res = @root.render(context).join\n \n if options && options[:layout]\n content_for_assigns = (context.has_key?(\"content_for\") ? context[\"content_for\"] : {})\n content_for_assigns = content_for_assigns.merge({ \"_rendered_template_\" => res })\n \n case args.first\n when Liquor::Context\n args.first[\"content_for\"] = content_for_assigns\n when Hash\n args.first.merge!({ \"content_for\" => content_for_assigns })\n end \n \n layout_template = args.last.delete(:layout)\n \n # Here we execute render method of the Liquor::Template object (we execute _this_ method)\n # It is not the @root.render method. It is a result of the @root.render(context).join\n # so we don't need to call join here.\n res = layout_template.render(*args)\n end\n \n res\n ensure\n @errors = context.errors\n end\n end",
"def render(options = {}, &block)\n\t\t\t\t@options[:global] = options\n\n\t\t\t\t# Hash\n\t\t\t\thash = 1\n\n\t\t\t\t# Parse axes\n\t\t\t\t@options[:global][:x_axis] = parse_axis(@options[:global][:x_axis])\n\t\t\t\t@options[:global][:y_axis] = parse_axis(@options[:global][:y_axis])\n\n\t\t\t\t# Call nested block to capture parts and its options\n\t\t\t\tunused = @template.capture(self, &block).to_s\n\n\t\t\t\t# Render parts\n\t\t\t\tresult = \"\"\n\t\t\t\tresult += %{\n\t\t\t\t\t<table id=\"statistics-#{hash}\" class=\"table statistics\">\n\t\t\t\t\t\t#{render_parts}\n\t\t\t\t\t</table>\n\t\t\t\t}\n\t\t\t\treturn result.html_safe\n\t\t\tend",
"def preprocess(template, format, options={})\n render_args = [\n default_assigns.merge(options[:assigns] || {}),\n {\n :filters => default_filters + (options[:filters] || []),\n :registers => default_registers.merge(options[:registers] || {})\n }\n ]\n\n template.render(*render_args)\n end",
"def render(cache: true, &block)\n\t\t\t@cache = cache\n\t\t\t## Compile Tilt to instance hash\n\t\t\treturn unless @filename\n\n\t\t\ttilt = compile_file\n\t\t\t## Render Tilt from instance hash with new options\n\t\t\tlayout_render tilt.render(@scope, @locals, &block)\n\t\tend",
"def render(context, options); end",
"def render_and_evaluate(options = {})\n render(options)\n evaluate\n end",
"def render_with aInstVars = {}\n context = Object.new.instance_eval do\n aInstVars.each_pair do |var, val|\n instance_variable_set var, val\n end\n\n binding\n end\n\n result(context)\n end",
"def render_for_debug\n report_state_hash = YAML.load(self.view_state)\n\n <<-EOS\n <h3>search_fields</h3>\n #{report_state_hash[:search_fields].inspect}\n <hr />\n <h3>full_parameter_query</h3>\n #{report_state_hash[:full_parameter_query].inspect}\n <hr />\n <h3>parameter_fields_values</h3>\n #{report_state_hash[:parameter_fields_values].inspect}\n <hr />\n <h3>search_engine_or_values</h3>\n #{report_state_hash[:search_engine_or_values].inspect}\n <hr />\n <h3>search_engine_limit</h3>\n #{report_state_hash[:search_engine_limit].inspect}\n <hr />\n <h3>functions</h3>\n #{report_state_hash[:functions].inspect}\n <hr />\n <h3>search_engine_group_by_columns</h3>\n #{report_state_hash[:search_engine_group_by_columns].inspect}\n <hr />\n <h3>search_engine_order_by_columns</h3>\n #{report_state_hash[:search_engine_order_by_columns].inspect}\n <hr />\n <h3>main_table_name</h3>\n #{report_state_hash[:main_table_name].inspect}\n <hr />\n <h3>table_name</h3>\n #{report_state_hash[:table_name].inspect}\n <hr />\n <h3>report_name</h3>\n #{report_state_hash[:report_name].inspect}\n <hr />\n <h3>operator_signs</h3>\n #{report_state_hash[:operator_signs].inspect}\n <hr />\n <h3>columns_list</h3>\n #{report_state_hash[:columns_list].inspect}\n <hr />\n EOS\n end",
"def render(options = {}, locals = {}, &block)\n buffer = super\n opts = { context: self, buffer: buffer, options: options, locals: locals }\n ActiveSupport::Notifications.instrument(:render_partial, opts)\n buffer\n end",
"def render(opts={})\n update(opts)\n render_template\n end",
"def render(params)\n attributes = expand_arguments(Hashie.stringify_keys(params.to_h))\n liquid_template = Liquid::Template.parse(template)\n\n liquid_template.render(attributes, **render_opts).tap do\n unless liquid_template.errors.empty?\n raise LiquidTemplateError, \"#{liquid_template.errors.map(&:message).join(\"\\n\")}\"\n end\n end.gsub(/\\n/, ' ').gsub(/\\s{2,}/, ' ').strip\n rescue ArgumentError => e\n raise UnresolvedReferenceError.new(e)\n end",
"def render_liquid(content, payload, info, path); end",
"def render(options = nil, scope = Object.new)\n options ||= @act\n format = nil\n template_path = nil\n case options\n when Hash\n format = options[:format].to_s.empty? ? 'html' : options[:format]\n if options[:partial]\n template_path = compute_template_path(\"_#{options[:partial]}\", format)\n template_source = ERB.new(File.read(template_path), nil, '-', '@_out_buf').src\n elsif options[:action]\n template_path = compute_template_path(options[:action], format)\n template_source = ERB.new(File.read(template_path),\n nil, '-', '@_out_buf').src\n elsif options[:file]\n template_path = File.join(config.template_root, options[:file])\n template_source = ERB.new(File.read(options), nil, '-', '@_out_buf').src\n elsif options[:text]\n output = ERB::Util.h(options[:text])\n elsif options[:html]\n output = options[:html]\n elsif options[:inline]\n template_path = \"#{request_method} #{@act}\"\n template_source = ERB.new(options[:inline].to_s, nil, '-', '@_out_buf').src\n end\n when Symbol\n format = 'html'\n template_path = compute_template_path(options, 'html')\n template_source = ERB.new(File.read(template_path), nil, '-', '@_out_buf').src\n when String\n format = 'html'\n template_path = File.join(config.template_root, options)\n template_source = ERB.new(File.read(template_path), nil, '-', '@_out_buf').src\n end\n \n unless output\n # ヘルパの準備\n ([Mizinco::Helper, ERB::Util] | self.class.helpers).each{ |helper| scope.extend helper }\n # インスタンス変数のコピー\n scope.instance_variable_set('@app', self)\n instance_variables.collect do |var|\n scope.instance_variable_set(var, instance_variable_get(var))\n end\n \n # スクリプト実行\n original_out_buf =\n scope.instance_variables.any? { |var| var.to_sym == :@_out_buf } &&\n scope.instance_variable_get(:@_out_buf)\n scope.instance_eval template_source, template_path, 0\n output = scope.instance_variable_get(:@_out_buf)\n scope.instance_variable_set(:@_out_buf, original_out_buf)\n end\n \n res.write output if !options.is_a?(Hash) || options[:partial].to_s.empty?\n\n output\n end",
"def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end",
"def renderfilterchainhash\n return @renderHash\n end",
"def render(scope, locals = {})\n @_template.render(scope.dup, locals)\n end",
"def render(opts={})\n opts\n end",
"def _filter_display\n @apotomo_emit_raw_view = true\n render :view => '_filters'\n end",
"def render_with_filters\n render action: :formatted_xml_erb\n end",
"def show\n #Benchmark.bm( 20 ) do |bm|\n # bm.report( \"Access JSON:\" ) do\n # end\n #end\n #binding.pry\n respond_to do |format|\n format.html do\n render :show,\n locals: { memory: @memory.jsonize(externals: { events: @events.jsonize }),\n cloud: @calendary_cloud.jsonize }\n end\n format.json { render json: @memory.jsonize(externals: { events: @events.jsonize }) }\n end\n end",
"def render(*args)\n options = {}\n if args.length == 1 && args[0].class == String\n # render partial\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Hash\n # render :partial => 'partial', :locals => {:var1 => value1, :var2 => value2}\n options = args[0]\n elsif args.length == 2 && args[0].class == String && args[1].class == Hash\n # render 'partial', :var1 => value1, :var2 => value2\n options[:locals] = args[1]\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Array\n # render ['xpartials','ypartials']\n raise PartialError, \"render array not yet implemented\"\n else\n raise PartialError, \"unsupported arguments\"\n end\n partial = options[:partial] || nil\n raise PartialError, \"partial not specified\" unless partial\n prawn = options[:prawn] || pdf\n @locals_stack ||= []\n @locals_stack.push @locals\n @locals = options[:locals]\n @pdf_stack ||= []\n @pdf_stack.push @pdf\n @pdf = prawn\n instance_eval(partial_source(partial), __FILE__, __LINE__)\n @pdf = @pdf_stack.pop\n @locals = @locals_stack.pop\n end",
"def liquid_filters\n [\n DesignResourceFilter,\n AttributeFilter\n ]\n end",
"def to_html aOpts = {}\n aOpts[:@summarize] = true unless aOpts.key? :@summarize\n aOpts[template_ivar] = self\n template.render_with(aOpts)\n end",
"def render(identifier, other_assigns={}, &block)\n # Find layout\n layout = @site.layouts.find { |l| l.identifier == identifier.cleaned_identifier }\n raise Nanoc3::Errors::UnknownLayout.new(identifier.cleaned_identifier) if layout.nil?\n\n # Capture content, if any\n captured_content = block_given? ? capture(&block) : nil\n\n # Get assigns\n assigns = {\n :content => captured_content,\n :item => @item,\n :item_rep => @item_rep,\n :items => @items,\n :layout => layout,\n :layouts => @layouts,\n :config => @config,\n :site => @site\n }.merge(other_assigns)\n\n # Get filter name\n filter_name, filter_args = @site.compiler.filter_for_layout(layout)\n raise Nanoc3::Errors::CannotDetermineFilter.new(layout.identifier) if filter_name.nil?\n\n # Get filter class\n filter_class = Nanoc3::Filter.named(filter_name)\n raise Nanoc3::Errors::UnknownFilter.new(filter_name) if filter_class.nil?\n\n # Create filter\n filter = filter_class.new(assigns)\n\n # Layout\n @site.compiler.stack.push(layout)\n result = filter.run(layout.raw_content, filter_args)\n @site.compiler.stack.pop\n\n # Append to erbout if we have a block\n if block_given?\n erbout = eval('_erbout', block.binding)\n erbout << result\n end\n\n # Done\n result\n end",
"def render(options = {})\n options.merge! :vendor_lua => @vendor_lua if @vendor_lua\n #debugger\n #puts \">> LAMINATE RENDER START. Disabling gc.\"\n #GC.disable\n # Compile template if needed\n name = @name.dup\n prepare_template(name)\n lua = @loader.load_compiled(name).dup\n\n @errors = []\n error_proc = Proc.new {|err| handle_error(err, lua, options)}\n\n State.new(options).run(error_proc) do |state|\n state.logger = logger\n state.eval(lua)\n # Included template functions. The trick is that we don't return to Ruby and eval the included template, because the\n # Lua binding doesn't like re-entering eval. So instead we bind a function '_load_template' which returns the template\n # code, and then we eval it inside Lua itself using 'loadstring'. Thus the template 'include' function is actually\n # a native Lua function.\n state.function '_load_template' do |template_name|\n prepare_template(template_name)\n load_template_innerds(template_name)\n end\n\n state.eval(\"return #{@compiler.lua_template_function(name)}()\")\n end\n end",
"def render_custom(template, params)\n if (template != nil)\n blank = Liquid::Template.parse(template)\n blank.render(params)\n end\n end",
"def render(options = {})\n raise double_render! if rendered?\n @render_opts = options\n end",
"def rendered_with_filter( subscription )\n render( subscription.recipient ) if (! rendered) # prepare rendered if not already done!\n layout.rendered = rendered # copy our version\n layout.rendered_with_filter( :subscription => subscription, :bulletin => self.bulletin,\n :recipient => subscription.recipient, :project => self.bulletin.project)\n end",
"def render_liquid(content, payload, info, path = T.unsafe(nil)); end",
"def render(view, locals, buffer = T.unsafe(nil), add_to_stack: T.unsafe(nil), &block); end",
"def render_template(view, template, layout_name, locals); end",
"def render(views, filter_results)\n @content\n end",
"def render(locals = {})\n liquify(wrap_in_layout(string), (options[:locals] || {}).merge(locals))\n end",
"def render(_context=Context.new)\n _context = Context.new(_context) if _context.is_a?(Hash)\n @proc ||= _render()\n return _context.instance_eval(&@proc)\n end",
"def render_variable(context); end",
"def to_liquid\r\n {\r\n 'per_page' => per_page,\r\n 'posts' => posts,\r\n 'total_posts' => total_posts,\r\n 'total_pages' => total_pages,\r\n 'page' => page,\r\n 'previous_page' => previous_page,\r\n 'previous_page_path' => previous_page_path,\r\n 'next_page' => next_page,\r\n 'next_page_path' => next_page_path\r\n }\r\n end",
"def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval {binding})\n end",
"def render(scope=Object.new, locals={}, &block)\n if @data.nil?\n @data = @reader.call(self)\n compile!\n end\n evaluate scope, locals || {}, &block\n end",
"def render\n Log.dev(\"Action: #{self}\")\n stack do\n if should_cache?\n # Ignore cache if there is flash session data as the response probably\n # expects to include it, making it unique for this user and request.\n if Global.no_cache_flash && !Current.session.flash.empty?\n Log.debug(\"Action caching ignored as session flash data is present.\")\n uncached_render\n else\n cached_render\n end\n else\n uncached_render\n end\n end\n end",
"def render(view, locals, buffer = nil, add_to_stack: true, &block)\n instrument_render_template do\n compile!(view)\n if buffer\n view._run(method_name, self, locals, buffer, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block)\n nil\n else\n view._run(method_name, self, locals, OutputBuffer.new, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block)&.to_s\n end\n end\n rescue => e\n handle_render_error(view, e)\n end",
"def render opts = {}\n renderer.render opts\n end",
"def template_locals template_name, supersed_options \n { :collection => @collection, :template_name => template_name, :separator => nil }.merge supersed_options\n end",
"def evaluate(scope, locals, &block)\n \"SC.TEMPLATES[\\\"#{scope.logical_path}\\\"] = Handlebars.template(#{precompile(data)});\\n\"\n end",
"def render(*args, &block); end",
"def to_liquid\n {\n 'page' => page,\n 'per_page' => per_page,\n 'posts' => posts,\n 'total_posts' => total_posts,\n 'total_pages' => total_pages,\n 'previous_page' => previous_page,\n 'previous_page_url' => previous_page_url,\n 'next_page' => next_page,\n 'next_page_url' => next_page_url\n }\n end",
"def prepare\n loader = Twig::Loader::Array.new({ file => data })\n\n if options['paths']\n loader = Twig::Loader::Chain.new([\n loader,\n Twig::Loader::Filesystem.new(options['paths'])\n ])\n elsif !@@loader.nil?\n loader = Twig::Loader::Chain.new([\n loader,\n @@loader\n ])\n end\n @engine = Twig::Environment.new(loader, {\n 'debug' => !!@@debug,\n 'auto_reload' => !!@@auto_reload,\n 'charset' => 'UTF-8',\n 'strict_variables' => false,\n 'autoescape' => 'html', #'filename',\n 'cache' => false,\n 'optimizations' => -1\n })\n end",
"def render_for( short_name, options = {})\n template = template_for(short_name)\n render options.merge(template.to_params)\n end",
"def render(engine, data=nil, options={}, locals={}, &block)\n # If engine is a hash then render data converted to json\n content_type(:json, :charset => 'utf-8') and return engine.to_json if engine.is_a?(Hash) || engine.is_a?(Array)\n\n # If engine is nil, ignore engine parameter and shift up all arguments\n # render nil, \"index\", { :layout => true }, { :localvar => \"foo\" }\n engine, data, options = data, options, locals if engine.nil? && data\n\n # Data is a hash of options when no engine isn't explicit\n # render \"index\", { :layout => true }, { :localvar => \"foo\" }\n # Data is options, and options is locals in this case\n data, options, locals = nil, data, options if data.is_a?(Hash)\n\n # If data is unassigned then this is a likely a template to be resolved\n # This means that no engine was explicitly defined\n data, engine = *resolve_template(engine, options.dup) if data.nil?\n\n # PATCH: Store the current template being rendered\n # This method will also get executed for partials and stuff\n # so we just need to store it the first time we're called\n @_template ||= data\n\n # Setup root\n root = settings.respond_to?(:root) ? settings.root : \"\"\n\n # Use @layout if it exists\n options[:layout] = @layout if options[:layout].nil? || options[:layout] == true\n\n # Resolve layouts similar to in Rails\n if options[:layout].nil? && !settings.templates.has_key?(:layout)\n layout_path, layout_engine = *resolved_layout\n options[:layout] = layout_path || false # We need to force layout false so sinatra don't try to render it\n options[:layout] = false unless layout_engine == engine # TODO allow different layout engine\n options[:layout_engine] = layout_engine || engine if options[:layout]\n elsif options[:layout].present?\n options[:layout] = settings.fetch_layout_path(options[:layout] || @layout)\n end\n\n # Cleanup the template\n @current_engine, engine_was = engine, @current_engine\n @_out_buf, _buf_was = \"\", @_out_buf\n\n # Pass arguments to Sinatra render method\n super(engine, data, options.dup, locals, &block)\n ensure\n @current_engine = engine_was\n @_out_buf = _buf_was\n end",
"def render template, options = {}, &block\n\t\t\t\t# make sure templates are enabled\n\t\t\t\treturn false if host_params[:templates].nil?\n\t\t\t\t# set up defaults\n\t\t\t\t@warned_type ||= (Iodine.warn(\"Deprecation warning! `#render` method called with optional `:type`. Use `:format` instead!\") && true) if options[:type]\n\t\t\t\toptions[:format] ||= (options[:type] || params[:format] || 'html'.freeze).to_s\n\t\t\t\toptions[:locale] ||= params[:locale].to_sym if params[:locale]\n\t\t\t\t# render layout using recursion, if exists\n\t\t\t\tif options[:layout]\n\t\t\t\t\tlayout = options.delete(:layout)\n\t\t\t\t\tinner = render(template, options, &block)\n\t\t\t\t\treturn false unless inner\n\t\t\t\t\treturn render(layout, options) { inner }\n\t\t\t\tend\n\t\t\t\t#update content-type header\n\t\t\t\tcase options[:format]\n\t\t\t\twhen 'html', 'js', 'txt'\n\t\t\t\t\tresponse['content-type'] ||= \"#{MimeTypeHelper::MIME_DICTIONARY[\".#{options[:format]}\".freeze]}; charset=utf-8\".freeze\n\t\t\t\telse\n\t\t\t\t\tresponse['content-type'] ||= \"#{MimeTypeHelper::MIME_DICTIONARY[\".#{options[:format]}\".freeze]}\".freeze\n\t\t\t\tend\n\t\t\t\t# Circumvents I18n persistance issues (live updating and thread data storage).\n\t\t\t\tI18n.locale = options[:locale] || I18n.default_locale if defined?(I18n) # sets the locale to nil for default behavior even if the locale was set by a previous action - removed: # && options[:locale]\n\t\t\t\t# find template and create template object\n\t\t\t\ttemplate = [template] if template.is_a?(String)\n\t\t\t\tfilename = ( template.is_a?(Array) ? File.join( host_params[:templates].to_s, *template) : File.join( host_params[:templates].to_s, *template.to_s.split('_'.freeze) ) ) + (options[:format].empty? ? ''.freeze : \".#{options[:format]}\".freeze)\n\t\t\t\t::Plezi::Renderer.render filename, binding, &block\n\t\t\tend",
"def render(state, format, local_variables = {})\n view.template_format = format\n render_opts = { :file => find_template(state), :locals => local_variables }\n render_opts[:layout] = find_template(layout) if layout\n view.render(render_opts)\n end",
"def setup_renderer(renderer)\n renderer.default_assigns = liquid_assigns if respond_to?(:liquid_assigns, true)\n renderer.default_registers = liquid_registers if respond_to?(:liquid_registers, true)\n renderer.default_filters = liquid_filters if respond_to?(:liquid_filters, true)\n end",
"def render(context_scope = nil)\n context_scope ||= options[:scope] || self\n\n set_object_instance_variable if context_scope == self\n\n locals = { :object => object }.merge(options.fetch(:locals, {}))\n\n engine.apply(context_scope, locals).render\n end",
"def render_ruby(engine, template, options={}, locals={}, &block)\n options, template = template, nil if template.is_a?(Hash)\n template = Proc.new { block } if template.nil?\n render engine, template, options, locals\n end",
"def render_mustache(template, data, options, locals, &block)\n name = Mustache.classify(template.to_s)\n\n if defined?(Views) && Views.const_defined?(name)\n instance = Views.const_get(name).new\n else\n instance = Mustache.new\n end\n\n locals.each do |local, value|\n instance[local] = value\n end\n\n # If we're paseed a block it's a subview. Sticking it in yield\n # lets us use {{yield}} in layout.html to render the actual page.\n instance[:yield] = block.call if block\n\n instance.template = data\n instance.to_html\n end",
"def render(options = nil, extra_options = {}, &block)\n # your code goes here\n prep_pagination_info(@results_h[:pagination_info]) if @results_h && @results_h[:pagination_info]\n \n # call the ActionController::Base render to show the page\n super\n end",
"def render(view, locals, buffer=nil, &block)\n mod = view.is_a?(Deface.template_class) ? Deface.template_class : view.singleton_class\n\n if @compiled && !mod.instance_methods.include?(method_name.to_sym)\n @compiled = false\n @source = refresh(view).source\n end\n buffer.nil? ? super(view, locals, buffer, &block) : super(view, locals, **buffer, &block)\n end",
"def render_template(options)\n @assigns_added = nil\n template, layout, partial = options.values_at(:_template, :_layout, :_partial)\n _render_template(template, layout, options, partial)\n end",
"def render(path, hash={})\n @template.class.new(path, localized_look_in).render(@hash.merge(hash)).strip\n end",
"def render_facet_partials fields = facet_field_names, options = {}\n safe_join(facets_from_request(fields).map do |display_facet|\n render_facet_limit(display_facet, options)\n end.compact, \"\\n\")\n end",
"def render(scope = Object.new, &block)\n @scope_object = scope\n @buffer = Haml::Buffer.new(@options)\n\n local_assigns = @options[:locals]\n\n # Get inside the view object's world\n @scope_object.instance_eval do\n # Set all the local assigns\n local_assigns.each do |key,val|\n self.class.send(:define_method, key) { val }\n end\n end\n\n # Compile the @precompiled buffer\n compile &block\n\n # Return the result string\n @buffer.buffer\n end",
"def prepare_liquid_template(template)\n end",
"def render_template(options={})\n # puts \"ActionController#render_template(start), options = #{options}\"\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n #Timer.time_stamp(\"render_template (begin)\")\n content_fors = options.delete(:content_for) || {}\n partial = options[:partial]\n\n # renderer = ActionView::Renderer.new(self, path: render_path)\n # puts \"renderer = #{@renderer.inspect}\"\n if partial\n # puts \"ActionController#render_template (partial)\"\n top_view_html = @renderer.render(options)\n else\n # puts \"ActionController#render_template (file)\"\n top_view_html = @renderer.render(file: render_path, options: {locals: @__locals})\n end\n\n content_for_htmls = {}\n content_fors.each do |key, selector|\n content_for_html = @renderer.content_fors[key]\n #puts \"content for #{key} = #{content_for_html}\"\n content_for_htmls[selector] = content_for_html\n end\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n [top_view_html, content_for_htmls]\n end",
"def render_variable(context)\n Liquid::Template.parse(@file).render(context) if @file =~ VARIABLE_SYNTAX\n end",
"def __ag_render_a_template(key, template, options, other, &block)\n _ag_render_without_silverlight(key, template, options, other, &block)\n end",
"def render(opts = {}, &block)\n \n opts[:status] = 200 if !opts[:status]\n if opts[:to_yaml] then\n headers[\"Content-Type\"] = \"text/plain;\"\n yaml = Hash.from_xml(render_to_string(:template => opts[:to_yaml], :layout => false)).to_yaml\n render :text => yaml, :layout => false, :status => opts[:status]\n elsif opts[:to_json] then\n hash = Hash.from_xml(render_to_string(:template => opts[:to_json], :layout => false))\n hash = hash[hash.keys.first] if hash.keys.length == 1\n content = hash.to_json\n cbparam = params[:callback] || params[:jsonp]\n content = \"#{cbparam}(#{content})\" unless cbparam.blank?\n render :json => content, :layout => false, :status => opts[:status]\n elsif opts[:to_xml]\n content = render_to_string(:template => opts[:to_xml], :layout => false)\n headers[\"Content-Type\"] = \"application/xml;\"\n render :text => content, :layout => false, :status => opts[:status]\n elsif opts[:response]\n render_rest_response opts[:response]\n else\n super opts, &block\n end\nend",
"def rendered_templates; end",
"def render view, options\n options.format! view\n path_store.cached options do\n options.file = template_path view, options\n view.render_with options\n end\n end",
"def evaluate(scope, locals, &block)\n t = data\n if scope.pathname.to_s =~ /\\.mustache\\.(handlebars|hjs)/\n t = t.gsub(/\\{\\{(\\w[^\\}\\}]+)\\}\\}/){ |x| \"{{unbound #{$1}}}\" }\n end\n \"Ember.TEMPLATES[\\\"#{scope.logical_path}\\\"] = Handlebars.template(#{precompile t});\\n\"\n end",
"def liquid_block(block)\n Liquid::Template.parse(block).render(@context)\n end",
"def render_ruby(engine, template, options = {}, locals = {}, &block)\n options, template = template, nil if template.is_a?(Hash)\n template = Proc.new { block } if template.nil?\n\n render engine, template, options, locals\n end",
"def render(*args,&blk)\n opts = (Hash === args.last) ? args.pop : {}\n \n action = opts[:action] || params[:action]\n opts[:layout] ||= _layout \n \n choose_template_format(Merb.available_mime_types, opts)\n \n # Handles the case where render is called with an object\n if obj = args.first || opts[:obj]\n # Check for a template\n unless find_template({:action => action}.merge(opts))\n fmt = content_type\n if transform_method = Merb.mime_transform_method(fmt)\n set_response_headers fmt\n transform_args = provided_format_arguments_for(fmt)\n return case transform_args\n when Hash then obj.send(transform_method, transform_args)\n when Array then obj.send(transform_method, *transform_args)\n when Proc then\n case transform_args.arity\n when 3 then transform_args.call(obj, self, transform_method)\n when 2 then transform_args.call(obj, self)\n when 1 then transform_args.call(obj)\n else transform_args.call\n end\n else obj.send(transform_method)\n end\n end \n end\n end \n \n case\n when status = opts[:nothing]\n return render_nothing(status)\n \n when opts[:inline]\n text = opts.delete(:inline)\n return render_inline(text, opts)\n else \n set_response_headers @_template_format\n \n case @_format_value\n when String\n return @_format_value\n when Symbol\n if !Merb.available_mime_types.keys.include?(@_format_value) # render :js => \"Some js value\"\n template = find_template(:action => @_format_value)\n else\n if opts[@_format_value] == @_format_value # An edge case that lives in the specs\n # says that a render :js => :js should be catered for\n template = find_template(:action => @_format_value)\n else\n # when called from within an action as plain render within a respond_to block\n template = find_template(opts.merge( :action => action ))\n end\n end\n else\n if template = opts[:template]\n # render :template => \"this_template\"\n template = find_template( :template => template)\n else\n # a plain action render\n # def index; render; end\n template = find_template(:action => action)\n end\n end\n end\n \n unless template\n raise TemplateNotFound, \"No template matched at #{unmatched}\"\n end\n self.template ||= File.basename(template)\n\n engine = Template.engine_for(template)\n options = {\n :file => template,\n :view_context => (opts[:clean_context] ? clean_view_context(engine) : cached_view_context(engine)),\n :opts => opts\n }\n content = engine.transform(options)\n if engine.exempt_from_layout? || opts[:layout] == :none || [:js].include?(@_template_format)\n content \n else\n wrap_layout(content, opts)\n end\n end",
"def evaluate(scope, locals, &block)\n Tilt.new(eval(data)).render(scope, locals, &block)\n end",
"def do_render\n Mustache.render(template, self)\n end",
"def render_page\n _track_rendering(@page.path) {\n Filters.process(self, @page, ::Webby::Resources::File.read(@page.path))\n }\n end",
"def render_template(name, variables = {}, engine_options = {}, &blk)\n path = settings[:views] || './views'\n full_name = File.expand_path(File.join(path, name))\n\n # load and cache template\n @@cached_templates ||= {}\n t = @@cached_templates[full_name] =\n (Happy.env.production? && @@cached_templates[full_name]) || begin\n engine_options = {\n :default_encoding => 'utf-8',\n :outvar => \"@output_buffer\" # for erb\n }.merge(engine_options)\n Tilt.new(full_name, engine_options)\n end\n\n # render template\n t.render(self, variables, &blk)\n end",
"def render(language,argsx={},callback_options={})\n @language=language\n if argsx==nil || argsx.is_a?(String)\n # this happen if template calls render instead of render_partial\n raise \"bad args to render. did you mean to call render_partial?\"\n end\n\n\n\n\n\n tags_to_delete = argsx[:tags_to_delete] \n tags_to_unwrap = argsx[:tags_to_unwrap] \n\n @blurb_binding=argsx[:blurb_binding]\n @oauth_uri=argsx[:oauth_uri]\n \n clear\n frame_binding= create_binding(argsx,callback_options)\n template=prep_template(language,frame_binding)\n\n\n apply_view_setup(frame_binding)\n \n result=render_impl(template,language,frame_binding)\n\n\n \n runtime_tags= argsx[:runtime_tags] || @runtime_tags\n \n unless runtime_tags.nil_or_empty? && tags_to_delete.nil_or_empty?\n render_second_pass(result,frame_binding,language,runtime_tags,tags_to_delete,tags_to_unwrap)\n end\n result\n \n end",
"def render(*args); end",
"def render(*args); end",
"def render(type=:all, options={})\n\t\t\tif type == :all\n\t\t\t\t# Rely on the face that << works on both strings and arrays\n\t\t\t\t# and that gen_tags is either set for both (so return array), or none\n\t\t\t\t# (so return string)\n\t\t\t\tjs = render(:js, options)\n\t\t\t\tcss = render(:css, options)\n\t\t\t\t# Since we're rendering all assets, if we're not separating js and css by\n\t\t\t\t# tags, separate them into a hash instead\n\t\t\t\tif options[:gen_tags] == false\n\t\t\t\t\treturn {:js => js, :css => css}\n\t\t\t\telse\n\t\t\t\t\treturn js << css\n\t\t\t\tend\n\t\t\tend\n\n\t\t\toptions = {\n\t\t\t\t\t:gen_tags => true,\n\t\t\t\t\t:inline => false,\n\t\t\t\t\t:request_path => @options[:request_path],\n\t\t\t}.merge(options)\n\n\t\t\tfinalize() unless @finalized\n\t\t\t@finalized = true\n\n\t\t\t# Generate all cache files, if needed, and get an array of generated packs\n\t\t\tpacks = @groups_to_render.inject([]){ |s, group| s.push(*group.generate(type, :inline => options[:inline])) }\n\t\t\tfiles = packs.map{ |pack| pack.render(options) }\n\t\t\t# If returning tags, make them a string from an array\n\t\t\t# Similarly, join inline assets, if they're of the same type\n\t\t\tfiles = files.join(\"\\n\") if options[:gen_tags] || options[:inline]\n\t\t\treturn files\n\t\tend",
"def make_render_in_view exp\n make_render exp, true\n end",
"def render_constraints_filters(localized_params = params)\n return \"\" unless localized_params[:f]\n content = \"\"\n localized_params[:f].each_pair do |facet,values| \n values.each do |val|\n content << render_constraint_element( facet_field_labels[decode_breadcrumb_key_for_name(facet)],\n val,\n :breadcrumb => catalog_index_path + create_breadcrumb_url(facet, val, localized_params),\n :remove => catalog_index_path + remove_facet_params(facet, val, localized_params),\n :classes => [\"filter\"] \n ) + \"\\n\"\n end\n end \n return content \n end",
"def render(view, locals, buffer=nil, &block)\n @template.instance_variable_set(:'@source', wrapped_source)\n\n super(view, locals, buffer, &block)\n end",
"def evaluate(scope, locals, &block)\n if @engine.respond_to?(:precompiled_method_return_value, true)\n super(scope, locals, &block)\n else\n @engine.render(scope, locals, &block)\n end\n end",
"def liquid_for(markup)\n Liquid::Template.file_system = IncludeTemplateFileSystem.new(@design)\n Liquid::Template.register_tag('navigation', NavigationTag)\n Liquid::Template.register_tag('resource_link', ResourceLinkTag)\n Liquid::Template.register_tag('resource_image', ResourceImageTag)\n Liquid::Template.register_tag('search', SearchBlock)\n Liquid::Template.parse(markup)\n end",
"def gantt_filter\n render(:partial => \"tasks/filter\", \n :locals => { \n :redirect_action => \"gantt\",\n :hide_grouping => true,\n :hide_colors => true,\n :hide_icons => true,\n :hide_organize => true,\n :hide_hide_dependencies => true\n })\n end",
"def render_liquid(content, payload, info, path)\n renderer.render_liquid(content, payload, info, path)\n end"
] |
[
"0.6587153",
"0.6435948",
"0.6266756",
"0.6266756",
"0.6231331",
"0.6202872",
"0.6126336",
"0.61160755",
"0.61154157",
"0.6087228",
"0.6087228",
"0.60227185",
"0.6012561",
"0.596274",
"0.595769",
"0.5915394",
"0.5913533",
"0.5877454",
"0.5868317",
"0.586287",
"0.58627385",
"0.5813936",
"0.58131653",
"0.5807732",
"0.5771976",
"0.5751295",
"0.5748711",
"0.5747294",
"0.5746358",
"0.5718053",
"0.5705031",
"0.56514716",
"0.56333125",
"0.56291354",
"0.56283706",
"0.5610113",
"0.55911803",
"0.55896425",
"0.5588712",
"0.55814415",
"0.55792904",
"0.55707777",
"0.55476576",
"0.5547656",
"0.55433774",
"0.55403465",
"0.55396795",
"0.5521809",
"0.55128944",
"0.5512324",
"0.55103165",
"0.54995346",
"0.5498722",
"0.5464174",
"0.54600835",
"0.54447997",
"0.54259837",
"0.5425655",
"0.5420388",
"0.5416957",
"0.5408662",
"0.53771293",
"0.5356519",
"0.53562564",
"0.5356061",
"0.5329228",
"0.53260833",
"0.5320656",
"0.5319993",
"0.5303605",
"0.52895635",
"0.52798575",
"0.5265871",
"0.5260577",
"0.525778",
"0.5253191",
"0.5252281",
"0.524836",
"0.52419406",
"0.52388763",
"0.5234148",
"0.5224353",
"0.5224287",
"0.52237815",
"0.5219109",
"0.5212081",
"0.5200499",
"0.51860803",
"0.51786375",
"0.5171201",
"0.5166291",
"0.5166291",
"0.51587963",
"0.5152625",
"0.5146807",
"0.51390624",
"0.5138232",
"0.51300526",
"0.51277506",
"0.51207155"
] |
0.6030842
|
11
|
Ensures submitted year string is reasonably sane
|
def valid_year?
oldest_year = Time.zone.now.year - 5
latest_year = Time.zone.now.year + 5
return if (oldest_year..latest_year).cover?(graduation_year.to_i)
errors.add(:graduation_year, 'Invalid graduation year')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_year(input, year)\n max_year = Date.today.year + 2\n year <= max_year && year >= 1900\n end",
"def year_via_ruby_parsing\n return unless orig_date_str =~ /\\d\\d/ # need at least 2 digits\n # need more in string than only 2 digits\n return if orig_date_str.match(/^\\d\\d$/) || orig_date_str.match(/^\\D*\\d\\d\\D*$/)\n return if orig_date_str =~ /\\d\\s*B.C./ # skip B.C. dates\n\n date_obj = Date.parse(orig_date_str)\n date_obj.year.to_s\n rescue ArgumentError\n nil # explicitly want nil if date won't parse\n end",
"def century_validate(year)\n century = (year / 100) + 1\n century.to_s + validate_ordinal(year)\nend",
"def year?(v)\n normalize(v).to_s.match?(MATCH_PATTERN[:year])\n end",
"def sortable_year_string_from_date_str\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return sortable_year_str_for_bc if orig_date_str.match(BC_REGEX)\n\n result = sortable_year_for_yyyy_or_yy\n result ||= sortable_year_for_decade # 19xx or 20xx\n result ||= sortable_year_for_century\n result ||= sortable_year_str_for_early_numeric\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).sortable_year_string_from_date_str if no_brackets\n end\n result if self.class.year_str_valid?(result)\n end",
"def valid_year?(y, min, max)\n return false unless y\n return false if y.length != 4\n\n year = y.to_i\n year >= min && year <= max \n end",
"def validate_year_date(field)\n date = nil\n formats = [\"%d/%m/%Y\",\"%d-%m-%Y\",\"%d %m %Y\",\"%m/%d/%Y\",\"%m-%d-%Y\",\"%m %d %Y\"]\n formats.each do |format|\n if(Date.strptime(field, format) rescue false)\n date = Date.strptime(field, format)\n break\n end\n end\n unless date.nil?\n field = date.to_s.scan(/\\d*/) # Return an array with patterns matching with only numbers in it\n if field[0].length == 4\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def could_be_year?(year); end",
"def valid?(v)\n year?(v)\n end",
"def isValidYear?(year)\n\t\tyear =~ /^\\d{4}$/\n\tend",
"def valid_date?(date:)\n date.respond_to?(:year) && date.year.digits.length == 4\n end",
"def validate_year\n raise CarValidationErrors.new(\"Invalid Year\") unless (year >= 1960 && year < Date.today.year)\n end",
"def validate_year(value, valname, min, max)\n\tputs \"Testing for \" + valname.to_s + \": \" + value.to_s\n\tif not ( value and value.match(/\\p{Nd}{4}/).to_s.to_i.between?(min, max) )\n\t\tputs \"Fails \" + valname.to_s\n\t\treturn false\n\tend\n\treturn true\nend",
"def year_int_from_date_str\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return sortable_year_int_for_bc if orig_date_str.match(BC_REGEX)\n\n result = sortable_year_for_yyyy_or_yy\n result ||= sortable_year_for_decade # 19xx or 20xx\n result ||= sortable_year_for_century\n result ||= sortable_year_int_for_early_numeric\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).year_int_from_date_str if no_brackets\n end\n result.to_i if result && self.class.year_int_valid?(result.to_i)\n end",
"def year_only?(date)\n\t\tdate.length == 4 && @@year_rgx.match(date)\n\tend",
"def year(string)\n return if string.blank?\n return string if string.is_a?(Range)\n\n components = string\n .split(\"-\")\n .map(&:to_i)\n .map { |y| y.zero? ? nil : y }\n\n return if components.empty?\n\n # Set end if only one year\n components << components.first if components.count == 1\n\n components[0]..components[1]\n end",
"def year(input) = new_year(input).year - 621",
"def release_not_future_year\n #invalid, if released and release_year is greater than current year\n if release_year && release_year.to_i > Time.now.strftime(\"%Y\").to_i\n errors.add(:release_year, \"cannot be in the future\")\n end\n end",
"def get_year(s)\n begin\n return DateTime.parse(s).year.to_s\n rescue\n if s.match(/^\\d\\d\\d\\d$/)\n return s.to_s\n elsif s.match(/^(\\d\\d\\d\\d)-\\d\\d$/)\n return $1.to_s\n else\n return nil\n end\n end\n end",
"def parse_year(date)\n date.split(\"-\").first.to_i rescue nil\n end",
"def year? = unit == 'year'",
"def check_cur_year\n\t# Check if the current year is after 2009\n\tif 2009 > get_cur_year\n\t\traise \"The current year is not valid!\"\n\tend\nend",
"def appropriate_year?\n if released\n if release_year.nil?\n errors.add(:release_year, \"Release year must exist if it is released\")\n elsif release_year > Time.now.year\n errors.add(:release_year, \"Release year must be less than or equal to the current year\")\n end\n end\n end",
"def sortable_year_for_yyyy\n matches = orig_date_str.match(/\\d{4}/) if orig_date_str\n matches.to_s if matches\n end",
"def year_not_valid?\n if (@year > 1899) && (@year < 2020)\n return false\n end\n return true\n end",
"def valid_advent_year?(year:)\n min_year <= year && year <= max_year\n end",
"def request_year\n\t\tyear = nil\n\t\twhile year != 'exit'\n\t\t\tputs \"What year are you interested in? (input must be in YYYY format):\"\n\t\t\tyear = gets.strip\n\t\t\tif year.to_s.length != 4\n\t\t\t\tputs \"Input invalid. Please try again.\"\n\t\t\t\trequest_year\n\t\t\tend\t\n\t\t\treturn year\n\t\tend\n\tend",
"def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end",
"def normalized\n expanded = length == 2 ? \"20#{self}\".to_i : self.to_i # Assume no 3-digit years\n expanded >= Time.now.year ? expanded : Time.now.year\n end",
"def sortable_year_for_yy\n return unless orig_date_str\n\n slash_matches = orig_date_str.match(/\\d{1,2}\\/\\d{1,2}\\/\\d{2}/)\n if slash_matches\n date_obj = Date.strptime(orig_date_str, '%m/%d/%y')\n else\n hyphen_matches = orig_date_str.match(/\\d{1,2}-\\d{1,2}-\\d{2}/)\n date_obj = Date.strptime(orig_date_str, '%m-%d-%y') if hyphen_matches\n end\n if date_obj && date_obj > Date.today\n date_obj = Date.new(date_obj.year - 100, date_obj.month, date_obj.mday)\n end\n date_obj.year.to_s if date_obj\n rescue ArgumentError\n nil # explicitly want nil if date won't parse\n end",
"def sortable_year_for_yyyy_or_yy\n # most date strings have a four digit year\n result = sortable_year_for_yyyy\n result ||= sortable_year_for_yy # 19xx or 20xx\n result\n end",
"def year(string)\n year_matches = /(?!^\"[^\"]+\")\\(([\\d]+)\\)/.match(string)\n year_matches ? year_matches[1].to_s : nil\n end",
"def year=(value)\n value = 0 if value.nil?\n\n if value.is_a?(String) \n if value.length == 0\n value = 0\n elsif value =~ /\\A\\-?\\d{1,7}\\z/\n value = value.to_i\n else\n raise YearError, \"Year must be a valid string or integer from -1048576 to 1048576\"\n end\n end\n\n if (value >= -1048576 && value <= 1048576) \n @bits = self.class.set_year(@bits, value)\n else\n raise YearError, \"Year must be an integer from -1048576 to 1048576\"\n end\n end",
"def rebuild_year=(num)\n unless num.blank?\n self[:rebuild_year] = sanitize_to_int(num)\n end\n end",
"def get_year\n @year ||= params[:year] ? params[:year].to_i : Time.now.year\n end",
"def year() end",
"def get_year\n valid_yr = false\n while !valid_yr\n print \"Please enter the year you would like statistics for: \"\n user_year = gets.chomp\n yr_reg_ex = Regexp.new /^[1-9]\\d\\d\\d$/\n if user_year =~ yr_reg_ex\n valid_yr = true\n else\n puts \"Sorry, that doesn't look like a valid year.\"\n end\n end\n return user_year.to_i\nend",
"def pub_year\n # use the cached year if there is one\n if @pub_year\n return nil if @pub_year == ''\n\n return @pub_year\n end\n\n dates = pub_dates.map do |f_date|\n # remove ? and []\n if f_date.length == 4 && f_date.end_with?('?')\n f_date.tr('?', '0')\n else\n f_date.delete('?[]')\n end\n end\n\n if dates\n # try to find a date starting with the most normal date formats and progressing to more wonky ones\n @pub_year = get_plain_four_digit_year(dates) ||\n get_u_year(dates) || # Check for years in u notation, e.g., 198u\n get_double_digit_century(dates) ||\n get_bc_year(dates) ||\n get_three_digit_year(dates) ||\n get_single_digit_century(dates)\n return @pub_year if @pub_year\n end\n @pub_year = ''\n nil\n end",
"def convert_yy_2_yyyy( birth_year )\n return nil if birth_year.nil?\n # Already a 4-digit year?\n if birth_year.to_i > 1900\n birth_year\n\n # 2-digit year?\n elsif birth_year.to_i < 100\n # We keep track upto M105:\n if DateTime.now.year - 1900 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1900 + birth_year.to_i\n end\n\n # 3-digit year?\n elsif birth_year.to_i < 1000\n # We keep track upto M105:\n if DateTime.now.year - 1000 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1000 + birth_year.to_i\n end\n end\n end",
"def match_year?(doc, date)\n return true unless year\n\n idate = RelatonBib.parse_date doc[\"issued-date\"], false\n idate.between? date, date.next_year.prev_day\n end",
"def year_name(number); end",
"def get_year(excel, workbook, worksheet, calsheet)\n\n\tyear = worksheet.Range('q1').value.to_i\n\t\n\tif ((year == 0)||(year.to_s.size > 4)||(year.to_s.size < 4)) # check for valid year\n\t\tworkbook.Close(0)\n\t\texcel.Quit\n\t\texcel = nil # destroy Excel object\n\t\tputs \"\\nERROR: Year field for worksheet #{calsheet} may be empty or formatted incorrectly.\"\n\t\tputs \"\\tPlease check the value and try again.\\n\"\n\t\texit\t\t\n\telse\n\t\tyear\n\tend\nend",
"def sortable_year_str_for_early_numeric\n return unless orig_date_str.match(EARLY_NUMERIC)\n\n if orig_date_str =~ /^\\-/\n # negative number becomes x - 1000 for sorting; -005 for -995\n num = orig_date_str[1..-1].to_i - 1000\n return '-' + num.to_s[1..-1].rjust(3, '0')\n else\n return orig_date_str.rjust(4, '0')\n end\n end",
"def yn(year)\n return year if year.size == 4\n\n y = Date.today.year.to_s[2..4].to_i + 1\n case year.to_i\n when 0...y then \"20#{year}\"\n when y..99 then \"19#{year}\"\n end\n end",
"def datetime_year\n case datetime\n when String\n Date.parse(datetime).year\n when Time\n datetime.year\n end\n end",
"def silly_years(year)\n years = []\n until years.length == 10\n year_str = year.to_s\n if (year_str[0..1].to_i + year_str[2..3].to_i == year_str[1..2].to_i)\n years << year\n end\n year += 1\n end\n\n years\nend",
"def expected_death_year\n Chronic.parse(\"#{years_to_live} years from now\").year.to_s\n end",
"def sortable_year_int_for_early_numeric\n return orig_date_str.to_i if orig_date_str.match(EARLY_NUMERIC)\n\n orig_date_str.to_i if orig_date_str =~ /^-\\d{4}$/\n end",
"def author_year\n au = author_year_string\n return nil if au.nil?\n (self.parens == true) ? \"(#{au})\" : au\n end",
"def year\n result = title.split('-')[0]\n result ? result.to_i : nil\n end",
"def year_rome_founded\n bce(753)\n end",
"def year\n result = self.title.split('-')[0]\n result ? result.to_i : nil\n end",
"def set_year\n @year = params[:year].blank? ? @today.year : params[:year].to_i\n end",
"def timestamp_for_year\n if timestamp > Time.zone.now.at_beginning_of_year\n self.errors.add(:timestamp, 'should be not earlier then the beginning of this year.')\n end\n end",
"def legacy_request?\n AedLegacy.legacy_year?(params[:year])\n end",
"def has_year? \n @path_parts[0] =~ /[0-9]{4}/\n end",
"def get_plain_four_digit_year(dates)\n dates.each do |f_date|\n matches = f_date.scan(/\\d{4}/)\n if matches.length == 1\n @pub_year = matches.first\n else\n # when there are multiple matches, check for ones with CE after them\n matches.each do |match|\n # look for things like '1865-6 CE'\n pos = f_date.index(Regexp.new(match + '...CE'))\n pos = pos ? pos.to_i : 0\n if f_date.include?(match + ' CE') || pos > 0\n @pub_year = match\n return match\n end\n end\n end\n return matches.first\n end\n nil\n end",
"def expected_death_year\n Chronic.parse(\"#{@years_to_live} years from\nnow\").year\n end",
"def parse_year(time)\n year = time.strftime(\"%Y\").to_i\n sounds_for_number(year / 100) + sounds_for_number(year % 100)\n end",
"def year; end",
"def year; end",
"def year=(value)\n RegexValidator.validate \"DateGroupItem.year\", /\\d{4}/, value\n @year = value\n end",
"def year\n @year ||= details.at(\"h1[itemprop='name'] span#titleYear a\").text.parse_year rescue nil\n end",
"def sortable_year_for_century\n return unless orig_date_str\n return if orig_date_str =~ /B\\.C\\./\n\n century_matches = orig_date_str.match(CENTURY_4CHAR_REGEXP)\n if century_matches\n return $1 + '00' if $1.length == 2\n return '0' + $1 + '00' if $1.length == 1\n end\n century_str_matches = orig_date_str.match(CENTURY_WORD_REGEXP)\n if century_str_matches\n yy = ($1.to_i - 1).to_s\n return yy + '00' if yy.length == 2\n return '0' + yy + '00' if yy.length == 1\n end\n end",
"def sortable_year_int_for_bc\n bc_matches = orig_date_str.match(BC_REGEX) if orig_date_str\n \"-#{$1}\".to_i if bc_matches\n end",
"def format_year(year)\n \"#{year}-#{year+1}\"\n end",
"def translate_year(year_string)\n\tif CONFIG[\"years\"][year_string].nil?\n\t\treturn nil\n\telse\n\t\treturn CONFIG[\"years\"][year_string]\n\tend\nend",
"def sortable_year_str_for_bc\n bc_matches = orig_date_str.match(BC_REGEX) if orig_date_str\n ($1.to_i - 1000).to_s if bc_matches\n end",
"def test_license_date_is_updated\n license_year = IO.read('LICENSE').match(\n /Copyright \\(C\\) (\\d{4}), Twilio SendGrid/\n )[1]\n current_year = Time.new.year\n\n assert_equal(current_year, license_year.to_i)\n end",
"def year(date)\n y = date.year.abs.to_s\n return [y, BCE_SUFFIX].join(' ') if (date.year <= -1)\n y\n end",
"def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n start_year.to_s\n else\n start_year.to_s + '-' + end_year.to_s\n end\n end",
"def year\n 2020\n end",
"def min_year\n 2015\n end",
"def author_year_string\n au = [author_string, self.year].compact.join(\", \")\n return nil if au.size == 0\n au\n end",
"def make_year(year, bias); end",
"def silly_years(year)\n years = []\n\n until years.length == 10\n year += 1\n digits = year.to_s\n\n first_two, middle_two, last_two = [\n digits[0..1], digits[1..2], digits[2..-1]\n ].map { |pair| pair.to_i }\n\n years << year if (first_two + last_two) == middle_two\n\n end\n\n years\nend",
"def year\n current_year = Date.today.year\n\n case raw_year\n when current_year; \"this year\"\n when current_year.next; \"next year\"\n when current_year.pred; \"last year\"\n else; raw_year.to_s\n end\n end",
"def copyright_notice_year_range(start_year)\n\t\t# In case the input was not a number (nil.to_i will return a 0)\n\t\tstart_year = start_year.to_i\n\n\t\t# Get the current year from the system\n\t\tcurrent_year = Time.new.year\n\n\t\t# When the current year is more recent than the start year, return a string \n\t\t# of a range (e.g., 2010 - 2012). Alternatively, as long as the start year \n\t\t# is reasonable, return it as a string. Otherwise, return the current year \n\t\t# from the system.\n\t\tif current_year > start_year && start_year > 2000\n\t\t\t\"#{start_year} - #{current_year}\"\n\t\telsif start_year > 2000\n\t\t\t\"#{start_year}\"\n\t\telse\n\t\t\t\"#{current_year}\"\n\t\tend\n\tend",
"def extract_year(date)\n if date.blank?\n []\n elsif date == \"undated\"\n []\n elsif /^\\d{4}$/ =~ date\n # Date.iso8601 doesn't support YYYY dates\n [date.to_i]\n elsif /^\\d{4}-\\d{4}$/ =~ date\n # date range in YYYY-YYYY format\n earliest, latest = date.split('-').flat_map{ |y| y.to_i }\n (earliest..latest).to_a\n else\n [Date.iso8601(date).year]\n end\n rescue ArgumentError\n raise \"Invalid date: #{date.inspect}\"\n end",
"def match_year\n @year ? { 'fiscal_quarter_id' => /^#{@year}/i } : {}\n end",
"def new_year(date) = ::Date.new(Integer === date ? date : date(date).year, 1, 1, reform_jd).new_start(::Date::GREGORIAN)",
"def century(year)\n century = year / 100\n if year % 100 > 0\n century += 1\n end\n century = century.to_s\n if (century[-1] == \"1\") && (century[-2] != \"1\")\n century += 'st'\n elsif (century[-1] == \"2\") && (century[-2] != \"1\")\n century += 'nd'\n elsif (century[-1] == \"3\") && (century[-2] != \"1\")\n century += 'rd'\n else\n century += 'th'\n end\nend",
"def year=(value)\n @year = value\n end",
"def silly_years(year)\n silly_years = []\n year = year + 1\n\n while silly_years.length != 10\n year_str = year.to_s\n if year_str[0..1].to_i + year_str[2..3].to_i == year_str[1..2].to_i\n silly_years.push(year)\n end\n year += 1\n end\n\n return silly_years\nend",
"def year_convert(v)\n case v\n when nil, 0 then nil\n when Numeric then v.to_i.to_s\n when IsoYear then v.to_s\n when IsoDay then year_convert(v.to_s)\n when IsoDate then year_convert(v.to_s)\n when START_PATTERN[:complete] then $2\n when START_PATTERN[:day] then $2\n when START_PATTERN[:year] then $1\n else year_convert(date_parse(v))\n end\n end",
"def recovered?(date_string)\n date_string.strip[6..9].to_i > 1900\n rescue => e\n puts \"error with: #{date_string}\"\n raise e\n end",
"def date_range_from_string(date_str)\n if date_str == nil || date_str.length < 4\n return nil\n end\n\n if date_str.length == 4\n # single year\n return date_str\n end\n\n # multiple year, take the first two\n years = date_str.split(\"/\")\n if years.count < 2\n return years[0]\n end\n return years[0] + \"/\" + years[1]\n end",
"def year?\n @year\n end",
"def w_year; end",
"def year_only(dates)\n dates.length == 2 && dates.first.end_with?(\"-01-01T00:00:00Z\") && dates.last.end_with?(\"-12-31T23:59:59Z\")\n end",
"def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n \"\\#{start_year}\"\n else\n \"\\#{start_year}–\\#{end_year}\"\n end\n end",
"def date_str_for_display\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return display_str_for_bc if orig_date_str.match(BC_REGEX)\n # decade next in case there are 4 digits, e.g. 1950s\n return display_str_for_decade if orig_date_str.match(DECADE_4CHAR_REGEXP) || orig_date_str.match(DECADE_S_REGEXP)\n\n result = sortable_year_for_yyyy_or_yy\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).date_str_for_display if no_brackets\n end\n # parsing below this line gives string inapprop for year_str_valid?\n unless self.class.year_str_valid?(result)\n result = display_str_for_century\n result ||= display_str_for_early_numeric\n end\n # remove leading 0s from early dates\n result = \"#{result.to_i} A.D.\" if result && result.match(/^0\\d+$/)\n result\n end",
"def effective_copyright_year(out_file)\n copyright_mask = /# Copyright (?<year>[0-9-]*) Google Inc./\n if File.exist?(out_file)\n first_line = File.read(out_file).split(\"\\n\")\n .select { |l| copyright_mask.match(l) }\n .first\n matcher = copyright_mask.match(first_line)\n return matcher[:year] unless matcher.nil?\n end\n Time.now.year\n end",
"def yearCode year\r\n if year =~ /freshman/\r\n 1\r\n elsif year =~ /sophomore/\r\n 2\r\n elsif year =~ /junior/\r\n 3\r\n elsif year =~ /senior/\r\n 4\r\n else \r\n 0\r\n end\r\nend",
"def yearCode(year)\r\n\tif year =~ /freshman/\r\n\t\treturn 1\r\n\telsif year =~ /sophomore/\r\n\t\treturn 2\r\n\telsif year =~ /junior/\r\n\t\treturn 3\r\n\telsif year =~ /senior/\r\n\t\treturn 4\r\n\telse\r\n\t\treturn 0\r\n\tend\r\nend",
"def year?(v = nil)\n super(v || value)\n end",
"def is_leap_year?(year)\n if year % 400 == 0 #check for full century leap yr\n true\n elsif year % 100 == 0 # exception to the 400 rule\n false\n elsif year % 4 == 0 # its a leap year\n true\n else\n false # else its not.\n end\nend",
"def sortable_year_for_decade\n decade_matches = orig_date_str.match(DECADE_4CHAR_REGEXP) if orig_date_str\n changed_to_zero = decade_matches.to_s.tr('u\\-?x', '0') if decade_matches\n DateParsing.new(changed_to_zero).sortable_year_for_yyyy if changed_to_zero\n end",
"def normalize(v)\n v = strip_copyright(v) if v.is_a?(String)\n year_convert(v)\n end",
"def work_out_year(value)\n case value\n when 0..39\n 2000 + value\n when 40..99\n 1900 + value\n when nil\n Time.zone.now.year\n else\n # We may be passed something that's not a straight out integer\n # These things include: BigDecimals, Floats and Strings.\n value.to_i\n end\n end"
] |
[
"0.7775211",
"0.74850935",
"0.7367469",
"0.7285616",
"0.72610676",
"0.7204691",
"0.7170564",
"0.711654",
"0.7113549",
"0.7100703",
"0.7014206",
"0.6982753",
"0.6952954",
"0.69509053",
"0.6944325",
"0.69417006",
"0.6921422",
"0.69123244",
"0.68944335",
"0.686884",
"0.68502474",
"0.6832123",
"0.6794555",
"0.6780696",
"0.6715717",
"0.668152",
"0.6629352",
"0.6608977",
"0.65993416",
"0.65824175",
"0.65812665",
"0.65718335",
"0.65678084",
"0.65018207",
"0.64942026",
"0.6492715",
"0.6457978",
"0.6446906",
"0.6419752",
"0.6410195",
"0.64089555",
"0.6392746",
"0.639182",
"0.638421",
"0.63656706",
"0.6350451",
"0.63435113",
"0.633978",
"0.63328815",
"0.63319427",
"0.6319255",
"0.62789977",
"0.6278031",
"0.6275365",
"0.62542224",
"0.6250913",
"0.62228775",
"0.6187756",
"0.6178174",
"0.6157686",
"0.6157686",
"0.6148591",
"0.61414564",
"0.61412066",
"0.6136511",
"0.6133056",
"0.613018",
"0.6128905",
"0.61114264",
"0.61062855",
"0.60939527",
"0.6093736",
"0.60766745",
"0.6074709",
"0.60449064",
"0.60417986",
"0.60355836",
"0.60169256",
"0.60007536",
"0.5990085",
"0.59899145",
"0.598586",
"0.59858155",
"0.5983842",
"0.5981712",
"0.59661365",
"0.5963322",
"0.59610534",
"0.59597963",
"0.5958379",
"0.59396505",
"0.5926042",
"0.5925179",
"0.59235775",
"0.59209704",
"0.59192103",
"0.5918648",
"0.59167933",
"0.5909016",
"0.5904009"
] |
0.66610974
|
26
|
Combine the UI supplied month and year into a datetime object
|
def combine_graduation_date
self.grad_date = Time.zone.local(graduation_year.to_i,
Date::MONTHNAMES.index(graduation_month))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_date_from_year_month(data)\n dt = data['year']\n if data['month']\n dt += '-' + data['month'] + '-1'\n end\n dt\n end",
"def publish_month_and_year\n [publish_on.month, publish_on.year]\n end",
"def month_of_year(*months)\n merge(month: months)\n end",
"def month=(_arg0); end",
"def year\n @year = params[:year].to_i\n @first_month = 1\n @last_month = (Date.today.year == @year) ? Date.today.month : 12\n end",
"def year_month_int_to_year_and_month(year_month)\n [year_month / 12, (year_month % 12) + 1]\n end",
"def month_of_year(months, *extras)\n merge(month: months.array_concat(extras))\n end",
"def month() end",
"def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end",
"def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end",
"def set_year\n if set_month > 2 and set_month < 13\n @year.to_i\n else\n @year.to_i - 1\n end\n end",
"def format_month_year(date)\n date.strftime(\"%Y-%b\")\n end",
"def archive\n @date = Date.parse(\"#{params[:year]}-#{params[:month]}-01\").strftime('%B, %Y')\n end",
"def increment_month!\n if month != 12\n # just bump up a number\n self.date = ZDate.format_date(year_str, month + 1)\n else\n self.date = ZDate.format_date(year + 1)\n end\n end",
"def date\n Date.civil(year, month, 1)\n end",
"def input_date_month_year(name, date = Time.zone.today)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n name_dd: \"#{id}_dd\",\n name_mm: \"#{id}_mm\",\n name_yy: \"#{id}_yy\",\n description: prop(field, 'description'),\n label: prop(field, 'label'),\n date: date,\n }\n end",
"def set_year(m)\n if set_month(m) > 2 and set_month(m) < 13\n @year.to_i\n else\n @year.to_i - 1\n end\n end",
"def beginning_of_month\n self.class.new year, month, 1\n end",
"def select_year_and_month(year, month, options={})\n year_field = find_field(options[:from])\n month_field = find(:id, year_field[:id].sub(/_1i$/, \"_2i\"))\n\n year_field.select(year)\n month_field.select(month)\n end",
"def time_month; Time.now.month; end",
"def month; end",
"def month; end",
"def month\n start_date&.strftime('%b %Y')\n end",
"def get_year_month_list()\n arr=[]\n start=\"2008_01\"\n str=\"\"\n var_date = Time.now\n while( start != str)\n str = var_date.year.to_s + \"_\" + \"%02d\" % var_date.month.to_s\n arr << str\n var_date = var_date - 1.month\n end\n return arr\n end",
"def to_year\n month_obj = []\n month_obj << \"#{month_name}\".center(DEFAULT_MONTH_WIDTH)\n month_obj << \"Su Mo Tu We Th Fr Sa\"\n month_obj.concat(format_body)\n end",
"def get_date_month_year\n\t\tif @date_time != nil and @date_time.to_s.strip != \"\"\n\t\t\tdate_time_arr = @date_time.to_s.split\n\t\t\tday_month_year = (date_time_arr[date_time_arr.size - 3] + date_time_arr[date_time_arr.size - 2] + date_time_arr[date_time_arr.size-1]).strip\n\t\t\treturn day_month_year\n\t\telse\n\t\t\treturn \"UNKNOWN\"\n\t\tend\n\tend",
"def to_month(**options) = convert_to('month', **options)",
"def years_to_month(years)\n years * 12.0\nend",
"def month_depot\n \"#{depot.name} \"+\"#{issue_date.strftime(\"%b\")} \"+\"#{issue_date.year}\"\n end",
"def a_year()\n now = Time.now\n if now.month < 4\n now.year - 1\n else\n now.year\n end\nend",
"def year_month_int_to_str(year_month)\n \"#{year_month / 12} #{MONTHS[year_month % 12]}\"\n end",
"def select_month_year(field, options)\n date = Date.parse(options[:with])\n base_dom_id = get_base_dom_id_from_label_tag(field)\n\n find(:xpath, \".//select[@id='#{base_dom_id}_1i']\").select(date.year.to_s)\n find(:xpath, \".//select[@id='#{base_dom_id}_2i']\").select(I18n.l date, :format => '%B')\nend",
"def year_month(date, fmt=\"yyyy mmm\")\n return nil unless date\n yyyy = date.year.to_s\n mmm = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[date.month-1]\n case fmt\n when \"mmm-yy\" then \"%s-%s\" % [mmm, yyyy[2, 2]]\n when \"mmm yyyy\" then \"%s %s\" % [mmm, yyyy]\n else \"%s %s\" % [yyyy, mmm]\n end\n end",
"def get_month(year, month)\n entries = month_entries(@pages, year, month) \n\n budget_month = BudgetMonth.new(entries, year, month)\n\n budget_month\n end",
"def test_yearly_by_month_loop\n parse(\n 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA',\n '2012-01-01 15:45:00',\n [\n '2012-02-01 15:45:00'\n ],\n '2012-01-29 23:00:00'\n )\n end",
"def monthstamp(year, month)\n \"#{year}#{month.to_s.rjust(2, \"0\")}\".to_i\nend",
"def month_str\n ret = Datet.months(:trans => true)[@t_month]\n if args and args[:short]\n ret = ret.slice(0, 3)\n end\n \n return ret\n end",
"def datetime_year\n case datetime\n when String\n Date.parse(datetime).year\n when Time\n datetime.year\n end\n end",
"def month\n Thread.current[:datet_mode] = :months\n return @t_month\n end",
"def raw_year\n start_on.year\n end",
"def default_year\n Time.now.month <= 5 ? Time.now.year : Time.now.year + 1 \n end",
"def year_and_month_to_int(year, month)\n (year * 12) + (month - 1)\n end",
"def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end",
"def datetime_select_jp(form, method, options ={})\n options[:use_month_numbers].nil? and options[:use_month_numbers] = true\n options[:end_year] ||= (form.object.send(method) || @show_time).year + 10 \n form.datetime_select(method, options)\n end",
"def fmt_date(date)\n if (date == :now)\n return Date.today\n end\n if (date.is_a? Integer)\n date = {:year => date, :month => 1}\n end\n Date.parse(date[:year].to_s+\"-\"+date[:month].to_s+\"-01\")\n end",
"def parse_date\n\t\tnow = Time.now\n\t\tt = ARGV.shift\n\t\tmonat = now.month\n\t\tmonat = t.to_i unless t.nil?\n\n\t\tt = ARGV.shift\n\t\tjahr = now.year\n\t\tjahr = t.to_i unless t.nil?\n\t\t\t\n\t\treturn jahr, monat\nend",
"def end_of_month\n self.class.new year, month + 1, 0\n end",
"def form_date\n \"#{date.month}/#{date.day}/#{date.year - 2000}\"\n end",
"def month\n @year = params[:year].to_i\n @month = params[:month].to_i\n @first_day = @event.first_day_of_month(@year, @month)\n @last_day_of_month = Date.new(@year, @month, 1).end_of_month\n end",
"def parse_date_parameters\n if params[:year] && params[:month]\n date = Date.civil(params[:year].to_i, params[:month].to_i) rescue nil\n if date\n @year = date.year\n @month = date.month\n end\n elsif params[:year]\n date = Date.civil(params[:year].to_i) rescue nil\n @year = date.year if date\n end\n end",
"def date_parse raw_day, raw_month\n str_month = raw_month.scan(@regex_monthes)[0]\n month = @monthes[str_month]\n return if not month\n day = raw_day.to_i\n return if day==0\n today = Date.today\n if day < today.day and month == 12\n year = today.year + 1\n else\n year = today.year\n end\n #puts year, year.class, month, month.class, day, day.class\n return \"#{year}-#{\"%02d\"%month}-#{\"%02d\"%day}\"\nend",
"def month\n start_on.strftime(MONTH_NAME)\n end",
"def month\n set_function_and_argument(:month, nil)\n end",
"def month_range( year, start_month, end_month )\n\t return Time.local( year, start_month ).at_beginning_of_month, Time.local(year,end_month).at_end_of_month\n\tend",
"def month_result_string(day)\n start = day.beginning_of_month.yday - 1\n finish = day.end_of_month.yday - 1\n result_string(day.year).slice(start..finish)\n end",
"def build_header_year\n \"#{begin_date.year}/#{end_date.year}\"\n end",
"def months_in_year\n 12\nend",
"def future(year, month, day)\n years = (10 ** 9) / 60 / 60 / 24 / 365\n days = (10 ** 9) / 60 / 60 / 24 % 365\n\n year = year + years\n \n\nend",
"def year\n #Para que salga con el formato de ARG\n fecha = Date.parse(self.created_at.to_s)\n fecha.strftime('%Y')\n end",
"def month\n end",
"def month=(value)\n @month = value\n end",
"def calculate_month_and_next_month(year, month)\n check_date = Time.new(year, month)\n {:actual => check_date, :next => check_date.next_month}\n end",
"def display_month_with_year\n puts (name_of_month + \" #{@year}\").center(20) +\" \"\n puts weeks_with_year\n end",
"def year() end",
"def start_date\n\t\tDate.new( @year, @month, 1 )\n\tend",
"def year_month_ranges year\n\t\t\tfrom = Date.new(year, Time.now.month, Time.now.beginning_of_month.day) - 1.year\n\t\t\tto = Date.new(year, Time.now.month, Time.now.end_of_month.day)\n\t\t\t(from..to).group_by(&:month).map { |n,v| v.first.beginning_of_month.to_s..(v.first.end_of_month + 1.day).midnight.to_s }\n\t\tend",
"def get_year\n @year ||= params[:year] ? params[:year].to_i : Time.now.year\n end",
"def year(input) = new_year(input).year - 621",
"def to_i\n year * 100 + month\n end",
"def start_of_month\n Date.new(self.strftime('%Y').to_i, self.strftime('%m').to_i, 1)\n end",
"def month\n return @month\n end",
"def month_and_years\n sorted_pages = get_published_pages.sort_by {|page| page.publish_on}.reverse\n sorted_pages.map {|page| page.publish_month_and_year}.uniq\n end",
"def new_year(date) = ::Date.new(Integer === date ? date : date(date).year, 1, 1, reform_jd).new_start(::Date::GREGORIAN)",
"def get_start_date\n date = Time.new\n year = date.year\n month = date.month < 10 ? \"0\" + date.month.to_s : date.month\n day = date.day < 10 ? \"0\" + date.day.to_s : date.day\n start_date = \"#{year-2}-#{month}-#{day}\"\n start_date\nend",
"def month\n self.founded.strftime(\"%B\")\n end",
"def linkedin_date(month)\n \tcase month\n \t\twhen 1\n \t\t\tmonth = \"January\"\n \t\twhen 2\n \t\t\tmonth = \"February\"\n \t\twhen 3\n \t\t\tmonth = \"March\"\n \t\twhen 4\n \t\t\tmonth = \"April\"\n \t\twhen 5\n \t\t\tmonth = \"May\"\n \t\twhen 6\n \t\t\tmonth = \"June\"\n \t\twhen 7\n \t\t\tmonth = \"July\"\n \t\twhen 8\n \t\t\tmonth = \"August\"\n \t\twhen 9\n \t\t\tmonth = \"September\"\n \t\twhen 10\n \t\t\tmonth = \"October\"\n \t\twhen 11\n \t\t\tmonth = \"November\"\n \t\twhen 12\n \t\t\tmonth = \"December\"\n \t\telse\n \t\t\tmonth = \"\"\n \tend\n \treturn month\n end",
"def build_time\n time = Time.now\n \"#{time.month}-#{time.day}-#{time.year}\"\n end",
"def months\n Thread.current[:datet_mode] = :months\n return self\n end",
"def to_s; \"%d-%02d\" % [@years, @months.abs] end",
"def years_to_months(years)\n #some code here\nend",
"def change_to_beginning_of_month\n @month.to_date.beginning_of_month\n end",
"def get_date(value)\n date = Time.now\n if value.include? 'YEAR_MONTH'\n date = date.localtime(\"+05:30\").strftime('%Y-%m')\n value.slice! 'YEAR_MONTH'\n value = value + date\n elsif value.include? 'TODAYS_DATE'\n date = Time.now\n date = date.localtime(\"+05:30\").strftime('%-m/%-d/%Y')\n value.slice! 'TODAYS_DATE'\n value = value + date\n end\n value\nend",
"def year\n date&.strftime('%Y')\n end",
"def beginning_month=(string)\n frm.select(:id=>\"release_month\").select(string)\n end",
"def format_date(year, month = 1, day = 1)\n format_year(year) + format_month(month) + format_day(day)\n end",
"def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend",
"def partial_date_string(year, month, day)\n if !day.nil?\n \"on #{Date::MONTHNAMES[month]}, #{day} of #{year}\"\n elsif !month.nil?\n \"in #{Date::MONTHNAMES[month]} of #{year}\"\n else\n \"in #{year}\"\n end\n end",
"def year=(value)\n set_date(value, @month, @day)\n end",
"def get_month(month)\n month = month.to_s\n month.length == 2 ? month : \"0#{month}\"\n end",
"def getDate(day, month, year)\n day << @day\n month << @month\n year << @year\n end",
"def set_year\n @year = params[:year].blank? ? @today.year : params[:year].to_i\n end",
"def of(*args)\n if args.first.is_a?(Range)\n @month = format_range(args.first)\n else\n list = args.map {|month| month_value(month) unless month.is_a?(Fixnum) }\n @month = list.join(',')\n end\n self\n end",
"def of(*args)\n if args.first.is_a?(Range)\n @month = format_range(args.first)\n else\n list = args.map {|month| month_value(month) unless month.is_a?(Fixnum) }\n @month = list.join(',')\n end\n self\n end",
"def year\n 2020\n end",
"def add_years(year, month, day , offest )\n\n\t### From Hijri to Julian to Gregorian date \n\n\tgd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i))\n\n\t### Add months to Gregorian date \n\n\tparsed_date = Date.new( gd[0] , gd[1] , gd[2]) \n\n\tgd_after_add = parsed_date.years_since(offest)\n\n\tgd_after_add = gd_after_add.to_s(:db)\n\n\t### From Gregorian to Julian to Hijri date \t\n\n\thd_after_add = fromjdtoislamic(gtojd(gd_after_add[0,4].to_i,gd_after_add[5,2].to_i,gd_after_add[8,2].to_i))\n\n\t## Return Hijri date \n\n\t#return year.to_s + '-' + month.to_s + '-' + day.to_s + ' بعد اضافة ' + offest.to_s + ' شهر ' + hd_after_add.to_s\n\n\treturn hd_after_add\n\nend",
"def beginning_of_month\n ZDate.new(ZDate.format_date(year_str, month_str))\n end",
"def by_month(value = Time.now.month, options = {})\n year = options[:year] || Time.now.year\n \n # Work out what actual month is.\n month = if value.class == Fixnum && value >= 1 && value <= 12\n value\n elsif value.class == Time || value.class == Date\n year = value.year\n value.month\n elsif value.class == String && Date::MONTHNAMES.include?(value)\n Date::MONTHNAMES.index(value)\n else\n raise ParseError, \"Value is not an integer (between 1 and 12), time object or string (make sure you typed the name right).\"\n end\n \n start_time = Time.utc(year, month, 1)\n end_time = start_time.end_of_month\n\n by_star(start_time, end_time, options)\n end",
"def get_year_with_number\n date_receipt.strftime(\"%Y\") + \"-\" + sprintf( \"%03i\", receipt_num )\n end",
"def rsmonth(month)\n case month\n when 1\n return 'januar'\n when 2\n return 'februar'\n when 3\n return 'mart'\n when 4\n return 'april'\n when 5\n return 'maj'\n when 6\n return 'jun'\n when 7\n return 'jul'\n when 8\n return 'avgust'\n when 9\n return 'septembar'\n when 10\n return 'oktobar'\n when 11\n return 'novembar'\n when 12\n return 'decembar'\n end\nend",
"def moment_date( time )\n\t\ttime = time .to_time\n\t\t\"#{ time .year }.#{ time .month }.#{ time .day }\"\n\tend",
"def year\n created.strftime '%Y'\n end"
] |
[
"0.7293942",
"0.659538",
"0.6460824",
"0.6379645",
"0.63769686",
"0.6356399",
"0.63150215",
"0.6196625",
"0.6192206",
"0.6192206",
"0.6167933",
"0.61219156",
"0.6070553",
"0.6022769",
"0.6014927",
"0.59764045",
"0.5960195",
"0.5943031",
"0.59141576",
"0.58931035",
"0.5892424",
"0.5892424",
"0.58761925",
"0.5868766",
"0.58569425",
"0.5850049",
"0.5830872",
"0.5822845",
"0.5801622",
"0.57819486",
"0.57750785",
"0.5766716",
"0.5760813",
"0.57410914",
"0.5740541",
"0.57342637",
"0.5725432",
"0.57232136",
"0.57200587",
"0.57102907",
"0.5688853",
"0.5676484",
"0.56702656",
"0.566324",
"0.5647693",
"0.56459993",
"0.5642865",
"0.5628229",
"0.5618288",
"0.56177986",
"0.5611802",
"0.56087714",
"0.5607364",
"0.56051713",
"0.5589333",
"0.55834574",
"0.55679786",
"0.5562334",
"0.5557704",
"0.5551965",
"0.55294484",
"0.55246246",
"0.5524384",
"0.5517105",
"0.5513834",
"0.5510943",
"0.55007267",
"0.5497042",
"0.54960644",
"0.5493364",
"0.5492503",
"0.5446792",
"0.543522",
"0.5432986",
"0.542985",
"0.5418769",
"0.53988624",
"0.53882664",
"0.53845364",
"0.5380879",
"0.53766596",
"0.5375281",
"0.53727615",
"0.5363982",
"0.5361611",
"0.53602254",
"0.5358876",
"0.53577435",
"0.53363603",
"0.53355396",
"0.53330487",
"0.53293175",
"0.53293175",
"0.5317916",
"0.53149205",
"0.53096473",
"0.5308404",
"0.53025925",
"0.53013575",
"0.5300349",
"0.5300001"
] |
0.0
|
-1
|
THIS IS A TOTAL HACK. Trying to scope where to look on the page. This will make the original step, without the "within subheading" part
|
def reconstitute_step(step_text, table)
@keep_hold_of_raw_table = table
step_text+":"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cur_heading\n $HEADINGS[0]\nend",
"def places_of_interest\n capture_haml do\n haml_tag :div, class: 'poi' do\n expander\n bar\n end\n end\n end",
"def build_heading level\n heading = super\n\n @section = heading.text\n\n heading\n end",
"def step_header\n render partial: 'layouts/step_header', locals: {\n path: controller.previous_step_path\n }\n end",
"def visit_step(step)\n tc_before_step(step)\n super\n tc_after_step(step)\n end",
"def pos_partial_page_header\n pos_fil_header + 4\n end",
"def skip_main_heading?\n true\n end",
"def test_headlines_nested\n\n # load page\n page = Wiki::Api::Page.new name: \"program\"\n assert page.is_a?(Wiki::Api::Page), \"expected Page object\"\n headline = page.root_headline\n assert headline.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n assert headline.name == \"program\", \"expected developer headline\"\n\n # search nested headline: english\n english = headline.headline(\"english\").first\n assert english.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n\n # search nested headline: noun\n noun = english.headline(\"noun\").first\n assert noun.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n\n # get block\n block = noun.block\n assert block.is_a?(Wiki::Api::PageBlock), \"expected PageBlock object\"\n\n # list items\n block.list_items.each do |list_item|\n assert list_item.is_a?(Wiki::Api::PageListItem), \"expected PageListItem object\"\n # links\n list_item.links.each do |link|\n assert link.is_a?(Wiki::Api::PageLink), \"expected PageListItem object\"\n end\n end\n\n # links\n block.links.each do |link|\n assert link.is_a?(Wiki::Api::PageLink), \"expected PageListItem object\"\n end\n end",
"def pos_rseg_header\n pos_page_body\n end",
"def opinion_wizard_current_step_of(step)\n current_step_num = opinion_wizard_step_number(step)\n see_steps = content_tag(:span, class: \"hide-for-large\") do\n concat \" (\"\n concat content_tag :a, t(:\"decidim.opinions.opinions.wizard_steps.see_steps\"), \"data-toggle\": \"steps\"\n concat \")\"\n end\n content_tag :span, class: \"text-small\" do\n concat t(:\"decidim.opinions.opinions.wizard_steps.step_of\", current_step_num: current_step_num, total_steps: total_steps)\n concat see_steps\n end\n end",
"def parent\n page\n end",
"def kopal_layout_after_page_header\n\n end",
"def location_heading\n LOCATION_HEADING\n end",
"def find_steps_defined_in_block(block)\r\n #log.debug \"#{block} #{block.class}\"\r\n block.each_with_index do |token,index|\r\n #log.debug \"Token #{token.class} #{token.text}\"\r\n if token.is_a?(YARD::Parser::Ruby::Legacy::RubyToken::TkCONSTANT) &&\r\n token.text =~ /^(given|when|then|and)$/i &&\r\n block[index + 2].is_a?(YARD::Parser::Ruby::Legacy::RubyToken::TkSTRING)\r\n log.debug \"Step found in Step Definition: #{block[index + 2].text} \"\r\n end\r\n\r\n end\r\n\r\n end",
"def provide_navigation_by_heading(heading)\n # Interface method\n end",
"def then_i_see_home_and_parent_links\n within \".gem-c-contextual-breadcrumbs\" do\n expect(page).to have_link(\"Home\")\n expect(page).to have_link(@parent[\"title\"])\n end\n end",
"def print_heading(p_location, c_location)\n puts \"Heading from #{p_location} to #{c_location}\"\n end",
"def assert_first_page\n assert_no_link PREV_LABEL\n end",
"def skip_main_heading?\n false\n end",
"def pretty_step step\n step.sub!(\"Given\", \"<div class='spector-keyword'>Given</div>\")\n step.sub!(\"When\", \"<div class='spector-keyword'>When</div>\") \n step.sub!(\"Then\", \"<div class='spector-keyword'>Then</div>\") \n step.sub!(\"And\", \"<div class='spector-keyword'>And</div>\")\n if step.include?(\"#\")\n step = \"<div class='spector-comment'>#{step}</div>\"\n end\n step = step.split(\"\\\"\").in_groups_of(2).map{|a,b| b.nil? ? a : \"#{a}<div class='spector-quote'>\\\"#{b}\\\"</div>\"}.join\n step\n end",
"def new_heading match\n \"<h#{match[:level]} id=\\\"#{match[:slug]}\\\">#{match[:title]}</h#{match[:level]}>\"\nend",
"def start_section(level, title)\n end",
"def visit_header\n composer.text_box 'Prepare for your visit', at: [30, composer.bounds.top - 405], size: 16, style: :bold\n end",
"def heading\n @heading='Browse'\n end",
"def sub_view\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).sub_handler\n page(SubmissionPage).verify_page_elements\n page(SubmissionPage).select_action(\"Submissions\")\n page(SubmissionPage).select_action(\"Comments\")\n page(MorePage).backpage\n end",
"def kopal_layout_before_page_header\n\n end",
"def headline; end",
"def assert_not_first_page\n assert_link PREV_LABEL\n end",
"def linkwizard_findsub_label\n $tracer.trace(__method__)\n return ToolTag.new(h3(\"/Find My Subscription/\") ,__method__)\n end",
"def find_page_end\n \n end",
"def sub_navigate\n page(FeedDetailsPage).touch_row\n page(MorePage).page_handler(\"Submission\")\n end",
"def step_location_for(step)\n underscored_step = Spinach::Support.underscore(step)\n location = method(underscored_step).source_location if self.respond_to?(underscored_step)\n end",
"def step_location_for(step)\n underscored_step = Spinach::Support.underscore(step)\n location = method(underscored_step).source_location if self.respond_to?(underscored_step)\n end",
"def session_heading(session)\n puts \"\\nAdding session heading for session #{session.id}...\" \n if session.location.include?(\"JHN\")\n keep_together(session.title, 14, 32, 100)\n else\n keep_together(session.title, 14, 32, 84)\n end\n add_to_index(:people, session.moderator.person.lastname_first.strip) if session.moderator\n in_column_line\n @size = 14\n move_to_newline(18)\n parse_and_add_text \"<b>Session #{session.identifier}</b>\", \"||\", :center\n @size = DEFAULT_SIZE\n move_to_newline\n in_column_line\n move_to_newline(24)\n @size = 14\n parse_and_add_text \"<b>#{session.title}</b>\", \"||\", :center, 18\n @size = DEFAULT_SIZE\n move_to_newline(5)\n move_to_newline\n parse_and_add_text \"<i>Session Moderator: #{[session.moderator.fullname, session.moderator.department_name].compact.join(\", \")}</i>\", \"||\", :center if session.moderator\n move_to_newline\n parse_and_add_text \"<b>#{session.location}</b>\", \"||\", :center\n @pdf.select_font DEFAULT_FONT\n move_to_newline\n @size = 9\n move_to_newline\n \n if session.location.include?(\"JHN\")\n parse_and_add_text \"<i>Johnson Hall is just west of Mary Gates Hall (MGH). Follow signs leading from the west entrance of MGH; please see map in the back of the program</i>\"\n move_to_newline\n move_to_newline\n end\n \n if session.location.include?(\"Meany Studio Theatre\")\n parse_and_add_text \"<i>Meany Studio Theatre is a five-minute walk northwest from the main entrance of MGH and across Red Square. Follow signs from the north entrance of MGH; please see map in the back of the program.</i>\"\n move_to_newline\n move_to_newline\n end \n \n parse_and_add_text \"* Note: Titles in order of presentation.\"\n @size = DEFAULT_SIZE\n move_to_newline\n move_to_newline\n \n end",
"def step_body(nav_step)\n I18n.t(\n nav_step,\n scope: h.locale_namespace + [:step_navigations],\n default: nav_step.to_s.titleize\n )\n end",
"def start_link_should_be_highlighted\n within '#sidebar' do\n expect(page).to have_css 'a#start-page.highlighted-link'\n end\nend",
"def tour_should_be_visible(title=nil)\n expect(page).to have_css 'div.hopscotch-bubble'\n if title.present?\n within 'div.hopscotch-bubble .hopscotch-title' do\n expect(page).to have_text title\n end\n end\nend",
"def mission(page)\n\tend",
"def get_section_heading(src, i)\n if src[i] =~ /^\\/\\*\\*? \\#+ *(.*)/\n heading = $1\n elsif src[i+1] =~ /^ ?\\* \\#+ *(.*)/\n heading = $1\n end\n return heading.gsub(' -- ', ' – ')\nend",
"def to_tab_heading\n heading = to_heading\n to_tab heading\n end",
"def page_title; end",
"def govuk_page_header(heading_details)\n tag.h1(class: 'govuk-heading-xl', id: 'main_title') do\n if heading_details.caption3.present?\n concat(tag.span(class: 'govuk-caption-m govuk-!-margin-bottom-1') do\n concat(heading_details.caption3)\n end).html_safe\n end\n if heading_details.caption?\n concat(tag.span(class: 'govuk-caption-xl') do\n concat(heading_details.caption)\n concat(\" — #{heading_details.caption2}\") if heading_details.caption2.present?\n end).html_safe\n end\n concat(heading_details.text)\n concat(tag.p(heading_details.subtitle, class: 'govuk-body-l')) if heading_details.subtitle.present?\n end\n end",
"def section\n pages = current_page.url.split(\"/\").reject(&:empty?)\n pages.first.capitalize if pages.any?\n end",
"def heading\n\t\t\"Works\"\n\tend",
"def section(title)\n puts \"===== #{title} =====\" if @display_headers\n yield\n puts if @display_headers\nend",
"def full_page\n end",
"def navigate_into\n title_element.when_present.click\n end",
"def partial\n \"/otus/page/taxon_name_header\"\n end",
"def include_at_top(mod) end",
"def page_title\n end",
"def document_heading\n @document[Blacklight.config[:show][:heading]]\n end",
"def within_a(outer_page_part)\n outer_page_part.with(self.description, self.xpath)\n end",
"def studyTitle\n $async::wait_until($janus::WAY_TOO_LONG_TO_LOAD) { page_header.visible? }\n sleep 1 #TODO Refactor methods, steps are failing due to recent update from imedidata\n $async::wait_until($janus::WAY_TOO_LONG_TO_LOAD) { !page_header.text.empty? }\n page_header.text\n end",
"def location\n unless @location\n cursor = html % 'h3 > b > a:first-of-type'\n cursor = cursor.next if cursor \n @location = $1 if cursor and LOCATION_NAME.match he_decode(cursor.to_s)\n end\n \n @location\n end",
"def main_controls_section\n @page.find(:span_id, 'ctl00_contentBody_ctl02_instock')\n end",
"def test_00010_home_page_contents\n check_main_menu\n check_bottom_menu\n check_footnote\n end",
"def find_parent_heading_for_level(heading, level)\n return if heading.nil?\n level_up = level - 1\n if heading[:level] == level_up\n heading\n else\n find_parent_heading_for_level(heading[:parent], level)\n end\n end",
"def starting_position; end",
"def extract_super_heading_result(doc, base_url:, query:)\n if super_entry_heading = doc.at_css(\"tr.browseSuperEntry\")\n return BentoSearch::ResultItem.new(\n title: super_entry_heading.text.strip,\n link: base_url.to_s\n )\n end\n end",
"def page_partial(page)\n page.set_page? ? 'set_page_li' : 'page_li'\n end",
"def section_heading(label)\n \n @renderer.section_heading(label)\n \n end",
"def heading\n self.class.heading\n end",
"def before_step(step)\n @current_step = step\n end",
"def start_link_should_not_be_highlighted\n within '#sidebar' do\n expect(page).not_to have_css 'a#start-page.highlighted-link'\n end\nend",
"def test_steps; end",
"def test_steps; end",
"def parent_browsing_context; end",
"def selected_page\n end",
"def output_section(heading, body)\n return '' if body.compact.empty?\n fancy_heading = Pry::Helpers::Text.bold(color(:heading, heading))\n Pry::Helpers.tablify_or_one_line(fancy_heading, body)\n end",
"def page_title() nil end",
"def kopal_layout_before_page_meta\n\n end",
"def test_home\n @current_test_name = \"Arch - Testing Home Page\"\n each_driver do\n each_view_redirects do\n common_elements?\n end\n end\n end",
"def template_page(site); end",
"def x\n wd.location[0]\n end",
"def location_once_scrolled_into_view; end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def page_title\n \"Changes Introduced by CMVC #{type}#{defect_name}\"\n end",
"def first_part\n self.parsed_page ||= @connect.page self.name\n self.parsed_page.search(\"p\").first.children.first\n end",
"def heading_for(w)\n w.refresh\n w.read_text.split(\"\\n\")[0,2]\n end",
"def header(in_page=\"\")\n\t # workaround to shoes/shoes4#1212:\n\t $clicky ||= []\n\t $clicky.each{ |i| i.hide }\n\t $clicky = []\n\t \n\t # Header\n\t self.scroll_top = 0\n\t background pattern(img_path \"bg1.png\")\n\t stack do\n\t background enve_blue(0.4)\n\t stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190\n\t flow(width:1.0) do\n\t stack(width:40){}\n\t menu = [\n\t\t [\"Home\",\"/\",\"noun_208357_cc.png\"],\n\t\t [\"All tasks\",\"/index\",\"noun_208394_cc.png\"],\n\t\t [\"Examples\",\"/examples\",\"noun_229087_cc.png\"],\n\t\t [\"Update\",\"/update\",\"noun_229107_cc.png\"],\n\t\t [\"Website\",\"http://enve-omics.ce.gatech.edu/\",\n\t\t \"noun_208472_cc.png\"],\n\t\t [\"About\",\"/about\",\"noun_229118_cc.png\"]\n\t ]\n\t menu.each do |i|\n\t\t flow(width:60, height:65) do\n\t\t if i[1]==in_page\n\t\t\tbackground enve_blue(0.4)\n\t\t\tstack{ background rgb(0,0,0,1.0) } # shoes/shoes4#1190\n\t\t end\n\t\t stack(width:5, height:50){}\n\t\t stack(width:50) do\n\t\t\timage img_path((i[1]==in_page ? \"w-\" : \"\")+i[2]),\n\t\t\t width:50, height:50, margin:2\n\t\t\tinscription i[0], align:\"center\",\n\t\t\t size:(linux? ? 8 : 10),\n\t\t\t stroke: (i[1]==in_page ? white : black)\n\t\t end\n\t\t stack(width:5){}\n\t\t end.click{ (i[1]=~/^https?:/) ? open_url(i[1]) : visit(i[1]) }\n\t\t stack(width:5){}\n\t end\n\t end\n\t stack(height:5, width:1.0){}\n\t stack(height:2, width:1.0) { background black }\n\t end\n\t stack(height:20, width:1.0){}\n end",
"def span_start; end",
"def test_step; end",
"def i18n_nav(thing)\n pages = @context.registers[:site].pages_by_language\n lang = @context.registers[:page]['language']\n return thing if @context.registers[:page]['is_default_language']\n # puts \"#{lang}: before '#{thing}'\"\n filtered = thing.find_all do |t|\n t['url'] == '/' || # always pass through \"Start\"\n exists_in_language(t['url'], lang)\n #pages[lang][t['url']].name.end_with?(\"#{lang}.md\")\n end\n # puts \"#{lang}: after '#{filtered}'\"\n filtered\n end",
"def go_to_where_you_belong\n \n end",
"def step_name(keyword, step_match, status, source_indent, is_background, file_colon_line)\n @current_step_is_background = is_background\n step_name = step_match.format_args(lambda{|param| %{#{param}}})\n step = { :keyword => keyword.gsub('*','').strip,\n :status => status,\n :name => h(step_name).gsub(/<([\\w ]+)>/, '<code>\\1</code>') }\n @current_step = step\n return if skip_current_step?\n\n @current_feature_element[:steps] << step\n end",
"def set_page_title\n case @title\n when 'Winter', 'Spring', 'Summer', 'Fall'\n parent_content = Content.new(@parent_path)\n @page_title = @title + ' ' + parent_content.title\n else\n @page_title = @title\n end\n end",
"def current_step \n @current_step || steps.first\n end",
"def pagetitle(page)\n \"Page #{page}\"\nend",
"def step\n\t\tif @root_element\n\t\t\t@root_element.step\n\t\tend\n\tend",
"def span_start=(_); end",
"def goto_line pos\n pages = ((pos * 1.00)/$pagesize).ceil\n pages -= 1\n #$sta = pages * $pagesize + 1\n $sta = pages * $pagesize + 0\n $cursor = pos\n #$log.debug \"XXX: GOTO_LINE #{$sta} :: #{$cursor}\"\nend",
"def set_page\n end",
"def section_title(title)\n end",
"def current_page; end",
"def current_page; end",
"def document_heading\n @document[\"subtitle_display\"] ? @document[Blacklight.config[:show][:heading]] + \": \" + @document[\"subtitle_display\"] : @document[Blacklight.config[:show][:heading]] \n end",
"def kopal_layout_after_page_meta\n\n end",
"def in_hierarchy(source, page_dir, paginate_path); end",
"def assert_page_section(section_heading)\n Helpers::MobileBrowserHelper.open_section_if_required(section_heading)\n page.all(\".cucumber__clarkordion__item__header--active\").each do |section|\n return nil if section.text.include?(section_heading)\n end\n raise Capybara::ElementNotFound.new(\"Section #{section_heading} was not found\")\n end"
] |
[
"0.5959006",
"0.5889816",
"0.58803445",
"0.56940585",
"0.5659796",
"0.5484181",
"0.54713124",
"0.54327184",
"0.5417966",
"0.5381293",
"0.537121",
"0.5362003",
"0.53132457",
"0.52892685",
"0.5285967",
"0.52847797",
"0.5264387",
"0.5253439",
"0.5250011",
"0.5247662",
"0.5247014",
"0.52314496",
"0.5227637",
"0.52207226",
"0.5216997",
"0.5182999",
"0.51444995",
"0.51316994",
"0.5100523",
"0.50976574",
"0.509196",
"0.5085572",
"0.5085572",
"0.50855625",
"0.50843745",
"0.5070863",
"0.50689083",
"0.5068204",
"0.50567496",
"0.5046523",
"0.50457036",
"0.50395644",
"0.5017321",
"0.5010378",
"0.50074166",
"0.500026",
"0.499291",
"0.49861237",
"0.49828908",
"0.49819967",
"0.49754673",
"0.4974172",
"0.49663",
"0.49556985",
"0.49545816",
"0.49510023",
"0.49389488",
"0.49382913",
"0.49320802",
"0.49316937",
"0.49033833",
"0.4901832",
"0.49001703",
"0.4896954",
"0.48918924",
"0.48918924",
"0.48887756",
"0.4874527",
"0.4871933",
"0.48628327",
"0.48625025",
"0.4859751",
"0.4855332",
"0.48507637",
"0.4849639",
"0.48475274",
"0.48475274",
"0.48475274",
"0.48463365",
"0.4844713",
"0.48418704",
"0.4841429",
"0.48378786",
"0.4830116",
"0.48197132",
"0.48176244",
"0.4816168",
"0.48161387",
"0.48122486",
"0.48115823",
"0.48113817",
"0.48105803",
"0.48099685",
"0.48019725",
"0.4801821",
"0.4800036",
"0.4800036",
"0.4797596",
"0.47974098",
"0.47940382",
"0.47936428"
] |
0.0
|
-1
|
to print "Hello!" twice.
|
def greeting
puts "Hello!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def this_output_twice\n print \"Calling print or puts\"\nend",
"def hello\n puts \"Hello Dude!!!\"\n puts \"Hellod Douchebag!!!\"\nend",
"def print_two_again(arg1, arg2) \r\n \tputs \"arg1: #{arg1}, arg2: #{arg2}\"\r\n end",
"def say_hello_ten_times #method signature\n phrase = \"Hello World\"\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n end",
"def print_two_again(arg1, arg2)\n\tputs \"arg1 #{arg1}, arg2: #{arg2}\"\nend",
"def print_hello(number_of_times)\r\n\ti = 0\r\n\twhile i < number_of_times\r\n\t\tprint \"hello \"\r\n\t\ti+=1\r\n\tend\r\nend",
"def say_hello_world_five_times\n puts \"Hello World!\"\n puts \"Hello World!\"\n puts \"Hello World!\"\n puts \"Hello World!\"\n puts \"Hello World!\"\nend",
"def print_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\n end",
"def another_greetings\n puts 'Hello'; puts 'Motherfucker'\nend",
"def puts_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1,arg2)\n\tputs \"arg1: #{arg1}, arg2:#{arg2}\"\nend",
"def print_two_again(arg1,arg2)\n\tputs \"\\t>> print_two_again\"\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\n\tputs \"\\t<< print_two_again\"\nend",
"def puts_two_again(args1, args2)\n\tputs \"args1: #{args1}, args2: #{args2}.\"\nend",
"def say_hello_ten_times\n\nphrase = \"Hello World!\"\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nend",
"def print_two_again(arg1, arg2)\n\tputs \"arg1 : #{arg1}, arg2 : #{arg2}\"\nend",
"def say_hello_world_ten_times\n phrase = \"Hello World\"\n \n \nphrase = \"Hello World!\"\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nend",
"def puts_two_again(arg1,arg2)\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again (arg1, arg2)\n puts \"again arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again arg1, arg2\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end",
"def print_two_again(arg1, arg2)\n puts \"arg1:#{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\r\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\r\nend",
"def print_two_again(arg1, arg2)\r\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\r\nend",
"def print_two_again(arg1,arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\n end",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg2}, arg2:#{arg2}\"\nend",
"def print_twice\n yield\n yield\nend",
"def puts_two_again(arg1, arg2)\r\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\r\nend",
"def print_two_again(arg1, arg2)\n p \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1; #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1; #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1 #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def speak2\n puts \"Goodbye world\"\n end",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\n end",
"def say_hello\n p \"hello\"\n # say_hello # an infinite loop\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def puts_two_again(arg1,arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"Hello\"\n i += 1\n end\nend",
"def greet2\n puts \"\\n\n We've looked up some interesting\\n\n facts about characters from the films,\\n\n and we invite you to learn some \\n\n more about them.\\n\"\n sleep 4\n end",
"def print_two_again(arg1,arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, args2: #{arg2}\"\nend",
"def second_method\n puts \"This is my second method\"\n \"Hello\"\nend",
"def print_two_again(arg1,arg2)\n puts \"arg1: #{arg1},arg2: #{arg2}\"\n end",
"def puts_two_again(arg1, arg2) # easy way to make a function, unlike puts_two\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def repeatHello()\n counter = 1\n while counter <= 5\n puts \"hello\"\n counter += 1\n end\nend",
"def print_once(msg)\n @lock.synchronize do\n print \"#{msg}\\n\" if @print_count == 0\n @print_count += 1\n @print_count = 0 if @print_count == hosts.size\n end\n end",
"def print_two_again(*args) #*args takes the arguments as a list\n\targ1, arg2 = args #even if you use more than 2 arguments, we only unpacked the first two \n\tputs \"arg1 is #{arg1} and arg2 is #{arg2}\"\nend",
"def say_hello_ten_times\n phrase = \"Hello World\"\n 10.times do\n puts phrase\n end \nend",
"def print_two(*args)\n\tputs \"\\t>> print_two\"\n\targ1, arg2 = args\n\tputs \"arg1: #{arg1}, arg2 #{arg2}\"\n\tputs \"\\t<< print_two\"\nend",
"def print_one()\n puts \"I got nothing'.\"\nend",
"def say_hi\n\t\tputs \"Hello!\"\n\tend",
"def another_greet(greeting, name)\n puts \"#{greeting}, #{name}!\"\n yield('Wake up', 'Neo')\nend",
"def goodbye\n puts \"\", \"Thank you! Goodbye :)\"\n end",
"def repeatHello(n)\n i = 0\n while i < n\n puts 'hello'\n i += 1\n end\nend"
] |
[
"0.7479575",
"0.6763845",
"0.6730663",
"0.66267717",
"0.66137666",
"0.6577955",
"0.65751195",
"0.65721506",
"0.65721506",
"0.65721506",
"0.65721506",
"0.65710735",
"0.6551262",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"0.6507977",
"0.65008295",
"0.64963627",
"0.6493345",
"0.6485256",
"0.64751774",
"0.6461103",
"0.64517784",
"0.64457124",
"0.6435648",
"0.642817",
"0.64122546",
"0.64122546",
"0.6400914",
"0.63924587",
"0.63764876",
"0.6375949",
"0.6359931",
"0.6359432",
"0.6359432",
"0.63557196",
"0.63557196",
"0.63557196",
"0.63557196",
"0.6354594",
"0.635459",
"0.6349145",
"0.6344827",
"0.63435256",
"0.6333722",
"0.6333722",
"0.6333722",
"0.6333722",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6332937",
"0.6275868",
"0.6257737",
"0.6256181",
"0.6249592",
"0.6237057",
"0.62043464",
"0.61974496",
"0.61916006",
"0.6181485",
"0.6179225",
"0.6179225",
"0.6179225",
"0.6179225",
"0.6176015",
"0.6167034",
"0.61104274",
"0.61091095",
"0.6104422",
"0.6101868",
"0.60967255",
"0.60959125",
"0.60860306",
"0.60764897"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.