_id
stringlengths
2
6
title
stringlengths
9
130
partition
stringclasses
3 values
text
stringlengths
30
4.3k
language
stringclasses
1 value
meta_information
dict
q3300
ActsAsStaticRecord.SingletonMethods.find_with_static_record
train
def find_with_static_record(*args)#:nodoc: if scope(:find).nil? && args if args.first.is_a?(Fixnum) && ((args.length == 1 || (args[1].is_a?(Hash) && args[1].values.delete(nil).nil?))) return static_record_cache[:primary_key][args.first]
ruby
{ "resource": "" }
q3301
ActsAsStaticRecord.SingletonMethods.calculate_with_static_record
train
def calculate_with_static_record(operation, column_name, options={})#:nodoc: if scope(:find).nil? && !options.any?{ |k,v| k.to_s.downcase != 'distinct' } key = "#{operation}_#{column_name}_#{options.none?{|k,v| v.blank? }}" static_record_cache[:calc][key]||= case operation.to_s when 'count' then #count the cache if we want all or the unique primary key if ['all', '', '*', primary_key].include?(column_name.to_s)
ruby
{ "resource": "" }
q3302
ActsAsStaticRecord.SingletonMethods.static_records_for_calculation
train
def static_records_for_calculation(column_name, options={}, &block)#:nodoc: if columns_hash.has_key?(column_name.to_s) records = static_record_cache[:primary_key].values.collect(&(column_name.to_sym)).compact results
ruby
{ "resource": "" }
q3303
ActsAsStaticRecord.SingletonMethods.initialize_static_record_cache
train
def initialize_static_record_cache#:nodoc: return unless @static_record_cache.nil? records = self.find_without_static_record(:all, acts_as_static_record_options[:find]||{}) @static_record_cache = records.inject({:primary_key =>
ruby
{ "resource": "" }
q3304
ActsAsStaticRecord.DefineFinderMethods.static_record_finder_method_name
train
def static_record_finder_method_name(finder, attributes)#:nodoc: method_to_call = "find_in_static_record_cache(#{finder.inspect}, #{attributes.inspect})" if attributes.length == 1 key_value = case attributes.keys.first.to_s when self.primary_key then [:primary_key, attributes.values.first.to_i]
ruby
{ "resource": "" }
q3305
ActsAsStaticRecord.DefineFinderMethods.define_static_record_finder_method
train
def define_static_record_finder_method(method_id, finder, bang, attributes)#:nodoc: method_to_call = static_record_finder_method_name(finder, attributes) method_with_static_record = "#{method_id}_with_static_rc" #override the method to search memory if there are no args class_eval %{ def self.#{method_with_static_record}(*args) if (args.dup.extract_options!).any? #{method_id}_without_static_rc(*args) else result = #{method_to_call} #{'result
ruby
{ "resource": "" }
q3306
ActsAsStaticRecord.DefineFinderMethods.method_missing
train
def method_missing(method_id, *arguments, &block)#:nodoc: # If the missing method is XXX_without_static_rc, define XXX # using the superclass ActiveRecord::Base method_missing then # Finally, alias chain it to XXX_with_static_rc if ((match = method_id.to_s.match(/(.*)_without_static_rc$/)) && (base_method_id = match[1])) begin return super(base_method_id, *arguments, &block) ensure define_static_rc_alias(base_method_id) end end # If the missing method is a finder like find_by_name # Define on the class then invoke find_by_name_with_static_rc if match = ActiveRecord::DynamicFinderMatch.match(method_id) attribute_names = match.attribute_names
ruby
{ "resource": "" }
q3307
Bollettino.Generator.generate!
train
def generate!(slip, path) image = MiniMagick::Image.open(File.expand_path('../../../assets/slip.png',
ruby
{ "resource": "" }
q3308
Hyperb.Compose.compose_down
train
def compose_down(params = {}) raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'project') path = '/compose/down' query = {} query[:project] = params[:project] if params.key?(:project) query[:vol] = params[:vol] if params.key?(:vol)
ruby
{ "resource": "" }
q3309
Hyperb.Compose.compose_create
train
def compose_create(params = {}) raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'project') path = '/compose/create' query = {} body = {} query[:project] = params[:project] if params.key?(:project) body[:serviceconfigs] = { 'M': {} } #
ruby
{ "resource": "" }
q3310
JProtobuf.Message.write_to_string_io
train
def write_to_string_io(string_io) java_proto.write_to(org.jruby.util.IOOutputSt
ruby
{ "resource": "" }
q3311
JProtobuf.Message.write_to_string
train
def write_to_string string_io = StringIO.new.set_encoding(Encoding::BINARY)
ruby
{ "resource": "" }
q3312
Zyps.FaceAction.do
train
def do(actor, targets) return if targets.empty? actor.vector.pitch
ruby
{ "resource": "" }
q3313
Zyps.ApproachAction.do
train
def do(actor, targets) return if targets.empty? #Apply thrust to the creature's movement vector, adjusted by elapsed time. actor.vector += Vector.new( delta,
ruby
{ "resource": "" }
q3314
Zyps.DestroyAction.do
train
def do(actor, targets) targets.each do |target|
ruby
{ "resource": "" }
q3315
Zyps.TagAction.do
train
def do(actor, targets) targets.each do |target| target.tags << tag
ruby
{ "resource": "" }
q3316
Zyps.BlendAction.do
train
def do(actor, targets) actor.color.red += (@color.red - actor.color.red) * delta actor.color.green += (@color.green - actor.color.green) * delta
ruby
{ "resource": "" }
q3317
Zyps.PushAction.do
train
def do(actor, targets) #Acceleration will be limited by elapsed time. push_force = delta targets.each do |target| #Angle to target is also angle of push force. push_angle = Utility.find_angle(actor.location, target.location)
ruby
{ "resource": "" }
q3318
Zyps.PullAction.do
train
def do(actor, targets) #Acceleration will be limited by elapsed time. pull_force = delta targets.each do |target| #Angle from target to actor is also angle of pull force (opposite of that for push). pull_angle = Utility.find_angle(target.location,
ruby
{ "resource": "" }
q3319
Zyps.SpawnAction.do
train
def do(actor, targets) prototypes.each do |prototype|
ruby
{ "resource": "" }
q3320
Zyps.SpawnAction.generate_child
train
def generate_child(actor, prototype) #Copy prototype so it can be spawned repeatedly if need be. child
ruby
{ "resource": "" }
q3321
Zyps.ExplodeAction.generate_child
train
def generate_child(actor, prototype) child = super child.vector
ruby
{ "resource": "" }
q3322
Zyps.ShootAction.do
train
def do(actor, targets) return if targets.empty? #If next item is a collection of prototypes, copy them all in at once. if prototypes[@prototype_index].respond_to?(:each) prototypes[@prototype_index].each do |prototype| actor.environment.add_object(generate_child(actor, prototype, targets[@target_index])) end #Otherwise copy the single prototype.
ruby
{ "resource": "" }
q3323
Zyps.ShootAction.generate_child
train
def generate_child(actor, prototype, target) child = super(actor, prototype)
ruby
{ "resource": "" }
q3324
Percolate.Percolator.find
train
def find(context, facet_name, *args) facet = find_facet(context, facet_name) if !facet return nil end case result = facet.find(*args) when Array result.map { |item| @entities[item] } when String
ruby
{ "resource": "" }
q3325
Percolate.Percolator.find_facet
train
def find_facet(context, facet_name) cache_key = [context, facet_name] if @facet_cache.include?(cache_key) facet = @facet_cache[cache_key] else begin require "percolate/facet/#{facet_name}_facet" rescue LoadError # Do nothing. Give the benefit of the doubt if the file doesn't exist.
ruby
{ "resource": "" }
q3326
Gitter.Utils.url_for
train
def url_for params p = params.dup query = p.map{|key, value| value.to_query(key) } *
ruby
{ "resource": "" }
q3327
Hyperb.Services.create_service
train
def create_service(params = {}) valid = check_arguments(params, 'name', 'image', 'replicas', 'serviceport', 'labels') raise ArgumentError, 'Invalid arguments.' unless valid path = '/services/create'
ruby
{ "resource": "" }
q3328
HashKit.Helper.symbolize
train
def symbolize(hash) {}.tap do |h| hash.each { |key, value| h[key.to_sym]
ruby
{ "resource": "" }
q3329
HashKit.Helper.stringify
train
def stringify(hash) {}.tap do |h| hash.each { |key, value| h[key.to_s]
ruby
{ "resource": "" }
q3330
HashKit.Helper.to_hash
train
def to_hash(obj) return nil unless obj return obj if obj.is_a?(Hash) hash = {}
ruby
{ "resource": "" }
q3331
Amico.Relationships.follow
train
def follow(from_id, to_id, scope = Amico.default_scope_key) return if from_id == to_id return if blocked?(to_id, from_id, scope) return if Amico.pending_follow && pending?(from_id, to_id, scope) if Amico.pending_follow Amico.redis.multi do |transaction| transaction.zadd("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
ruby
{ "resource": "" }
q3332
Amico.Relationships.unfollow
train
def unfollow(from_id, to_id, scope = Amico.default_scope_key) return if from_id == to_id Amico.redis.multi do Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", to_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", from_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", to_id)
ruby
{ "resource": "" }
q3333
Amico.Relationships.block
train
def block(from_id, to_id, scope = Amico.default_scope_key) return if from_id == to_id Amico.redis.multi do Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", to_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{to_id}", from_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", from_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{from_id}", to_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", to_id)
ruby
{ "resource": "" }
q3334
Amico.Relationships.accept
train
def accept(from_id, to_id, scope = Amico.default_scope_key) return if from_id == to_id
ruby
{ "resource": "" }
q3335
Amico.Relationships.deny
train
def deny(from_id, to_id, scope = Amico.default_scope_key) return if from_id == to_id Amico.redis.multi do Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id)
ruby
{ "resource": "" }
q3336
Amico.Relationships.following?
train
def following?(id, following_id, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3337
Amico.Relationships.follower?
train
def follower?(id, follower_id, scope = Amico.default_scope_key) !Amico.redis.zscore("#{Amico.namespa
ruby
{ "resource": "" }
q3338
Amico.Relationships.blocked?
train
def blocked?(id, blocked_id, scope = Amico.default_scope_key) !Amico.redis.zscore("#{Amico.namespa
ruby
{ "resource": "" }
q3339
Amico.Relationships.blocked_by?
train
def blocked_by?(id, blocked_by_id, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3340
Amico.Relationships.reciprocated?
train
def reciprocated?(from_id, to_id, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3341
Amico.Relationships.pending_with?
train
def pending_with?(from_id, to_id, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3342
Amico.Relationships.following_page_count
train
def following_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3343
Amico.Relationships.followers_page_count
train
def followers_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3344
Amico.Relationships.blocked_page_count
train
def blocked_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3345
Amico.Relationships.blocked_by_page_count
train
def blocked_by_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3346
Amico.Relationships.reciprocated_page_count
train
def reciprocated_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3347
Amico.Relationships.pending_page_count
train
def pending_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3348
Amico.Relationships.pending_with_page_count
train
def pending_with_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
ruby
{ "resource": "" }
q3349
Amico.Relationships.count
train
def count(id, type, scope = Amico.default_scope_key) validate_relationship_type(type)
ruby
{ "resource": "" }
q3350
Amico.Relationships.page_count
train
def page_count(id, type, page_size = Amico.page_size, scope = Amico.default_scope_key) validate_relationship_type(type)
ruby
{ "resource": "" }
q3351
Amico.Relationships.add_following_followers_reciprocated
train
def add_following_followers_reciprocated(from_id, to_id, scope) Amico.redis.multi do Amico.redis.zadd("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", Time.now.to_i, to_id) Amico.redis.zadd("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", Time.now.to_i, from_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id) Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", to_id) end if reciprocated?(from_id, to_id, scope)
ruby
{ "resource": "" }
q3352
Amico.Relationships.total_pages
train
def total_pages(key, page_size)
ruby
{ "resource": "" }
q3353
Amico.Relationships.members
train
def members(key, options = default_paging_options) options = default_paging_options.dup.merge!(options) if options[:page] < 1 options[:page] = 1 end if options[:page] > total_pages(key, options[:page_size]) options[:page] = total_pages(key, options[:page_size]) end index_for_redis = options[:page] - 1 starting_offset = (index_for_redis * options[:page_size])
ruby
{ "resource": "" }
q3354
GAAPI.Response.csv
train
def csv @csv ||= CSV.generate do |csv| reports.each(&:report).each do |report| # If there are no dimensions, but totals, we need to put an extra # column at the start for the word "Total". # I don't see how totals will be different than the metrics if you # don't specify dimensions, but whatever.
ruby
{ "resource": "" }
q3355
Hyperb.Containers.containers
train
def containers(params = {}) path = '/containers/json' query = {} query.merge!(params) response = JSON.parse(Hyperb::Request.new(self, path,
ruby
{ "resource": "" }
q3356
Hyperb.Containers.remove_container
train
def remove_container(params = {}) raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'id') path = '/containers/' + params[:id] query = {} query[:v] = params[:v] if params.key?(:v)
ruby
{ "resource": "" }
q3357
Hyperb.Containers.create_container
train
def create_container(params = {}) raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'image') path = '/containers/create' query = {} # set default size, otherwise container can't be started body = { labels: { sh_hyper_instancetype: 's1' } } # parse host_config options if params.key?(:host_config) body[camelize(:host_config)] = setup_host_config(params)
ruby
{ "resource": "" }
q3358
Hyperb.Containers.rename_container
train
def rename_container(params = {}) raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'name', 'id') path = '/containers/' + params[:id] + '/rename' query =
ruby
{ "resource": "" }
q3359
Logmsg.LogMsg.load
train
def load close if @loaded @path.each do |file| next unless File.exist?(file) @settings = Psych.load_file(file) next unless @settings.include?(@namespace)
ruby
{ "resource": "" }
q3360
Logmsg.LogMsg.parse
train
def parse(settings, logfile = nil) settings.each do |key, value| if value.is_a?(Hash) logfile = Logmsg::LogFile.new(key)
ruby
{ "resource": "" }
q3361
Rdio.Api.addFriend
train
def addFriend(user) method = 'addFriend' type =
ruby
{ "resource": "" }
q3362
Rdio.Api.addToCollection
train
def addToCollection(objs) method = 'addToCollection' type = true args
ruby
{ "resource": "" }
q3363
Rdio.Api.addToPlaylist
train
def addToPlaylist(playlist,tracks) method = 'addToPlaylist' type = true args =
ruby
{ "resource": "" }
q3364
Rdio.Api.createPlaylist
train
def createPlaylist(name,description,tracks,extras=nil) method = 'createPlaylist' type = Playlist args = {:name=>name,:description=>description,
ruby
{ "resource": "" }
q3365
Rdio.Api.currentUser
train
def currentUser(extras=nil) method = 'currentUser' type = User args = {} args[:extras] = extras
ruby
{ "resource": "" }
q3366
Rdio.Api.deletePlaylist
train
def deletePlaylist(playlist) method = 'deletePlaylist' type = Boolean
ruby
{ "resource": "" }
q3367
Rdio.Api.getActivityStream
train
def getActivityStream(user,scope,last_id=nil) method = 'getActivityStream' type = ActivityStream args = {:user=>user,:scope=>scope} args[:last_id] = last_id
ruby
{ "resource": "" }
q3368
Rdio.Api.getAlbumsForArtistInCollection
train
def getAlbumsForArtistInCollection(artist,user=nil,extras=nil) method = 'getAlbumsForArtistInCollection' type = Album args = {:artist=>artist} args[:user]
ruby
{ "resource": "" }
q3369
Rdio.Api.getHeavyRotation
train
def getHeavyRotation(user=nil,type=nil,friends=nil,limit=nil,extras=nil) method = 'getHeavyRotation' cls = TODO if type == 'artist' cls = Artist elsif type == 'album' cls = Album end args = {} args[:user] =
ruby
{ "resource": "" }
q3370
Rdio.Api.getNewReleases
train
def getNewReleases(time=nil,start=nil,count=nil,extras=nil) method = 'getNewReleases' type = Album args = {} args[:time] = time if time args[:start]
ruby
{ "resource": "" }
q3371
Rdio.Api.getObjectFromShortCode
train
def getObjectFromShortCode(short_code,type=nil) method = 'getObjectFromShortCode' type = BaseObj if not type
ruby
{ "resource": "" }
q3372
Rdio.Api.getObjectFromUrl
train
def getObjectFromUrl(url,type=nil) method = 'getObjectFromUrl' type = BaseObj if not type args =
ruby
{ "resource": "" }
q3373
Rdio.Api.getPlaybackToken
train
def getPlaybackToken(domain=nil) method = 'getPlaybackToken' type = String args = {} args[:domain]
ruby
{ "resource": "" }
q3374
Rdio.Api.getPlaylists
train
def getPlaylists(extras=nil) method = 'getPlaylists' type = Playlist args = {} args[:extras] = extras
ruby
{ "resource": "" }
q3375
Rdio.Api.getTopCharts
train
def getTopCharts(type,start=nil,count=nil,extras=nil) method = 'getTopCharts' cls = TODO case type when 'Artist' cls = Artist when 'Album' cls = Album when 'Track'
ruby
{ "resource": "" }
q3376
Rdio.Api.getTracksForAlbumInCollection
train
def getTracksForAlbumInCollection(album,user=nil,extras=nil) method = 'getTracksForAlbumInCollection' type = Track args = {:album=>album}
ruby
{ "resource": "" }
q3377
Rdio.Api.getTracksForArtistInCollection
train
def getTracksForArtistInCollection(artist,user=nil,extras=nil) method = 'getTracksForArtistInCollection' type = Track args = {:artist=>artist}
ruby
{ "resource": "" }
q3378
Rdio.Api.removeFriend
train
def removeFriend(user) method = 'removeFriend' type =
ruby
{ "resource": "" }
q3379
Rdio.Api.removeFromCollection
train
def removeFromCollection(objs) method = 'removeFromCollection'
ruby
{ "resource": "" }
q3380
Rdio.Api.removeFromPlaylist
train
def removeFromPlaylist(playlist,index,count,tracks) method = 'removeFromPlaylist' type = TODO
ruby
{ "resource": "" }
q3381
Rdio.Api.setPlaylistFields
train
def setPlaylistFields(playlist,name,description) method = 'setPlaylistFields' type = Boolean args
ruby
{ "resource": "" }
q3382
Rdio.Api.searchSuggestions
train
def searchSuggestions(query,extras) method = 'searchSuggestions' type = TODO args = {:query=>query} args[:extras]
ruby
{ "resource": "" }
q3383
Linkshare.Strategy.get_token
train
def get_token(username, password, sid, params = {}, opts = {}) request_body = opts.delete('auth_scheme') == 'request_body' params = {'grant_type' => 'password', 'username' => username, 'password' => password,
ruby
{ "resource": "" }
q3384
Socialcast.Gitx.run_cmd
train
def run_cmd(cmd) raise "Unstubbed git command #{cmd}" if ENV['SCGITX_TEST'] == 'true' say "\n$ " say
ruby
{ "resource": "" }
q3385
GoogleAuthentication.ActsAsGoogleUser.acts_as_google_user
train
def acts_as_google_user *modules # assign devise modules to module variable if modules.empty? self.devise_modules_to_include = [:omniauthable]
ruby
{ "resource": "" }
q3386
Hoiio.Client.set_up_resources
train
def set_up_resources @user = Hoiio::User.new self @sms = Hoiio::SMS.new self @voice = Hoiio::Voice.new self @fax = Hoiio::Fax.new self
ruby
{ "resource": "" }
q3387
OmekaClient.Client.put_item
train
def put_item(omeka_item) self.put("items",
ruby
{ "resource": "" }
q3388
OmekaClient.Client.build_request
train
def build_request(method, resource = nil, id = nil, body =nil, query = {}) url = self.endpoint url += "/" + resource unless resource.nil? url += "/" + id.to_s unless id.nil? query[:key] = self.api_key unless self.api_key.nil? case method when "get" self.connection.get(url, :params => query) when "post" self.connection.post(url, :body => body, :params => query)
ruby
{ "resource": "" }
q3389
Markascend.LineUnit.parse_inline_code
train
def parse_inline_code if s = @src.scan(/ (`{1,})(\ ?) .*? \2\1 /x) s =~ /^ (`{1,})(\ ?) (.*?)
ruby
{ "resource": "" }
q3390
Phonology.Sound.<<
train
def <<(*args) args.to_a.flatten.each do |feature| features.subtract Features.set(feature).to_a
ruby
{ "resource": "" }
q3391
Phonology.Sound.>>
train
def >>(*args) args.to_a.flatten.each do |feature| features.delete
ruby
{ "resource": "" }
q3392
Unified.Chunk.each_line
train
def each_line original_line_number = @original_line_number modified_line_number = @modified_line_number @lines.each do |line| if line.addition? yield line, nil, modified_line_number modified_line_number += 1 elsif line.deletion? yield line, original_line_number, nil
ruby
{ "resource": "" }
q3393
Sys::Proc::Concern::StaticInstance.ClassMethods.method_missing
train
def method_missing(method, *args, &block) if respond_to_missing?(method) new.public_send(method,
ruby
{ "resource": "" }
q3394
Manageable.ApplicationHelper.manageable_content_box
train
def manageable_content_box(options = {}, &block) box_buffer = Helpers::BoxBuilder.new(self) box_content = capture(box_buffer, &block) options = { :id => nil, :class => [] }.merge(options) block_class = ([ "block" ] + [ options[:class] ].flatten).join(" ") content_tag(:div, :class => block_class, :id => options[:id]) do block_out = box_buffer.buffers[:block_header].html_safe block_out << content_tag(:div, :class => "content") do
ruby
{ "resource": "" }
q3395
Manageable.ApplicationHelper.manageable_icon
train
def manageable_icon(name, size = :small, options = {}) return "" if name.nil? dimension = ( (size == :small) ? "16" : "32" ).html_safe options[:alt] ||= name.capitalize.gsub("_", " ")
ruby
{ "resource": "" }
q3396
Manageable.ApplicationHelper.manageable_controls
train
def manageable_controls(options = {}) options[:class] ||= "" options[:class] << " control" options[:class].strip! items = Helpers::NavigationBuilder.new yield items if block_given? content_tag("div", options) do items.collect { |item|
ruby
{ "resource": "" }
q3397
Manageable.ApplicationHelper.manageable_breadcrumbs
train
def manageable_breadcrumbs(options = {}) items = Helpers::NavigationBuilder.new yield items if block_given? options[:class] ||= "" options[:class] << " breadcrumb" options[:class].strip! content_tag("div", options) do
ruby
{ "resource": "" }
q3398
Manageable.ApplicationHelper.manageable_button
train
def manageable_button(body, url, html_options = {}) html_options[:class] = [html_options[:class], "button"].compact.join(" ")
ruby
{ "resource": "" }
q3399
Manageable.ApplicationHelper.manageable_attributes
train
def manageable_attributes(record, options = {}, &block) options[:html] ||= {} html_class = [ "attrtastic", record.class.to_s.underscore, options[:html][:class] ].compact.join(" ") output = tag(:div, { :class => html_class}, true) if block_given? output << capture(Helpers::AttributesBuilder.new(record, self), &block) else
ruby
{ "resource": "" }